Installation guide
7. mxODBC Cursor Objects
The number of rows to fetch per call is specified by the parameter. If it is not
given, the cursor's
.arraysize determines the number of rows to be fetched.
The method will try to fetch as many rows as indicated by the size parameter.
If this is not possible due to the specified number of rows not being available,
fewer rows may be returned.
An
Error (or subclass) exception is raised if the previous call to .execute*()
did not produce any result set or no call was issued yet.
.fetchone()
Fetch the next row of a query result set, returning a single sequence, or None
when no more data is available.
An
Error (or subclass) exception is raised if the previous call to .execute*()
did not produce any result set or no call was issued yet.
mxODBC will move the associated database cursor forward by one row only.
.flush()
Frees any pending result set used by the cursor. If you only fetch some of the
rows of large result sets you can optimize memory usage by calling this
method.
Note that .execute*() and all the catalog methods do an implicit .flush()
prior to executing a new query.
.getcolattribute(position, info_id)
Get information about the result set column position. The column index
must be given as 0-based integer, i.e. the first result setup column has the
index 0.
info_id must be an integer and identifies the requested field information.
Suitable values are available through the
SQL object (see the Constants section
10.5 for details).
The method returns a tuple
(integer, string) giving an integer decoding
(in native integer byte order) of the first bytes of the API's result as well as the
raw buffer data as string. It is up to the caller to decode the data (e.g. using the
struct module).
This API gives you a wide range of information about the result set column. See
the ODBC SQLColAttribute API Documentation
for more information.
Some of these values are also available through the
cursor.description
attribute.
This is a list of useful info ids:
Option Comment
SQL.DESC_AUTO_UNIQUE_VALUE Check whether the result set column refers to an
auto-increment column of the table.
The check only returns valid values for numeric
columns that can be defined as auto-increment
column in the database.
107