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

Run the SELECT SQL on the database and yield the rows

[Source]

    # File lib/sequel/adapters/swift/postgres.rb, line 45
45:         def execute(sql, opts={})
46:           synchronize(opts[:server]) do |conn|
47:             begin
48:               res = conn.execute(sql)
49:               yield res if block_given?
50:               nil
51:             rescue SwiftError => e
52:               raise_error(e)
53:             end
54:           end
55:         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 59
59:         def execute_dui(sql, opts={})
60:           synchronize(opts[:server]) do |conn|
61:             begin
62:               conn.execute(sql).rows
63:             rescue SwiftError => e
64:               raise_error(e)
65:             end
66:           end
67:         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 71
71:         def execute_insert(sql, opts={})
72:           synchronize(opts[:server]) do |conn|
73:             begin
74:               conn.execute(sql)
75:               insert_result(conn, opts[:table], opts[:values])
76:             rescue SwiftError => e
77:               raise_error(e)
78:             end
79:           end
80:         end

[Validate]