Class | Amalgalite::Statement |
In: |
lib/amalgalite/statement.rb
lib/amalgalite/statement.rb |
Parent: | Object |
api | [R] | |
api | [R] | |
db | [R] | |
db | [R] |
Bind parameters to the sql statement.
Bindings in SQLite can have a number of formats:
? ?num :var @var $var
Where ‘num’ is an Integer and ‘var‘is an alphanumerical variable. They may exist in the SQL for which this Statement was created.
Amalgalite binds parameters to these variables in the following manner:
If bind is passed in an Array, either as +bind( "foo", "bar", "baz")+ or as bind( ["foo", "bar", "baz"] ) then each of the params is assumed to be positionally bound to the statement( ?, ?num ).
If bind is passed a Hash, either as +bind( :foo => 1, :bar => ‘sqlite’ )+ or as bind( { :foo => 1, ‘bar’ => ‘sqlite’ }) then it is assumed that each parameter should be bound as a named parameter (:var, @var, $var).
If bind is not passed any parameters, or nil, then nothing happens.
Bind parameters to the sql statement.
Bindings in SQLite can have a number of formats:
? ?num :var @var $var
Where ‘num’ is an Integer and ‘var‘is an alphanumerical variable. They may exist in the SQL for which this Statement was created.
Amalgalite binds parameters to these variables in the following manner:
If bind is passed in an Array, either as +bind( "foo", "bar", "baz")+ or as bind( ["foo", "bar", "baz"] ) then each of the params is assumed to be positionally bound to the statement( ?, ?num ).
If bind is passed a Hash, either as +bind( :foo => 1, :bar => ‘sqlite’ )+ or as bind( { :foo => 1, ‘bar’ => ‘sqlite’ }) then it is assumed that each parameter should be bound as a named parameter (:var, @var, $var).
If bind is not passed any parameters, or nil, then nothing happens.
Iterate over the results of the statement returning each row of results as a hash by column_name. The column names are the value after an ‘AS’ in the query or default chosen by sqlite.
Iterate over the results of the statement returning each row of results as a hash by column_name. The column names are the value after an ‘AS’ in the query or default chosen by sqlite.
Execute the statement with the given parameters
If a block is given, then yield each returned row to the block. If no block is given then return all rows from the result. No matter what the prepared statement should be reset before returning the final time.
Execute the statement with the given parameters
If a block is given, then yield each returned row to the block. If no block is given then return all rows from the result. No matter what the prepared statement should be reset before returning the final time.
reset the Statement back to it state right after the constructor returned, except if any variables have been bound to parameters, those are still bound.
reset the Statement back to it state right after the constructor returned, except if any variables have been bound to parameters, those are still bound.
reset the Statement back to it state right after the constructor returned, AND clear all parameter bindings.
reset the Statement back to it state right after the constructor returned, AND clear all parameter bindings.
Inspect the statement and gather all the meta information about the results, include the name of the column result column and the origin column. The origin column is the original database.table.column the value comes from.
The full meta information from the origin column is also obtained for help in doing type conversion.
As iteration over the row meta informatio happens, record if the special "ROWID", "OID", or "ROWID" column is encountered. If that column is encountered then we make note of it.
Inspect the statement and gather all the meta information about the results, include the name of the column result column and the origin column. The origin column is the original database.table.column the value comes from.
The full meta information from the origin column is also obtained for help in doing type conversion.
As iteration over the row meta informatio happens, record if the special "ROWID", "OID", or "ROWID" column is encountered. If that column is encountered then we make note of it.
Write any blobs that have been bound to parameters to the database. This assumes that the blobs go into the last inserted row