Method: Sequel::MSSQL::DatasetMethods#output
- Defined in:
- lib/sequel/adapters/shared/mssql.rb
#output(into, values) ⇒ Object
Include an OUTPUT clause in the eventual INSERT, UPDATE, or DELETE query.
The first argument is the table to output into, and the second argument is either an Array of column values to select, or a Hash which maps output column names to selected values, in the style of #insert or #update.
Output into a returned result set is not currently supported.
Examples:
dataset.output(:output_table, [:deleted__id, :deleted__name])
dataset.output(:output_table, :id => :inserted__id, :name => :inserted__name)
258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/sequel/adapters/shared/mssql.rb', line 258 def output(into, values) output = {} case values when Hash output[:column_list], output[:select_list] = values.keys, values.values when Array output[:select_list] = values end output[:into] = into clone({:output => output}) end |