Prepared statements abstraction class
Class Statement
This class represents a statement prepared through the Handle.prepare method which is ready to be excecuted multiple times.
When done, use the Statement.close method to release the resources and refresh the database connection status.
Note: Closing the database handle while the statement is still open and in use may lead to various kind of errors. It's a thing that should be generally avoided.
Properties | |
affected | Indicates the amount of rows affected by the last query performed on this statement (through the Statement.execute method). |
Methods | |
aexec | Executes a repeated statement. |
close | Close this statement. |
execute | Executes a repeated statement. |
reset | Resets this statement |
Indicates the amount of rows affected by the last query performed on this statement (through the Statement.execute method).
Will be 0 if none, -1 if unknown, or a positive value if the number of rows can be determined.
Executes a repeated statement.
Statement.aexec( [params] )
params | The data to be passed to the repeated statement. | ||
Return | An instance of Recorset if the query generated a recorset. | ||
Raise |
|
This method executes a statement that has been prepared through the Handle.prepare method. If the prepared statement could return a recordset, it is returned.
Instead of passing the extra parameters to the underlying query, this method sends the value of a single array paramter.
The number of affected rows will be stored also in the Statement.affected property.
Close this statement.
Statement.close()
Statements are automatically closed when the statement object is garbage collected, but calling explicitly this helps to reclaim data as soon as it is not necessary anymore.
Executes a repeated statement.
Statement.execute( [...] )
... | The data to be passed to the repeated statement. | ||
Return | An instance of Recorset if the query generated a recorset. | ||
Raise |
|
This method executes a statement that has been prepared through the Handle.prepare method. If the prepared statement could return a recordset, it is returned.
The number of affected rows will be stored also in the Statement.affected property.
See also: Handle.
Resets this statement
Statement.reset()
Raise |
|
Some Database engines allow to reset a statement and retry to issue (execute) it without re-creating it anew.
If the database engine doesn't support this feature, a DBIError will be thrown.