Class: DBI::DBD::Pg::PgExecutorAsync
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
#exec(sql, parameters = nil) ⇒ Object
31
32
33
|
# File 'lib/dbd/pg/exec.rb', line 31
def exec(sql, parameters = nil)
@pg_conn.async_exec(sql, parameters)
end
|
#exec_prepared(stmt_name, parameters = nil) ⇒ Object
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
|
#prepare(stmt_name, sql) ⇒ Object
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
|