The Swift adapter class being used by this database. Connections in this database’s connection pool will be instances of this class.
Call the DATABASE_SETUP proc directly after initialization, so the object always uses sub adapter specific code. Also, raise an error immediately if the connection doesn’t have a db_type specified, since one is required to include the correct subadapter.
# File lib/sequel/adapters/swift.rb, line 48 48: def initialize(opts) 49: super 50: if db_type = opts[:db_type] and !db_type.to_s.empty? 51: if prok = DATABASE_SETUP[db_type.to_s.to_sym] 52: prok.call(self) 53: else 54: raise(Error, "No :db_type option specified") 55: end 56: else 57: raise(Error, ":db_type option not valid, should be postgres, mysql, or sqlite") 58: end 59: end
Create an instance of swift_class for the given options.
# File lib/sequel/adapters/swift.rb, line 62 62: def connect(server) 63: setup_connection(swift_class.new(server_opts(server))) 64: end
Execute the given SQL, yielding a Swift::Result if a block is given.
# File lib/sequel/adapters/swift.rb, line 67 67: def execute(sql, opts={}) 68: synchronize(opts[:server]) do |conn| 69: begin 70: res = log_yield(sql){conn.execute(sql)} 71: yield res if block_given? 72: nil 73: rescue SwiftError => e 74: raise_error(e) 75: end 76: end 77: end
Execute the SQL on the this database, returning the number of affected rows.
# File lib/sequel/adapters/swift.rb, line 81 81: def execute_dui(sql, opts={}) 82: synchronize(opts[:server]) do |conn| 83: begin 84: log_yield(sql){conn.execute(sql).rows} 85: rescue SwiftError => e 86: raise_error(e) 87: end 88: end 89: end
Execute the SQL on this database, returning the primary key of the table being inserted to.
# File lib/sequel/adapters/swift.rb, line 93 93: def execute_insert(sql, opts={}) 94: synchronize(opts[:server]) do |conn| 95: begin 96: log_yield(sql){conn.execute(sql).insert_id} 97: rescue SwiftError => e 98: raise_error(e) 99: end 100: end 101: end
Method to call on a statement object to execute SQL that does not return any rows.
# File lib/sequel/adapters/swift.rb, line 107 107: def connection_execute_method 108: :execute 109: end
Close the given database connection.
# File lib/sequel/adapters/swift.rb, line 112 112: def disconnect_connection(c) 113: end
Execute SQL on the connection
# File lib/sequel/adapters/swift.rb, line 116 116: def log_connection_execute(conn, sql) 117: log_yield(sql){conn.execute(sql)} 118: end
Set the :db entry to the same as the :database entry, since Swift uses :db.
# File lib/sequel/adapters/swift.rb, line 122 122: def server_opts(o) 123: o = super 124: o[:db] ||= o[:database] 125: o 126: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.