| Module | Sequel::DataObjects::Postgres::DatabaseMethods |
| In: |
lib/sequel/adapters/do/postgres.rb
|
Methods to add to Database instances that access PostgreSQL via DataObjects.
Add the primary_keys and primary_key_sequences instance variables, so we can get the correct return values for inserted rows.
# File lib/sequel/adapters/do/postgres.rb, line 51
51: def self.extended(db)
52: db.instance_eval do
53: @primary_keys = {}
54: @primary_key_sequences = {}
55: end
56: end
Run the INSERT sql on the database and return the primary key for the record.
# File lib/sequel/adapters/do/postgres.rb, line 60
60: def execute_insert(sql, opts={})
61: synchronize(opts[:server]) do |conn|
62: com = conn.create_command(sql)
63: log_yield(sql){com.execute_non_query}
64: insert_result(conn, opts[:table], opts[:values])
65: end
66: end