Data Types for Qt-supported Database Systems
支持Qt的数据库系统的数据类型
Recommended Data Types for Qt-Supported Database Systems
Qt支持的数据库系统的推荐数据类型
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++.
此表显示了用于从Qt中支持的数据库中提取数据的推荐数据类型。请注意,Qt中使用的类型不一定作为特定数据库系统的输入类型有效。例如,double可能完美地用作特定数据库中浮点记录的输入,但不一定作为该数据库输出的存储格式,因为它将以64位精度存储在C++中。
IBM DB2 Data Types
IBM DB2数据类型
IBM DB2 data type IBM DB2数据类型 | SQL type description SQL类型描述 | Recommended input (C++ or Qt data type) 建议输入(C++或Qt数据类型) |
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 |
Borland InterBase Data Types
Borland InterBase数据类型
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 QString for high precision doubles, otherwise qreal |
VARCHAR STRING | Character string, Unicode | Mapped to QString |
CLOB | Character large string object | Mapped to QString |
DATE | Displays date. Format: 'yyyy-mm-dd' | Mapped to QDate |
TIME | Displays time. Format is 'hh:mm:ss' in 24-hour format | Mapped to QTime |
TIMESTAMP | Displays a timestamp. Format is 'yyyy-mm-dd hh:mm:ss' | Mapped to QDateTime |
MySQL Data Types
MySQL数据类型
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 QString for high precision doubles, otherwise qreal |
CHAR | Character string | Mapped to QString |
VARCHAR | Character string | Mapped to QString |
TINYTEXT | Character string | Mapped to QString |
TEXT | Character string | Mapped to QString |
MEDIUMTEXT | Character string | Mapped to QString |
LONGTEXT | Character string | Mapped to QString |
CLOB | Character large string object | Mapped to QString |
all BLOB types | BLOB | Mapped to QByteArray |
DATE | Date without Time | Mapped to QDate |
DATETIME | Date and Time | Mapped to QDateTime |
TIMESTAMP | Date and Time | Mapped to QDateTime |
TIME | Time | Mapped to QTime |
YEAR | Year (int) | Mapped to QDateTime |
ENUM | Enumeration of Value Set | Mapped to QString |
Oracle Call Interface Data Types
Oracle调用接口数据类型
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 | By default mapping 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 |
ODBC Data Types
ODBC数据类型
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 QString for high precision doubles, otherwise qreal |
CHAR | Character string | Mapped to QString |
VARCHAR | Character string | Mapped to QString |
LONGVARCHAR | Character string | Mapped to QString |
CLOB | Character large string object | Mapped to QString |
DATE | Character string | Mapped to QDate |
TIME | Character Time, Character string | Mapped to QTime |
TIMESTAMP | Character Time, Character string | Mapped to QDateTime |
PostgreSQL Data Types
PostgreSQL数据类型
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 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 |
QSQLITE SQLite version 3 Data Types
QSQLITE SQLite版本3数据类型
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. 有符号整数,存储在8、16、24、32、48或64位中,具体取决于值的大小。 | typedef qint8/16/32/64 |
REAL | 64-bit floating point value. 64位浮点值。 | typedef qreal |
TEXT | Character string (UTF-8, UTF-16BE or UTF-16-LE). 通用行字符串(UTF-8、UTF-16BE或UTF-16-LE)。 | Mapped to QString |
CLOB | Character large string object 字符大字符串对象 | Mapped to QString |
BLOB | The value is a BLOB of data, stored exactly as it was input. 该值是一个BLOB数据,完全按照输入时的方式存储。 | Mapped to QByteArray |
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.