Home | Trees | Indices | Help |
---|
|
object --+ | Statement
Parsed SQL statement object.
This object represents a parsed statement on the server-side. It provides the ability to efficiently re-execute the same SQL statement.
Statement objects should only be created by the mysql.connection.Connection.new_statement method.
Note Creating a new Statement object will close any live unbuffered result objects and reset any live statement objects.
Note that when deleting a Statement object the system may delay deleting the actual structure stored on the server-side if you have not explicitly called close. This is because the close method requires communicating with the server, and if you are in the middle of an unbuffered fetch, it would reset the state of the connection. The Statement object may be involved in a reference cycle, and thus would only get removed by the garbage collector which can fire at unexpected times. It accomplishes this by putting the MySQL data structure into a special holding area in the Connection object, which is checked periodically at safe opportunities.
|
|||
|
__init__(...) x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
||
|
__new__(T,
S,
...) Returns a new object with type S, a subtype of T... |
||
|
_raise_error(...) Raise a statement-API error. |
||
|
affected_rows(...) Return the number of rows affected. |
||
|
bind_input(...) Bind input variables. |
||
|
bind_output(...) Bind output variables. |
||
|
close(...) Close the statement object, releasing any internally held memory. |
||
|
closed(...) Check if the statement is closed. |
||
|
execute(...) Execute the SQL statement. |
||
|
fetch(...) Fetch one row of data. |
||
|
field_count(...) Return the number of output fields. |
||
|
fields(...) Get information about the fields in the result. |
||
|
free_result(...) Release memory used by internal result buffers. |
||
|
get_param_count(...) Return the number of parameter markers in the query. |
||
|
get_prefetch_rows(...) Get the number of rows that will be prefetched when using a cursor. |
||
|
get_update_max_length(...) Determine if MySQL is currently set to compute the max_length attribute in the field objects. |
||
|
get_use_cursor(...) Determine whether or not a server-side cursor will be used for fetching results. |
||
|
insert_id(...) Get the ID generated for an AUTO_INCREMENT column. |
||
|
num_rows(...) Return the number of rows in the result set. |
||
|
reset(...) Clear all state. |
||
|
row_seek(...) Set the current row position. |
||
|
row_tell(...) Indicate the current row position. |
||
|
set_prefetch_rows(...) Set the number of rows to prefetch when using a cursor. |
||
|
set_update_max_length(...) Tell MySQL to compute the max_length attribute in the field objects. |
||
|
set_use_cursor(...) When fetching results, use a cursor. |
||
|
sqlstate(...) Return the current SQL state. |
||
Inherited from |
|
|||
|
__pyx_vtable__ = <PyCObject object at 0x852eb60>
|
|
|||
|
_connection = <member '_connection' of 'mysql.stmt.stmt.Statement'... Reference to the connection that created this statement. |
||
|
_input_binds List or tuple of mysql.stmt.bind_in.Input_Bind instances. |
||
|
_old_statements The mysql.connection._Statement_Cleaner instance from the connection object. |
||
|
_output_binds List or tuple of mysql.stmt.bind_out.Output_Bind instances. |
||
|
_stmt MYSQL_STMT structure. |
||
|
_stored Whether or not the result was stored in the execute method. |
|
|||
Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
|
Raise a statement-API error. |
Return the number of rows affected. Note For SELECT queries, this is only available if the result was stored by passing True to the store_result parameter in the execute call. Rows "affected" is defined as rows that were actually modified by an UPDATE, INSERT, or DELETE statement. All other statements return zero.
|
Bind input variables. This binds the objects that will be inspected for input variables. You should pass in the appropriate mysql.stmt.bind_in.Input_Bind instances as arguments in the appropriate order. See the mysql.stmt.bind_in docs for more detail. If you call this again, it will reset the bindings.
|
Bind output variables. This binds where the output for each fetch will go. You should pass in the appropriate mysql.stmt.bind_out.Output_Bind instances as arguments in the appropriate order. See the mysql.stmt.bind_out docs for more detail. If you call this again, it will reset the bindings.
|
Close the statement object, releasing any internally held memory. This will render this Statement object useless. This is automatically called when the object is deleted. If the result is already closed, this does nothing. Further attempts to use the result object will raise mysql.exceptions.Statement_Closed_Error. Note This will close any live unbuffered result objects and reset any live statement objects.
|
Check if the statement is closed. This can be used to check if the statement has been closed with the close method. This is the only method you may call (besides close) on a closed Statement object.
|
Execute the SQL statement. Note This will close any live unbuffered result objects and reset any live statement objects.
|
Fetch one row of data. Note This will close any live unbuffered result objects and reset any live statement objects.
|
Return the number of output fields.
|
Get information about the fields in the result. This returns a list of mysql.result.Field objects which you can use to inspect the types of fields in the result. Note that the max_length member of the Field object is only computed if you have called set_update_max_length.
|
Release memory used by internal result buffers. This process is normally taken care of when the Statement object is deleted, but you can call this to proactively free some memory.
|
Return the number of parameter markers in the query.
|
Get the number of rows that will be prefetched when using a cursor.
|
Determine if MySQL is currently set to compute the max_length attribute in the field objects.
|
Determine whether or not a server-side cursor will be used for fetching results.
|
Get the ID generated for an AUTO_INCREMENT column. The result is undefined for statements that do not update an AUTO_INCREMENT column.
|
Return the number of rows in the result set. Note For SELECT queries, this is only available if the result was stored by passing True to the store_result parameter in the execute call. The result is undefined for non-SELECT statements.
|
Clear all state. This will clear internal buffers and state on the client and the server. This releases the connection after doing a SELECT-like query, allowing you to perform other tasks.
|
Set the current row position. Note For SELECT queries, this is only available if the result was stored by passing True to the store_result parameter in the execute call.
|
Indicate the current row position. Note For SELECT queries, this is only available if the result was stored by passing True to the store_result parameter in the execute call. It returns an opaque object to be used with row_seek.
|
Set the number of rows to prefetch when using a cursor. The default is 1.
|
Tell MySQL to compute the max_length attribute in the field objects. Note that this will slow down execution of queries. This must be called before the data is fetched.
|
When fetching results, use a cursor. When the store_result attribute is set to False (the default) in the execute method, results are normally fetched one row at a time. Before executing the query, you can call this method to tell MySQL to fetch a few rows at a time. Use the set_prefetch_rows method to control the number of rows buffered at one time.
|
Return the current SQL state.
|
|
__pyx_vtable__
|
|
_connectionReference to the connection that created this statement. (Read only.)
|
_input_bindsList or tuple of mysql.stmt.bind_in.Input_Bind instances. (C only.) |
_old_statementsThe mysql.connection._Statement_Cleaner instance from the connection object. We hold a local refernce to this object because the connection and statement objects are involved in a cycle, and thus we can't rely on the _connection object existing during dealloc. |
_output_bindsList or tuple of mysql.stmt.bind_out.Output_Bind instances. (C only.) |
_stmtMYSQL_STMT structure. May be NULL. (C only.) |
_storedWhether or not the result was stored in the execute method. (C only.) |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0alpha3 on Sun Nov 12 20:01:36 2006 | http://epydoc.sourceforge.net |