Installation guide

mxODBC - Python ODBC Database Interface
SQL Type Python Type Comments
connection's encoding setting.
SQL.WCHAR,
SQL.WVARCHAR,
SQL.WLONGVARCHAR
(TEXT, BLOB or LONG
in SQL)
String or
Unicode
Whether a Python string or Unicode
object is returned depends on the setting
of the .stringformat attribute of the
cursor fetching the data.
In
EIGHTBIT_STRINGFORMAT
mode, the Unicode data is converted to a
Python string object based on the
connection's encoding setting.
SQL.BINARY,
SQL.VARBINARY,
SQL.LONGVARBINARY
(BLOB or LONG BYTE
in SQL)
String These can contain embedded 0-bytes and
other special characters.
Handling of these column types is
database dependent. Please refer to the
database's documentation for details.
SQL.TINYINT,
SQL.SMALLINT,
SQL.INTEGER,
SQL.BIT
Integer or
Long Integer
Bits are converted to Python integers 0
and 1 resp.
Unsigned short integers are fetched as
Python integers, unsigned integers as
Python long integers.
SQL.BIGINT
Long Integer mxODBC tries to fetch the long integer
data directly and falls back to using string
interfacing, if the platform does not
provide the necessary C types for this.
SQL.DECIMAL,
SQL.NUMERIC
Float or
decimal.Decimal
In FLOAT_DECIMALFORMAT mode
(default), mxODBC will fetch the numeric
data as Python float. Since Python stores
floats as double precision C float,
rounding errors may occur during the
conversion.
In DECIMAL_DECIMALFORMAT mode,
mxODBC will fetch the numeric data as
string and create a Python
decimal.Decimal instance from it which is
then returned. This avoids any rounding
errors.
SQL.REAL,
SQL.FLOAT,
SQL.DOUBLE
Float Python stores floats as double precision C
float, so rounding errors may occur during
the conversion.
SQL.DATE
DateTime instance or
datetime.date instance or
ticks or
(year,month,day) or
String
The type of the return values depends on
the setting of
cursor.datetimeformat and
whether the ODBC driver/manager does
return the value with proper type
150