Installation guide
7. mxODBC Cursor Objects
.prepare(sqlcmd)
Prepare a database operation (query or command) statement for later
execution and set
cursor.command. To later execute a prepared statement,
pass
cursor.command to one of the .execute*() methods.
cursor.prepare(sqlcmd) can also be used to check sqlcmd for syntax
errors, or to inspect the result set structure of a query without executing the
sqlcmd operation, by looking at cursor.description after calling
cursor.prepare().
sqlcmd may be a Unicode object in case the ODBC driver and/or database
support this.
Return values are not defined.
This method is may not be available in all mxODBC subpackages. Even if it is
available, the used ODBC driver or database may not support preparing
database operations for later reuse.
.scroll(value, mode='relative')
Scroll the cursor in the result set according to mode.
If mode is
'relative' (default), value is taken as offset to the current position
in the result set, if set to
'absolute', value gives the absolute position.
An
IndexError is raised in case the scroll operation leaves the result set. In
this case, the cursor position is not changed.
This method will use native scrollable cursors, if the data source provides
these, or revert to an emulation for forward-only scrollable cursors. Please
check whether the data source supports this method using the included
mx/ODBC/Misc/test.pyc script.
Warning:
Some ODBC drivers have trouble scrolling in result sets which use BLOBs or
other data types for which the data size cannot be determined at prepare time.
mxODBC currently raises a NotSupportedError in case a request for
backward scrolling is made in such a result set. Hopefully, this will change as
ODBC drivers become more mature.
.setconverter(converter)
This method sets the converter function to use for subsequent fetches. Passing
None as converter will reset the converter mechanism to its default setting. See
the Supported Data Types
section 8 for details on how user-defined converters
work.
The current converter function used on the cursor can be queried through the
read-only cursor.converter attribute.
.setcursorname(name)
Sets the name to be associated with the cursor object.
There is a length limit for names in SQL at 18 characters. An
InternalError
will be raised if the name is too long or otherwise not useable.
111