Data Types for Qt-supported Database Systems#
Recommended data types for database systems
Recommended Data Types for Qt-Supported Database Systems#
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 Types#
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
QStringfor high precision doubles, otherwise qrealFLOAT
64-bit Double-precision floating point
typedef qreal
CHAR
Fixed-length, null-terminated character string
Mapped to
QStringVARCHAR
Null-terminated varying length string
Mapped to
QStringLONG VARCHAR
Not null-terminated varying length character string
Mapped to
QStringBLOB
Not null-terminated varying binary string with 4-byte string length indicator
Mapped to
QByteArrayCLOB
Character large string object
Mapped to
QStringDATE
Null-terminated character string of the following format: yyyy-mm-dd
Mapped to
QDateTIME
Null-terminated character string of the following format: hh.mm.ss
Mapped to
QTimeTIMESTAMP
Null-terminated character string of the following format: yyyy-mm-dd-hh.mm.ss.nnnnnn
Mapped to
QDateTime
Borland InterBase Data Types#
Borland InterBase data type
SQL type description
Recommended input (C++ or Qt data type)
BOOLEAN
Boolean
bool
TINYINT
8 bit signed integer
typedef qint8
SMALLINT
16-bit signed integer
typedef qint16
INTEGER
32-bit signed integer
typedef qint32
BIGINT LONG
64-bit signed integer
typedef qint64
REAL FLOAT
32-bit floating point
typedef qreal
FLOAT
64-bit floating point
typedef qreal
DOUBLE
64-bit floating point
typedef qreal
DOUBLE PRECISION
64-bit Double-precision floating point
Mapped to
QStringfor high precision doubles, otherwise qrealVARCHAR STRING
Character string, Unicode
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringDATE
Displays date. Format: ‘yyyy-mm-dd’
Mapped to
QDateTIME
Displays time. Format is ‘hh:mm:ss’ in 24-hour format
Mapped to
QTimeTIMESTAMP
Displays a timestamp. Format is ‘yyyy-mm-dd hh:mm:ss’
Mapped to
QDateTime
MySQL Data Types#
MySQL data type
SQL type description
Recommended input (C++ or Qt data type)
TINYINT
8 bit signed integer
typedef qint8
TINYINT UNSIGNED
8 bit unsigned integer
typedef quint8
SMALLINT
16-bit signed integer
typedef qint16
SMALLINT UNSIGNED
16-bit unsigned integer
typedef quint16
INT
32-bit signed integer
typedef qint32
INT UNSIGNED
32-bit unsigned integer
typedef quint32
BIGINT
64-bit signed integer
typedef qint64
FLOAT
32-bit Floating Point
typedef qreal
DOUBLE
64-bit Floating Point
Mapped to
QStringfor high precision doubles, otherwise qrealCHAR
Character string
Mapped to
QStringVARCHAR
Character string
Mapped to
QStringTINYTEXT
Character string
Mapped to
QStringTEXT
Character string
Mapped to
QStringMEDIUMTEXT
Character string
Mapped to
QStringLONGTEXT
Character string
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringall BLOB types
BLOB
Mapped to
QByteArrayDATE
Date without Time
Mapped to
QDateDATETIME
Date and Time
Mapped to
QDateTimeTIMESTAMP
Date and Time
Mapped to
QDateTimeTIME
Time
Mapped to
QTimeYEAR
Year (int)
Mapped to
QDateTimeENUM
Enumeration of Value Set
Mapped to
QString
Oracle Call Interface Data Types#
Oracle Call Interface data type
SQL type description
Recommended input (C++ or Qt data type)
NUMBER
FLOAT, DOUBLE, PRECISIONc REAL
Mapped to
QStringfor high precision doubles, otherwise qrealNUMBER(38)
INTEGER INT SMALLINT
typedef qint8/16/32/64
NUMBER(p,s)
NUMERIC(p,s) DECIMAL(p,s)a
By default mapping to
QStringNVARCHAR2(n)
Character string (NATIONAL CHARACTER VARYING(n) NATIONAL CHAR VARYING(n) NCHAR VARYING(n))
Mapped to
QStringNCHAR(n)
Character string (NATIONAL CHARACTER(n) NATIONAL CHAR(n) NCHAR(n))
Mapped to
QStringCHAR(n)
Character string (CHARACTER(n) CHAR(n))
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringBLOB
A binary large object
Mapped to
QByteArrayTIMESTAMP
Year, month, and day values of date, as well as hour, minute, and second values of time
Mapped to
QDateTime
ODBC Data Types#
ODBC data type
SQL type description
Recommended input (C++ or Qt data type)
BIT
Boolean
BOOL
TINYINT
8 bit integer
typedef qint8
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
FLOAT
64-bit Double floating point
typedef qreal
DOUBLE
64-bit Double floating point
Mapped to
QStringfor high precision doubles, otherwise qrealCHAR
Character string
Mapped to
QStringVARCHAR
Character string
Mapped to
QStringLONGVARCHAR
Character string
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringDATE
Character string
Mapped to
QDateTIME
Character Time, Character string
Mapped to
QTimeTIMESTAMP
Character Time, Character string
Mapped to
QDateTime
PostgreSQL Data Types#
PostgreSQL data type
SQL type description
Recommended input (C++ or Qt data type)
BOOLEAN
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
QStringfor high precision doubles, otherwise qrealDECIMAL VARIABLE
user-specified precision, exact
typedef qreal
NUMERIC VARIABLE
user-specified precision, exact
typedef qreal
VARCHAR
variable-length character string
Mapped to
QStringCHARACTER
Character string of fixed-length
Mapped to
QStringTEXT
Character string of variable-length
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringTIMESTAMP
8 bytes, both date and time
Mapped to
QDateTimeTIMESTAMP
8 bytes, both date and time, with time zone
Mapped to
QDateTimeDATE
4 bytes, dates only
Mapped to
QDateTIME
8 bytes, times of day only 00:00:00.00 - 23:59:59.99
Mapped to
QTimeTIME
12 bytes times of day only, with time zone 00:00:00.00+12
Mapped to
QDateTime
QSQLITE SQLite version 3 Data Types#
QSQLITE SQLite version 3 data type
SQL type description
Recommended input (C++ or Qt data type)
NULL
NULL value.
NULL
INTEGER
Signed integer, stored in 8, 16, 24, 32, 48, or 64-bits depending on the magnitude of the value.
typedef qint8/16/32/64
REAL
64-bit floating point value.
typedef qreal
TEXT
Character string (UTF-8, UTF-16BE or UTF-16-LE).
Mapped to
QStringCLOB
Character large string object
Mapped to
QStringBLOB
The value is a BLOB of data, stored exactly as it was input.
Mapped to
QByteArray