Method: IBRuby::Statement#execute_for
- Defined in:
- lib/src.rb
#execute_for(parameters) {|row| ... } ⇒ Object
This method executes the SQL statement within a Statement object and passes it a set of parameters. Parameterized statements use question marks as place holders for values that may change between calls to execute the statement. This method returns a ResultSet object if the statement executed was a SQL query. If the statement was a non-query SQL statement (insert, update or delete) then the method returns a count of the number of rows affected. For all other types of statement the method returns nil. This method accepts a block taking a single parameter. If this block is provided and the statement is a query then the rows returned by the query will be passed, one at a time, to the block.
Parameters
- parameters
-
An array of the parameters for the statement. An effort will be made to convert the values passed in to the appropriate types but no guarantees are made (especially in the case of text fields, which will simply use to_s if the object passed is not a String).
Exception
- Exception
-
Generated whenever a problem occurs translating one of the input parameters or executing the SQL statement.
658 659 660 |
# File 'lib/src.rb', line 658 def execute_for(parameters) yield row end |