Class Sequel::DataObjects::Database
In: lib/sequel/adapters/do.rb
Parent: Sequel::Database

DataObjects uses it‘s own internal connection pooling in addition to the pooling that Sequel uses. You should make sure that you don‘t set the connection pool size to more than 8 for a Sequel::DataObjects::Database object, or hack DataObjects (or Extlib) to use a pool size at least as large as the pool size being used by Sequel.

Methods

Constants

DISCONNECT_ERROR_RE = /terminating connection due to administrator command/

Public Instance methods

Setup a DataObjects::Connection to the database.

[Source]

    # File lib/sequel/adapters/do.rb, line 38
38:       def connect(server)
39:         setup_connection(::DataObjects::Connection.new(uri(server_opts(server))))
40:       end

[Source]

    # File lib/sequel/adapters/do.rb, line 42
42:       def disconnect_connection(conn)
43:         conn.dispose
44:       end

Execute the given SQL. If a block is given, the DataObjects::Reader created is yielded to it. A block should not be provided unless a a SELECT statement is being used (or something else that returns rows). Otherwise, the return value is the insert id if opts[:type] is :insert, or the number of affected rows, otherwise.

[Source]

    # File lib/sequel/adapters/do.rb, line 51
51:       def execute(sql, opts=OPTS)
52:         synchronize(opts[:server]) do |conn|
53:           begin
54:             command = conn.create_command(sql)
55:             res = log_connection_yield(sql, conn){block_given? ? command.execute_reader : command.execute_non_query}
56:           rescue ::DataObjects::Error => e
57:             raise_error(e)
58:           end
59:           if block_given?
60:             begin
61:               yield(res)
62:             ensure
63:              res.close if res
64:             end
65:           elsif opts[:type] == :insert
66:             res.insert_id
67:           else
68:             res.affected_rows
69:           end
70:         end
71:       end

Execute the SQL on the this database, returning the number of affected rows.

[Source]

    # File lib/sequel/adapters/do.rb, line 75
75:       def execute_dui(sql, opts=OPTS)
76:         execute(sql, opts)
77:       end

Execute the SQL on this database, returning the primary key of the table being inserted to.

[Source]

    # File lib/sequel/adapters/do.rb, line 81
81:       def execute_insert(sql, opts=OPTS)
82:         execute(sql, opts.merge(:type=>:insert))
83:       end

Return the subadapter type for this database, i.e. sqlite3 for do:sqlite3::memory:.

[Source]

    # File lib/sequel/adapters/do.rb, line 87
87:       def subadapter
88:         uri.split(":").first
89:       end

Return the DataObjects URI for the Sequel URI, removing the do: prefix.

[Source]

    # File lib/sequel/adapters/do.rb, line 93
93:       def uri(opts=OPTS)
94:         opts = @opts.merge(opts)
95:         (opts[:uri] || opts[:url]).sub(/\Ado:/, '')
96:       end

[Validate]