This table shows the recommended data types for extracting data from the databases supported in Qt. Note that types used in Qt are not necessarily valid as input types to a specific database system. e.g., A double might work perfectly as input for floating point records in a particular database, but not necessarily as a storage format for output from that database, because it would be stored with 64-bit precision in C++.
IBM DB2 data type
|
SQL type description
|
Recommended input (C++ or Qt data type)
|
SMALLINT
|
16-bit signed integer
|
typedef qint16
|
INTEGER
|
32-bit signed integer
|
typedef qint32
|
BIGINT
|
64-bit signed integer
|
typedef qint64
|
REAL
|
32-bit Single-precision floating point
|
typedef qreal
|
DOUBLE PRECISION
|
64-bit Double-precision floating point
|
Mapped to
QString
for high precision doubles, otherwise qreal
|
FLOAT
|
64-bit Double-precision floating point
|
typedef qreal
|
CHAR
|
Fixed-length, null-terminated character string
|
Mapped to
QString
|
VARCHAR
|
Null-terminated varying length string
|
Mapped to
QString
|
LONG VARCHAR
|
Not null-terminated varying length character string
|
Mapped to
QString
|
BLOB
|
Not null-terminated varying binary string with 4-byte string length indicator
|
Mapped to
QByteArray
|
CLOB
|
Character large string object
|
Mapped to
QString
|
DATE
|
Null-terminated character string of the following format: yyyy-mm-dd
|
Mapped to
QDate
|
TIME
|
Null-terminated character string of the following format: hh.mm.ss
|
Mapped to
QTime
|
TIMESTAMP
|
Null-terminated character string of the following format: yyyy-mm-dd-hh.mm.ss.nnnnnn
|
Mapped to
QDateTime
|
Oracle Call Interface data type
|
SQL type description
|
Recommended input (C++ or Qt data type)
|
NUMBER
|
FLOAT, DOUBLE, PRECISIONc REAL
|
Mapped to
QString
for high precision doubles, otherwise qreal
|
NUMBER(38)
|
INTEGER INT SMALLINT
|
typedef qint8/16/32/64
|
NUMBER(p,s)
|
NUMERIC(p,s) DECIMAL(p,s)a
|
Mapped to
QString
|
NVARCHAR2(n)
|
Character string (NATIONAL CHARACTER VARYING(n) NATIONAL CHAR VARYING(n) NCHAR VARYING(n))
|
Mapped to
QString
|
NCHAR(n)
|
Character string (NATIONAL CHARACTER(n) NATIONAL CHAR(n) NCHAR(n))
|
Mapped to
QString
|
CHAR(n)
|
Character string (CHARACTER(n) CHAR(n))
|
Mapped to
QString
|
CLOB
|
Character large string object
|
Mapped to
QString
|
BLOB
|
A binary large object
|
Mapped to
QByteArray
|
TIMESTAMP
|
Year, month, and day values of date, as well as hour, minute, and second values of time
|
Mapped to
QDateTime
|
PostgreSQL data type
|
SQL type description
|
Recommended input (C++ or Qt data type)
|
BOOLEAN
|
布尔
|
bool
|
SMALLINT
|
16-bit signed integer
|
typedef qint16
|
INTEGER
|
32-bit signed integer
|
typedef qint32
|
BIGINT
|
64-bit signed integer
|
typedef qint64
|
REAL
|
32-bit variable-precision floating point
|
typedef qreal
|
DOUBLE PRECISION
|
64-bit variable-precision floating point
|
Mapped to
QString
for high precision doubles, otherwise qreal
|
DECIMAL VARIABLE
|
user-specified precision, exact
|
typedef qreal
|
NUMERIC VARIABLE
|
user-specified precision, exact
|
typedef qreal
|
VARCHAR
|
variable-length character string
|
Mapped to
QString
|
CHARACTER
|
Character string of fixed-length
|
Mapped to
QString
|
TEXT
|
Character string of variable-length
|
Mapped to
QString
|
CLOB
|
Character large string object
|
Mapped to
QString
|
TIMESTAMP
|
8 bytes, both date and time
|
Mapped to
QDateTime
|
TIMESTAMP
|
8 bytes, both date and time, with time zone
|
Mapped to
QDateTime
|
DATE
|
4 bytes, dates only
|
Mapped to
QDate
|
TIME
|
8 bytes, times of day only 00:00:00.00 - 23:59:59.99
|
Mapped to
QTime
|
TIME
|
12 bytes times of day only, with time zone 00:00:00.00+12
|
Mapped to
QDateTime
|
Mimer SQL type
|
SQL type description
|
Recommended input (C++ or Qt data type)
|
SMALLINT
|
16-bit signed integer
|
typedef qint16
|
INTEGER
|
32-bit signed integer
|
typedef qint32
|
INTEGER(n)
|
Integer with up to 45 digits precision
|
Mapped to
QString
|
BIGINT
|
64-bit signed integer
|
typedef qint64
|
REAL
|
32-bit Single-precision IEEE floating point
|
typedef float
|
DOUBLE PRECISION
|
64-bit Double-precision IEEE floating point
|
Mapped to
QString
for high precision doubles, otherwise qreal
|
FLOAT
|
64-bit Double-precision IEEE floating point
|
Mapped to
QString
for high precision doubles, otherwise qreal
|
FLOAT(n)
|
Floating point with up to 45 digits precision
|
Mapped to
QString
|
DECIMAL(p,s)
|
Decimal with up to 45 digits precision and scale
|
Mapped to
QString
|
CHAR
|
Fixed-length character Latin-1 string (CHAR or character)
|
Mapped to
QString
|
VARCHAR
|
Variable length Latin-1 string (VARCHAR or CHARACTER VARYING)
|
Mapped to
QString
|
NCHAR
|
Fixed-length Unicode string (NCHAR or NATIONAL CHARACTER)
|
Mapped to
QString
|
NVARCHAR
|
Variable length Unicode string (NVARCHAR or NATIONAL CHARACTER VARYING)
|
Mapped to
QString
|
BINARY
|
Fixed length binary data
|
Mapped to
QByteArray
|
VARBINARY
|
Variable length binary data (VARBINARY or BINARY VARYING)
|
Mapped to
QByteArray
|
BLOB
|
Binary large object (BLOB or BINARY LARGE OBJECT)
|
Mapped to
QByteArray
|
CLOB
|
Latin-1 character large object (CLOB or CHARACTER LARGE OBJECT)
|
Mapped to
QString
|
NCLOB
|
Unicode character large object (NCLOB or NATIONAL CHARACTER LARGE OBJECT)
|
Mapped to
QString
|
DATE
|
Date consisting of year, month, and day
|
Mapped to
QDate
|
TIME
|
Time consisting of hours, minute, seconds with optional fractional seconds
|
Mapped to
QTime
|
TIMESTAMP
|
Date and time with optional fractional seconds
|
Mapped to
QDateTime
|
BUILTIN.UUID
|
Universally unique identifier
|
Mapped to
QUuid
|
BOOLEAN
|
布尔
|
bool
|
INTERVAL YEAR(7)
|
Year, format '±yyyyyyy' (max precision)
|
Mapped to
QString
|
INTERVAL YEAR(7) TO MONTH
|
Year to month, format '±yyyyyyy-mm' (max precision)
|
Mapped to
QString
|
INTERVAL MONTH(7)
|
Month, format '±mmmmmmm' (max precision)
|
Mapped to
QString
|
INTERVAL DAY(7)
|
Day, format '±ddddddd' (max precision)
|
Mapped to
QString
|
INTERVAL DAY(7) TO HOUR
|
Day to hour, format '±ddddddd hh' (max precision)
|
Mapped to
QString
|
INTERVAL DAY(7) TO MINUTE
|
Day to minute, format '±ddddddd hh:mm' (max precision)
|
Mapped to
QString
|
INTERVAL DAY(7) TO SECOND(9)
|
Day to second, format '±ddddddd hh:mm:ss[.fffffffff]' (max precision)
|
Mapped to
QString
|
INTERVAL HOUR(8)
|
Hour, format '±hhhhhhhh' (max precision)
|
Mapped to
QString
|
INTERVAL HOUR(8) TO MINUTE
|
Hour to minute, format '±hhhhhhhh:mm' (max precision)
|
Mapped to
QString
|
INTERVAL HOUR(8) TO SECOND(9)
|
Hour to second, format '±hhhhhhhh:mm:ss[.fffffffff]' (max precision)
|
Mapped to
QString
|
INTERVAL MINUTE(10)
|
Minute, format '±mmmmmmmmmm' (max precision)
|
Mapped to
QString
|
INTERVAL MINUTE(10) TO SECOND(9)
|
Minute to second, format '±mmmmmmmmmm:ss[.fffffffff]' (max precision)
|
Mapped to
QString
|
INTERVAL SECOND(12,9)
|
Second, format '±ssssssssssss[.fffffffff]' (max precision)
|
Mapped to
QString
|