Module Sequel::Swift::Postgres::DatabaseMethods
In: lib/sequel/adapters/swift/postgres.rb

Methods to add to Database instances that access PostgreSQL via Swift.

Methods

Included Modules

Sequel::Postgres::DatabaseMethods

Public Class methods

Add the primary_keys and primary_key_sequences instance variables, so we can get the correct return values for inserted rows.

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 37
37:         def self.extended(db)
38:           db.instance_eval do
39:             @primary_keys = {}
40:             @primary_key_sequences = {}
41:           end
42:         end

Public Instance methods

Return instance of Sequel::Swift::Postgres::Dataset with the given opts.

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 45
45:         def dataset(opts=nil)
46:           Sequel::Swift::Postgres::Dataset.new(self, opts)
47:         end

Run the SELECT SQL on the database and yield the rows

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 50
50:         def execute(sql, opts={})
51:           synchronize(opts[:server]) do |conn|
52:             begin
53:               conn.execute(sql)
54:               res = conn.results
55:               yield res if block_given?
56:             rescue SwiftError => e
57:               raise_error(e)
58:             ensure
59:               res.finish if res
60:             end
61:           end
62:         end

Run the DELETE/UPDATE SQL on the database and return the number of matched rows.

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 66
66:         def execute_dui(sql, opts={})
67:           synchronize(opts[:server]) do |conn|
68:             begin
69:               conn.execute(sql)
70:             rescue SwiftError => e
71:               raise_error(e)
72:             end
73:           end
74:         end

Run the INSERT SQL on the database and return the primary key for the record.

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 78
78:         def execute_insert(sql, opts={})
79:           synchronize(opts[:server]) do |conn|
80:             begin
81:               conn.execute(sql)
82:               insert_result(conn, opts[:table], opts[:values])
83:             rescue SwiftError => e
84:               raise_error(e)
85:             end
86:           end
87:         end

[Validate]