lib/src.rb in rubyfb-0.5.9 vs lib/src.rb in rubyfb-0.6

- old
+ new

@@ -358,10 +358,23 @@ # statement. # def execute_immediate(sql) yield(row) end + + # + # This function creates a new statement object + # + # ==== Parameters + # sql:: The SQL for the statement. + # + # ==== Exceptions + # Exception:: Generated whenever a problem occurs creating the + # statement object. + # + def create_statement(sql) + end end # # This class represents a Firebird database transaction. There may be @@ -561,17 +574,13 @@ # This is the constructor for the Statement class. # # ==== Parameters # connection:: The Connection object that the SQL statement will be # executed through. - # transaction:: The Transaction object that the SQL statement will be - # executed under. # sql:: The SQL statement to be prepared for execution. - # dialect:: The Firebird dialect to be used in preparing the SQL - # statement. # - def initialize(connection, transaction, sql, dialect) + def initialize(connection, sql) end # # This is the accessor for the connection attribute. @@ -579,17 +588,10 @@ def connection end # - # This is the accessor for the transaction attribute. - # - def transaction - end - - - # # This is the accessor for the SQL statement attribute. # def sql end @@ -617,57 +619,91 @@ def parameter_count end # - # This method executes the SQL statement within a Statement object. This - # method returns a ResultSet object if the statement executed was a SQL - # query. For non-query SQL statements (insert, update or delete) it - # returns an Integer indicating the number of affected rows. For all other - # statements 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. + # This method is used to determine whether a Statement object is prepared # + def prepared? + end + + # + # This method prepares the SQL statement + # + # ==== Parameters + # transaction:: A reference to the transaction object (optional). + # If this parameter is nil - the statement is prepared within + # its own (implicit) transaction. + # # ==== Exception - # Exception:: Generated if the Statement object actual requires some - # parameters or a problem occurs executing the SQL statement. + # Exception:: Generated whenever a problem occurspreparing the SQL statement. # - def execute - yield row + def prepare(transaction=nil) end - - + # - # This method executes the SQL statement within a Statement object and - # passes it a set of parameters. Parameterized statements use question + # This method executes the SQL statement within a Statement object optionaly + # passing 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 + # parameters:: An array of the parameters (optional) 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). # + # transaction:: A reference to the transaction object (optional). + # If this parameter is nil - the statement is execute within + # its own (implicit) transaction. For statements that return + # result set objects - the implicit transaction is resolved + # when the result set object is closed, for the other kind of statements + # the implicit transaction is resolved immediately after the execution + # # ==== Exception # Exception:: Generated whenever a problem occurs translating one of the # input parameters or executing the SQL statement. # - def execute_for(parameters) + def exec(parameters=nil, transaction=nil) yield row end - # + # This method behaves exactly as the exec() method, except that the statement + # is also closed. If no result set is generated the statement is closed immediately, + # otherwise the statement close() call thakes place when the resul tset close() is called. + # + # ==== Parameters + # parameters:: An array of the parameters (optional) 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). + # + # transaction:: A reference to the transaction object (optional). + # If this parameter is nil - the statement is execute within + # its own (implicit) transaction. For statements that return + # result set objects - the implicit transaction is resolved + # when the result set object is closed, for the other kind of statements + # the implicit transaction is resolved immediately after the execution + # + # ==== Exception + # Exception:: Generated whenever a problem occurs translating one of the + # input parameters or executing the SQL statement. + # + def exec_and_close(parameters=nil, transaction=nil) + yield row + end + + # # This method releases the database resources associated with a Statement # object and should be explicitly called when a Statement object is of # no further use. # # ==== Exceptions @@ -691,26 +727,21 @@ # # This is the constructor for the ResultSet object. # # ==== Parameters - # connection:: A reference to the Connection object that will be used - # to execute the SQL query. + # statement:: A reference to the Statement object. # transaction:: A reference to the Transaction object that will be used # in executing the SQL query. - # sql:: A reference to a String containing the SQL query that - # will be executed. - # dialect:: A reference to an integer containing the Firebird dialect - # to be used in executing the SQL statement. # # ==== Exceptions # FireRubyException:: Generated whenever a non-query SQL statement is # specified, an invalid connection or transaction is # provided or a problem occurs executing the SQL # against the database. # - def initialize(connection, transaction, sql, dialect) + def initialize(statement, transaction) end # # This is the accessor for the connection attribute. @@ -723,10 +754,15 @@ # This is the accessor for the transaction attribute. # def transaction end + # + # This is the accessor for the statement attribute. + # + def statement + end # # This is the accessor for the sql attribute. # def sql @@ -906,10 +942,11 @@ # This method fetches a count of the number of columns of data that are # available from a row. # def column_count end + # # This method fetches the name of a column within a row of data. # @@ -1149,10 +1186,10 @@ end # # This method loads the segments of a blob one after another. The blob - # segments are passed as strings to the block passed to the method. + # segments are passed as BINARY strings to the block passed to the method. # def each yield segment end end