Types de données pour les systèmes de bases de données pris en charge par Qt
Types de données recommandés pour les systèmes de bases de données pris en charge par Qt
Ce tableau présente les types de données recommandés pour l'extraction de données à partir des bases de données prises en charge par Qt. Notez que les types utilisés dans Qt ne sont pas nécessairement valides en tant que types d'entrée pour un système de base de données spécifique. Par exemple, un type « double » peut parfaitement convenir comme entrée pour des enregistrements à virgule flottante dans une base de données donnée, mais pas nécessairement comme format de stockage pour les données issues de cette base, car il serait stocké avec une précision de 64 bits en C++.
Types de données IBM DB2
| Type de données IBM DB2 | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| SMALLINT | Entier signé de 16 bits | typedef qint16 |
| INTEGER | Entier signé de 32 bits | typedef qint32 |
| BIGINT | Entier signé de 64 bits | typedef qint64 |
| REAL | Nombre à virgule flottante simple précision de 32 bits | typedef qreal |
| DOUBLE PRÉCISION | Nombre à virgule flottante double précision 64 bits | Mappé sur QString pour les doubles haute précision, sinon qreal |
| FLOAT | Nombre à virgule flottante en double précision sur 64 bits | typedef qreal |
| CHAR | Chaîne de caractères de longueur fixe, terminée par un caractère nul | Mappé vers QString |
| VARCHAR | Chaîne de longueur variable terminée par un caractère nul | Correspond à QString |
| LONG VARCHAR | Chaîne de caractères de longueur variable non terminée par un caractère nul | Correspond à QString |
| BLOB | Chaîne binaire de longueur variable non terminée par un caractère nul, avec un indicateur de longueur de chaîne de 4 octets | Correspond à QByteArray |
| CLOB | Objet de chaîne de caractères de grande taille | Correspond à QString |
| DATE | Chaîne de caractères terminée par un caractère nul, au format suivant : aaaa-mm-jj | Correspond à QDate |
| TIME | Chaîne de caractères terminée par un caractère nul, au format suivant : hh.mm.ss | Correspond à QTime |
| TIMESTAMP | Chaîne de caractères terminée par un caractère nul, au format suivant : aaaa-mm-jj-hh.mm.ss.nnnnnn | Correspond à QDateTime |
Types de données Borland InterBase
| Type de données Borland InterBase | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| BOOLEAN | Booléen | bool |
| TINYINT | Entier signé de 8 bits | typedef qint8 |
| SMALLINT | Entier signé de 16 bits | typedef qint16 |
| INTEGER | Entier signé de 32 bits | typedef qint32 |
| BIGINT LONG | Entier signé de 64 bits | typedef qint64 |
| REAL FLOAT | Nombre à virgule flottante de 32 bits | typedef qreal |
| FLOAT | Nombre à virgule flottante 64 bits | typedef qreal |
| DOUBLE | Nombre à virgule flottante 64 bits | typedef qreal |
| DOUBLE PRÉCISION | Nombre à virgule flottante double précision 64 bits | Mappé sur QString pour les doubles haute précision, sinon qreal |
| CHAÎNE VARCHAR | Chaîne de caractères, Unicode | Mappé vers QString |
| CLOB | Objet de chaîne de caractères de grande taille | Correspond à QString |
| DATE | Affiche la date. Format : « aaaa-mm-jj » | Correspond à QDate |
| TIME | Affiche l'heure. Le format est « hh:mm:ss » au format 24 heures | Correspond à QTime |
| TIMESTAMP | Affiche un horodatage. Le format est « aaaa-mm-jj hh:mm:ss » | Correspond à QDateTime |
Types de données MySQL
| Type de données MySQL | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| TINYINT | Entier signé de 8 bits | typedef qint8 |
| TINYINT SANS SIGNE | Entier non signé de 8 bits | typedef quint8 |
| SMALLINT | Entier signé de 16 bits | typedef qint16 |
| SMALLINT NON SIGNÉ | Entier non signé de 16 bits | typedef quint16 |
| INT | Entier signé de 32 bits | typedef qint32 |
| INT NON SIGNÉ | Entier non signé de 32 bits | typedef quint32 |
| BIGINT | Entier signé de 64 bits | typedef qint64 |
| FLOAT | Nombre à virgule flottante 32 bits | typedef qreal |
| DOUBLE | Nombre à virgule flottante 64 bits | Mappé sur ` QString ` pour les doubles haute précision, sinon `qreal` |
| CHAR | Chaîne de caractères | Mappé sur QString |
| VARCHAR | Chaîne de caractères | Correspond à QString |
| TINYTEXT | Chaîne de caractères | Correspond à QString |
| TEXT | Chaîne de caractères | Correspond à QString |
| MEDIUMTEXT | Chaîne de caractères | Mappé vers QString |
| LONGTEXT | Chaîne de caractères | Mappé à QString |
| CLOB | Objet de chaîne de caractères de grande taille | Mappé vers QString |
| tous les types BLOB | BLOB | Correspond à QByteArray |
| DATE | Date sans heure | Correspond à QDate |
| DATETIME | Date et heure | Correspond à QDateTime |
| TIMESTAMP | Date et heure | Correspond à QDateTime |
| TIME | Heure | Correspond à QTime |
| ANNÉE | Année (entier) | Correspond à QDateTime |
| ENUM | Énumération d'un ensemble de valeurs | Correspond à QString |
Types de données de l'interface d'appel Oracle
| Type de données de l'interface d'appel Oracle | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| NUMBER | FLOAT, DOUBLE, PRECISIONc REAL | Mappé sur QString pour les doubles haute précision, sinon qreal |
| NUMBER(38) | INTEGER INT SMALLINT | typedef qint8/16/32/64 |
| NUMBER(p,s) | NUMERIC(p,s) DECIMAL(p,s)a | Correspond à QString |
| NVARCHAR2(n) | Chaîne de caractères (NATIONAL CHARACTER VARYING(n) NATIONAL CHAR VARYING(n) NCHAR VARYING(n)) | Mappé vers QString |
| NCHAR(n) | Chaîne de caractères (NATIONAL CHARACTER(n) NATIONAL CHAR(n) NCHAR(n)) | Correspond à QString |
| CHAR(n) | Chaîne de caractères (CHARACTER(n) CHAR(n)) | Correspond à QString |
| CLOB | Objet de chaîne de caractères de grande taille | Correspond à QString |
| BLOB | Objet binaire de grande taille | Correspond à QByteArray |
| TIMESTAMP | Valeurs de l'année, du mois et du jour de la date, ainsi que les valeurs de l'heure, des minutes et des secondes de l'heure | Correspond à QDateTime |
Types de données ODBC
| Type de données ODBC | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| BIT | Booléen | BOOL |
| TINYINT | Entier de 8 bits | typedef qint8 |
| SMALLINT | Entier signé de 16 bits | typedef qint16 |
| INTEGER | Entier signé de 32 bits | typedef qint32 |
| BIGINT | Entier signé de 64 bits | typedef qint64 |
| REAL | Nombre à virgule flottante simple précision de 32 bits | typedef qreal |
| FLOAT | Nombre à virgule flottante double de 64 bits | typedef qreal |
| DOUBLE | Nombre à virgule flottante double de 64 bits | Mappé sur QString pour les doubles haute précision, sinon qreal |
| CHAR | Chaîne de caractères | Correspond à QString |
| VARCHAR | Chaîne de caractères | Correspond à QString |
| LONGVARCHAR | Chaîne de caractères | Correspond à QString |
| CLOB | Objet de chaîne de caractères de grande taille | Mappé vers QString |
| DATE | Chaîne de caractères | Correspond à QDate |
| TIME | Caractère Heure, chaîne de caractères | Correspond à QTime |
| TIMESTAMP | Heure sous forme de caractères, chaîne de caractères | Mappé vers QDateTime |
Types de données PostgreSQL
| Type de données PostgreSQL | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| BOOLEAN | Booléen | bool |
| SMALLINT | Entier signé de 16 bits | typedef qint16 |
| INTEGER | Entier signé de 32 bits | typedef qint32 |
| BIGINT | Entier signé de 64 bits | typedef qint64 |
| REAL | Nombre à virgule flottante à précision variable de 32 bits | typedef qreal |
| DOUBLE PRÉCISION | Nombre à virgule flottante à précision variable de 64 bits | Mappé sur ` QString ` pour les doubles haute précision, sinon `qreal` |
| VARIABLE DÉCIMALE | précision définie par l'utilisateur, exacte | typedef qreal |
| VARIABLE NUMÉRIQUE | précision définie par l'utilisateur, exacte | typedef qreal |
| VARCHAR | chaîne de caractères de longueur variable | Mappée à QString |
| CHARACTER | Chaîne de caractères de longueur fixe | Mappé vers QString |
| TEXT | Chaîne de caractères de longueur variable | Mappée vers QString |
| CLOB | Objet de chaîne de caractères de grande taille | Mappé vers QString |
| TIMESTAMP | 8 octets, date et heure | Correspond à QDateTime |
| TIMESTAMP | 8 octets, date et heure, avec fuseau horaire | Correspond à QDateTime |
| DATE | 4 octets, date uniquement | Correspond à QDate |
| TIME | 8 octets, heures de la journée uniquement 00:00:00.00 - 23:59:59.99 | Correspond à QTime |
| TIME | 12 octets, heure du jour uniquement, avec fuseau horaire 00:00:00.00+12 | Correspond à QDateTime |
QSQLITE : types de données SQLite version 3
| Type de données QSQLITE (SQLite version 3) | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| NULL | Valeur NULL. | NULL |
| INTEGER | Entier signé, stocké sur 8, 16, 24, 32, 48 ou 64 bits selon la magnitude de la valeur. | typedef qint8/16/32/64 |
| REAL | Valeur à virgule flottante sur 64 bits. | typedef qreal |
| TEXT | Chaîne de caractères (UTF-8, UTF-16BE ou UTF-16-LE). | Mappée à QString |
| CLOB | Objet de chaîne de caractères de grande taille | Mappé vers QString |
| BLOB | La valeur est un BLOB de données, stocké exactement tel qu’il a été saisi. | Correspond à QByteArray |
Types de données Mimer SQL
| Type Mimer SQL | Description du type SQL | Entrée recommandée (type de données C++ ou Qt) |
|---|---|---|
| SMALLINT | Entier signé sur 16 bits | typedef qint16 |
| INTEGER | Entier signé de 32 bits | typedef qint32 |
| INTEGER(n) | Entier avec une précision pouvant aller jusqu'à 45 chiffres | Correspond à QString |
| BIGINT | Entier signé de 64 bits | typedef qint64 |
| REAL | Nombre à virgule flottante IEEE simple précision 32 bits | typedef float |
| DOUBLE PRÉCISION | Nombre à virgule flottante IEEE à double précision 64 bits | Mappé sur QString pour les doubles haute précision, sinon qreal |
| FLOAT | Nombre à virgule flottante IEEE double précision 64 bits | Mappé sur QString pour les doubles haute précision, sinon qreal |
| FLOAT(n) | Nombre à virgule flottante avec une précision pouvant atteindre 45 chiffres | Correspond à QString |
| DECIMAL(p,s) | Nombre décimal avec une précision et une échelle pouvant atteindre 45 chiffres | Correspond à QString |
| CHAR | Chaîne de caractères Latin-1 de longueur fixe (CHAR ou caractère) | Mappé vers QString |
| VARCHAR | Chaîne Latin-1 de longueur variable (VARCHAR ou CHARACTER VARYING) | Correspond à QString |
| NCHAR | Chaîne Unicode de longueur fixe (NCHAR ou NATIONAL CHARACTER) | Mappé vers QString |
| NVARCHAR | Chaîne Unicode à longueur variable (NVARCHAR ou NATIONAL CHARACTER VARYING) | Correspond à QString |
| BINARY | Données binaires de longueur fixe | Mappé vers QByteArray |
| VARBINARY | Données binaires à longueur variable (VARBINARY ou BINARY VARYING) | Correspond à QByteArray |
| BLOB | Objet binaire de grande taille (BLOB ou BINARY LARGE OBJECT) | Correspond à QByteArray |
| CLOB | Objet de grande taille de type caractère Latin-1 (CLOB ou CHARACTER LARGE OBJECT) | Correspond à QString |
| NCLOB | Objet de type caractère Unicode de grande taille (NCLOB ou NATIONAL CHARACTER LARGE OBJECT) | Correspond à QString |
| DATE | Date composée de l'année, du mois et du jour | Correspond à QDate |
| TIME | Heure composée d'heures, de minutes et de secondes, avec des fractions de seconde facultatives | Correspond à QTime |
| TIMESTAMP | Date et heure avec fractions de seconde facultatives | Correspond à QDateTime |
| BUILTIN.UUID | Identifiant unique universel | Correspond à QUuid |
| BOOLEAN | Booléen | bool |
| INTERVAL YEAR(7) | Année, format « ±yyyyyyy » (précision maximale) | Mappé vers QString |
| INTERVAL YEAR(7) TO MONTH | De l'année au mois, format « ±yyyyyyy-mm » (précision maximale) | Converti en QString |
| INTERVAL MONTH(7) | Mois, format « ±mmmmmmm » (précision maximale) | Correspond à QString |
| INTERVAL DAY(7) | Jour, format « ±ddddddd » (précision maximale) | Correspond à QString |
| INTERVAL DAY(7) TO HOUR | Jour en heure, format « ±ddddddd hh » (précision maximale) | Converti en QString |
| INTERVAL DAY(7) TO MINUTE | Jour en minute, format « ±ddddddd hh:mm » (précision maximale) | Correspond à QString |
| INTERVAL DAY(7) TO SECOND(9) | Du jour à la seconde, format « ±ddddddd hh:mm:ss[.fffffffff] » (précision maximale) | Correspond à QString |
| INTERVAL HOUR(8) | Heure, format « ±hhhhhhhh » (précision maximale) | Correspond à QString |
| INTERVAL HOUR(8) TO MINUTE | De l'heure à la minute, format « ±hhhhhhhh:mm » (précision maximale) | Converti en QString |
| INTERVAL HOUR(8) TO SECOND(9) | De l'heure à la seconde, format « ±hhhhhhhh:mm:ss[.fffffffff] » (précision maximale) | Correspond à QString |
| INTERVAL MINUTE(10) | Minute, format « ±mmmmmmmmmm » (précision maximale) | Correspond à QString |
| INTERVAL MINUTE(10) TO SECOND(9) | De la minute à la seconde, format « ±mmmmmmmmmm:ss[.fffffffff] » (précision maximale) | Converti en QString |
| INTERVAL SECOND(12,9) | Seconde, format « ±ssssssssssss[.fffffffff] » (précision maximale) | Correspond à QString |
© 2026 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.