Module: Imparcial::Driver::PostgreExpression
- Included in:
- PostgreAdapter
- Defined in:
- lib/imparcial/driver/postgre/expression.rb
Instance Method Summary collapse
Instance Method Details
#insert(options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/imparcial/driver/postgre/expression.rb', line 9 def insert ( = {} ) super begin seq_name = 'seq_' + [:table_name].to_s + '_id' id = conn.query "SELECT currval('#{seq_name}')" @last_insert_id = id[0][0].to_i rescue adapter_specific_exception; end end |
#last_insert_id ⇒ Object
24 25 26 27 28 |
# File 'lib/imparcial/driver/postgre/expression.rb', line 24 def last_insert_id @last_insert_id end |