5.3.3 Mapping Between SQL and Python Data Types

See Table 5.1 for a summary of mapping between SQL and Python data types. The col function can extract any value except LONG VARBINARY and return it as the proper Python value. In addition, the col_raw function can extract any column type except LONG VARCHAR and LONG VARBINARY as raw binary data and return it as a Python string.

Inserting, updating, or searching for BINARY, VARBINARY, or LONG VARBINARY values is not supported. BINARY and VARBINARY values can be read with col or col_raw.


Table 5.1: Mapping between SQL and Python types
SQL type Symbian column type (in the DBMS C++ API) Python type Supported
BIT EDbColBit int yes
TINYINT EDbColInt8 int yes
UNSIGNED TINYINT EDbColUint8 int yes
SMALLINT EDbColInt16 int yes
UNSIGNED SMALLINT EDbColUint16 int yes
INTEGER EDbColInt32 int yes
UNSIGNED INTEGER EDbColUint32 int yes
COUNTER EDbColUint32 (with the TDbCol::EAutoIncrement attribute) int yes
BIGINT EDbColInt64 long yes
REAL EDbColReal32 float yes
FLOAT EDbColReal64 float yes
DOUBLE EDbColReal64 float yes
DOUBLE PRECISION EDbColReal64 float yes
DATE EDbColDateTime float

(or long, with col_rawtime()

yes
TIME EDbColDateTime float

(or long, with col_rawtime()

yes
TIMESTAMP EDbColDateTime float

(or long, with col_rawtime()

yes
CHAR(n) EDbColText Unicode yes
VARCHAR(n) EDbColText Unicode yes
LONG VARCHAR EDbColLongText Unicode yes
BINARY(n) EDbColBinary str read only
VARBINARY(n) EDbColBinary str read only
LONG VARBINARY EDbColLongBinary n/a no


See About this document... for information on suggesting changes.