Class: DBI::DBD::Pg::PgExecutorAsync
- Inherits:
-
PgExecutor
show all
- Defined in:
- lib/dbd/pg/exec.rb
Overview
Asynchronous implementation of PgExecutor, useful for 'green
thread' implementations (e.g., MRI <= 1.8.x) which would otherwise
suspend other threads while awaiting query results. -- FIXME:
PQsetnonblocking + select/poll would make the exec*
methods truly 'async', though this is rarely needed in
practice.
Instance Method Summary
(collapse)
Methods inherited from PgExecutor
#initialize
Instance Method Details
- (Object) exec(sql, parameters = nil)
31
32
33
|
# File 'lib/dbd/pg/exec.rb', line 31
def exec(sql, parameters = nil)
@pg_conn.async_exec(sql, parameters)
end
|
- (Object) exec_prepared(stmt_name, parameters = nil)
35
36
37
38
39
|
# File 'lib/dbd/pg/exec.rb', line 35
def exec_prepared(stmt_name, parameters = nil)
@pg_conn.send_query_prepared(stmt_name, parameters)
@pg_conn.block()
@pg_conn.get_last_result()
end
|
- (Object) prepare(stmt_name, sql)
41
42
43
44
45
|
# File 'lib/dbd/pg/exec.rb', line 41
def prepare(stmt_name, sql)
@pg_conn.send_prepare(stmt_name, sql)
@pg_conn.block()
@pg_conn.get_last_result()
end
|