Module: Imparcial::Driver::AbstractExpression::Insert

Included in:
Imparcial::Driver::AbstractExpression
Defined in:
lib/imparcial/driver/abstract/expression/insert.rb

Instance Method Summary collapse

Instance Method Details

#insert(options = {}) ⇒ Object

Description

Insert some records.

Usage

abstract_adapter.insert :table_name => ‘person’, :values => => 1, :name => ‘ronaldinho’

Options

  • :table_name

  • :values

Returning

nothing



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/imparcial/driver/abstract/expression/insert.rb', line 30

def insert ( options = {} )
      
  check_options expected_options_for_inserting, options

  sql = sql_for_inserting( options )
  
  logger.warn sql if @insert_logging
  
  query sql
              
rescue adapter_specific_exception => ex
  
  raise InsertError.new(ex.message)
        
end