PostgreSQL: last_insert_id uses select_value rather than using @connection.exec directly.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2005-11-13 08:09:37 +00:00
parent 068d9ef0ef
commit a762939894

View File

@@ -305,12 +305,12 @@ module ActiveRecord
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)