Class: Sequel::IBMDB::Statement
Overview
Wraps results returned by queries on IBM_DB.
Instance Method Summary collapse
-
#affected ⇒ Object
Return the number of rows affected.
-
#execute(*values) ⇒ Object
If this statement is a prepared statement, execute it on the database with the given values.
-
#fetch_array ⇒ Object
Return the results of a query as an array of values.
-
#field_name(ind) ⇒ Object
Return the field name at the given column in the result set.
-
#field_precision(key) ⇒ Object
Return the field precision for the given field name in the result set.
-
#field_type(key) ⇒ Object
Return the field type for the given field name in the result set.
-
#free ⇒ Object
Free the memory related to this statement.
-
#free_result ⇒ Object
Free the memory related to this result set, only useful for prepared statements which have a different result set on every call.
-
#initialize(stmt) ⇒ Statement
constructor
Hold the given statement.
-
#num_fields ⇒ Object
Return the number of fields in the result set.
Constructor Details
#initialize(stmt) ⇒ Statement
Hold the given statement.
131 132 133 |
# File 'lib/sequel/adapters/ibmdb.rb', line 131 def initialize(stmt) @stmt = stmt end |
Instance Method Details
#affected ⇒ Object
Return the number of rows affected.
136 137 138 |
# File 'lib/sequel/adapters/ibmdb.rb', line 136 def affected IBM_DB.num_rows(@stmt) end |
#execute(*values) ⇒ Object
If this statement is a prepared statement, execute it on the database with the given values.
142 143 144 |
# File 'lib/sequel/adapters/ibmdb.rb', line 142 def execute(*values) IBM_DB.execute(@stmt, values) end |
#fetch_array ⇒ Object
Return the results of a query as an array of values.
147 148 149 |
# File 'lib/sequel/adapters/ibmdb.rb', line 147 def fetch_array IBM_DB.fetch_array(@stmt) if @stmt end |
#field_name(ind) ⇒ Object
Return the field name at the given column in the result set.
152 153 154 |
# File 'lib/sequel/adapters/ibmdb.rb', line 152 def field_name(ind) IBM_DB.field_name(@stmt, ind) end |
#field_precision(key) ⇒ Object
Return the field precision for the given field name in the result set.
162 163 164 |
# File 'lib/sequel/adapters/ibmdb.rb', line 162 def field_precision(key) IBM_DB.field_precision(@stmt, key) end |
#field_type(key) ⇒ Object
Return the field type for the given field name in the result set.
157 158 159 |
# File 'lib/sequel/adapters/ibmdb.rb', line 157 def field_type(key) IBM_DB.field_type(@stmt, key) end |
#free ⇒ Object
Free the memory related to this statement.
167 168 169 |
# File 'lib/sequel/adapters/ibmdb.rb', line 167 def free IBM_DB.free_stmt(@stmt) end |
#free_result ⇒ Object
Free the memory related to this result set, only useful for prepared statements which have a different result set on every call.
173 174 175 |
# File 'lib/sequel/adapters/ibmdb.rb', line 173 def free_result IBM_DB.free_result(@stmt) end |
#num_fields ⇒ Object
Return the number of fields in the result set.
178 179 180 |
# File 'lib/sequel/adapters/ibmdb.rb', line 178 def num_fields IBM_DB.num_fields(@stmt) end |