Class: Pgtk::Pool::Txn
- Inherits:
-
Object
- Object
- Pgtk::Pool::Txn
- Defined in:
- lib/pgtk/pool.rb
Overview
A temporary class to execute a single SQL request.
Instance Method Summary collapse
- #exec(query, args = [], result = 0) ⇒ Object
-
#initialize(conn) ⇒ Txn
constructor
A new instance of Txn.
Constructor Details
#initialize(conn) ⇒ Txn
Returns a new instance of Txn.
121 122 123 |
# File 'lib/pgtk/pool.rb', line 121 def initialize(conn) @conn = conn end |
Instance Method Details
#exec(query, args = [], result = 0) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/pgtk/pool.rb', line 125 def exec(query, args = [], result = 0) @conn.exec_params(query, args, result) do |res| if block_given? yield res else rows = [] res.each { |r| rows << r } rows end end end |