Installation guide

mxODBC - Python ODBC Database Interface
9. DB-API Type Objects and Constructors
Since many database have problems recognizing some column's or parameter's
type beforehand (e.g. for LONGs and date/time values), the Python DB-API
provides a set of standard constructors to create objects that can hold special
values. When passed to the cursor methods, the module can then detect the
proper type of the input parameter and bind it accordingly.
In mxODBC these constructors are not needed: it uses the objects defined in
mxDateTime
for date/time values and is able to pass strings, buffer and
memoryview objects to LONG and normal CHAR columns without problems. You
only need them to write code that is portable across database interfaces.
A Cursor Object's
description attribute returns information about each of the
result columns of a query. The
type_code compares equal to one of Type Objects
defined below. Type Objects may be equal to more than one type code (e.g.
DATETIME could be equal to the type codes for date, time and timestamp
columns).
mxODBC returns more detailed description about type codes in the
description
attribute. See the section 8 Supported Data Types
for details. The type objects are
only defined for compatibility with the DB API standard and other database
interfaces.
Each subpackage exports the following constructors and singletons:
Date(year,month,day)
This function constructs an mxDateTime DateTime object holding the given
date value. The time is set to 0:00:00.
Time(hour,minute,second)
This function constructs an mxDateTime DateTimeDelta object holding the
given time value.
Timestamp(year,month,day,hour,minute,second)
This function constructs an mxDateTime DateTime object holding a time
stamp value.
DateFromTicks(ticks)
This function constructs an mxDateTime DateTime object holding the date
value from the given ticks value (number of seconds since the epoch; see the
documentation of the standard Python
time module for details).
Usage of Unix ticks (number of seconds since the Epoch) for date/time
database interfacing can cause troubles because of the limited date range they
cover.
156