Installation guide
8. Data Types supported by mxODBC
8.3 SQL Type Input Binding
The following data types are used for SQL type input binding mode -
cursor.bindmethod (inherited from connection.bindmethod) set to
BIND_USING_SQLTYPE.
The SQL type is what the database ODBC driver expects from mxODBC. The
interface then tries to convert the Python input objects to the Python type given in
the table before passing it on to the ODBC driver.
SQL Type Python Type Comments
SQL.CHAR,
SQL.VARCHAR,
SQL.LONGVARCHAR (TEXT,
BLOB or LONG in SQL)
String or
Unicode or
stringified object
The conversion truncates the string
at the SQL field length. The handling
of special characters depends on the
codepage the database uses.
Some database drivers/managers
can't handle binary data in these
column types, so you better check
the database's capabilities with the
included mx/ODBC/Misc/test.pyc
first before using them.
The handling of Unicode depends on
the setting of the .stringformat
attribute.
In NATIVE_UNICODE_
STRINGFORMAT mode, Unicode is
passed to the ODBC driver as native
Unicode. Strings are converted to
Unicode using the
cursor.encoding setting.
In all other modes, Unicode is
converted to an 8-bit string before
passing it to the ODBC driver using
the cursor.encoding setting.
Strings are passed as-is.
Note that for DateTime input objects,
seconds rounding is applied just like
for SQL.TIMESTAMP SQL types. For
DateTimeDelta input objects,
seconds are truncated to whole
seconds.
SQL.WCHAR,
SQL.WVARCHAR,
String or
Unicode or
The conversion truncates the string
at the SQL field length.
143