| 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 52
52: def self.extended(db)
53: db.instance_eval do
54: @primary_keys = {}
55: @primary_key_sequences = {}
56: end
57: end
Return instance of Sequel::DataObjects::Postgres::Dataset with the given opts.
# File lib/sequel/adapters/do/postgres.rb, line 60
60: def dataset(opts=nil)
61: Sequel::DataObjects::Postgres::Dataset.new(self, opts)
62: end
Run the INSERT sql on the database and return the primary key for the record.
# File lib/sequel/adapters/do/postgres.rb, line 66
66: def execute_insert(sql, opts={})
67: log_info(sql)
68: synchronize(opts[:server]) do |conn|
69: conn.create_command(sql).execute_non_query
70: insert_result(conn, opts[:table], opts[:values])
71: end
72: end