Permalink
Browse files

PostgreSQL: last_insert_id uses select_value rather than using @conne…

…ction.exec directly.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 068d9ef commit a762939894ec2f825ccafd439ce17bb30fc65dc3 @jeremy jeremy committed Nov 13, 2005
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -305,12 +305,12 @@ def remove_index(table_name, options) #:nodoc:
execute "DROP INDEX #{index_name}"
end
-
+
private
BYTEA_COLUMN_TYPE_OID = 17
def last_insert_id(table, sequence_name)
- Integer(@connection.exec("SELECT currval('#{sequence_name}')")[0][0])
+ Integer(select_value("SELECT currval('#{sequence_name}')"))
end
def select(sql, name = nil)

0 comments on commit a762939

Please sign in to comment.