| 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
Return instance of Sequel::DataObjects::Postgres::Dataset with the given opts.
# File lib/sequel/adapters/do/postgres.rb, line 59
59: def dataset(opts=nil)
60: Sequel::DataObjects::Postgres::Dataset.new(self, opts)
61: end
Run the INSERT sql on the database and return the primary key for the record.
# File lib/sequel/adapters/do/postgres.rb, line 65
65: def execute_insert(sql, opts={})
66: synchronize(opts[:server]) do |conn|
67: com = conn.create_command(sql)
68: log_yield(sql){com.execute_non_query}
69: insert_result(conn, opts[:table], opts[:values])
70: end
71: end