Sur cette page

Types de données pour les systèmes de bases de données supportés par Qt

Ce tableau présente les types de données recommandés pour extraire des données des bases de données prises en charge par Qt. Par exemple, un double peut parfaitement fonctionner comme entrée pour les enregistrements en virgule flottante dans une base de données particulière, mais pas nécessairement comme format de stockage pour la sortie de cette base de données, car il serait stocké avec une précision de 64 bits en C++.

Types de données IBM DB2

Type de données IBM DB2Description du type SQLEntrée recommandée (type de données C++ ou Qt)
SMALLINTEntier signé de 16 bitstypedef qint16
INTEGEREntier signé 32 bitstypedef qint32
BIGINTEntier signé de 64 bitstypedef qint64
REALVirgule flottante 32 bits à simple précisiontypedef qreal
DOUBLE PRÉCISION64-bit Double précision en virgule flottanteCorrespond à QString pour les doubles de haute précision, sinon qreal
FLOATVirgule flottante de 64 bits à double précisiontypedef qreal
CHARChaîne de caractères de longueur fixe à terminaison nulleMappé sur QString
VARCHARChaîne de caractères de longueur variable à terminaison nulleAssocié à QString
LONG VARCHARChaîne de caractères de longueur variable à terminaison non nulleCorrespond à QString
BLOBChaîne binaire de longueur variable à terminaison non nulle avec indicateur de longueur de chaîne de 4 octetsMappé sur QByteArray
CLOBObjet de type chaîne de caractères de grande tailleCorrespondant à QString
DATEChaîne de caractères à terminaison nulle au format suivant : aaaa-mm-jjAssocié à QDate
TIMEChaîne de caractères à terminaison nulle au format suivant : hh.mm.ssAssocié à QTime
TIMESTAMPChaîne de caractères à terminaison nulle au format suivant : yyyy-mm-dd-hh.mm.ss.nnnnnnAssocié à QDateTime

Types de données Borland InterBase

Type de données Borland InterBaseDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
BOOLEANBooléenbool
TINYINTEntier signé 8 bitstypedef qint8
SMALLINTEntier signé de 16 bitstypedef qint16
INTEGEREntier signé 32 bitstypedef qint32
BIGINT LONGEntier signé de 64 bitstypedef qint64
REAL FLOATVirgule flottante 32 bitstypedef qreal
FLOATvirgule flottante 64 bitstypedef qreal
DOUBLEvirgule flottante 64 bitstypedef qreal
DOUBLE PRÉCISIONVirgule flottante double précision 64 bitsCorrespond à QString pour les doubles de haute précision, sinon qreal
VARCHAR STRINGChaîne de caractères, UnicodeCorrespond à QString
CLOBCharacter large string object (objet chaîne de caractères de grande taille)Associé à QString
DATEAffiche la date. Format : 'aaaa-mm-jj'Associé à QDate
HEUREAffiche l'heure. Le format est 'hh:mm:ss' au format 24 heures.Associé à QTime
TIMESTAMPAffiche un horodatage. Le format est "aaaa-mm-jj hh:mm:ss".Associé à QDateTime

Types de données MySQL

Type de données MySQLDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
TINYINTEntier signé de 8 bitstypedef qint8
TINYINT UNSIGNEDEntier non signé 8 bitstypedef quint8
SMALLINTEntier signé 16 bitstypedef qint16
SMALLINT UNSIGNEDEntier non signé 16 bitstypedef quint16
INTEntier signé 32 bitstypedef qint32
INT UNSIGNEDentier non signé 32 bitstypedef quint32
BIGINTEntier signé de 64 bitstypedef qint64
FLOATVirgule flottante 32 bitstypedef qreal
DOUBLEVirgule flottante 64 bitsCorrespond à QString pour les doubles de haute précision, sinon qreal
CHARChaîne de caractèresCorrespond à QString
VARCHARChaîne de caractèresCorrespondant à QString
TINYTEXTChaîne de caractèresCorrespondant à QString
TEXTEChaîne de caractèresCorrespondant à QString
MEDIUMTEXTChaîne de caractèresCorrespondant à QString
LONGTEXTChaîne de caractèresCorrespondant à QString
CLOBObjet de type chaîne de caractères de grande tailleAssocié à QString
tous les types de BLOBBLOBCorrespond à QByteArray
DATEDate sans heureAssocié à QDate
DATETIMEDate et heureAssocié à QDateTime
TIMESTAMPDate et heureAssocié à QDateTime
TIMEHeureCorrespondant à QTime
ANNÉEAnnée (int)Associé à QDateTime
ENUMEnumération d'un ensemble de valeursAssocié à QString

Types de données de l'interface d'appel Oracle

Type de données de l'interface d'appel OracleDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
NOMBREFLOAT, DOUBLE, PRECISIONc REALMappé sur QString pour les doubles de haute précision, sinon qreal
NUMÉRO(38)INTEGER INT SMALLINTtypedef qint8/16/32/64
NUMÉRO(p,s)NUMERIC(p,s) DECIMAL(p,s)aMappé sur QString
NVARCHAR2(n)Chaîne de caractères (NATIONAL CHARACTER VARYING(n) NATIONAL CHAR VARYING(n) NCHAR VARYING(n))Correspond à 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))Correspondant à QString
CLOBObjet chaîne de caractères de grande tailleCorrespondant à QString
BLOBObjet binaire de grande tailleCorrespondant à QByteArray
TIMESTAMPLes valeurs de l'année, du mois et du jour de la date, ainsi que les valeurs de l'heure, de la minute et de la seconde du tempsAssocié à QDateTime

Types de données ODBC

Type de données ODBCDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
BITBooléenBOOL
TINYINTEntier à 8 bitstypedef qint8
SMALLINTEntier signé de 16 bitstypedef qint16
INTEGEREntier signé 32 bitstypedef qint32
BIGINTEntier signé de 64 bitstypedef qint64
REALVirgule flottante 32 bits à simple précisiontypedef qreal
FLOAT64 bits Double virgule flottantetypedef qreal
DOUBLEDouble 64 bits à virgule flottanteCorrespond à QString pour les doubles de haute précision, sinon qreal
CHARChaîne de caractèresCorrespond à QString
VARCHARChaîne de caractèresCorrespondant à QString
LONGVARCHARChaîne de caractèresCorrespondant à QString
CLOBObjet de type chaîne de caractères de grande tailleAssocié à QString
DATEChaîne de caractèresAssocié à QDate
TIMECharacter Time, Chaîne de caractèresAssocié à QTime
TIMESTAMPCaractère Time, Chaîne de caractèresAssocié à QDateTime

Types de données PostgreSQL

Type de données PostgreSQLDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
BOOLEANBooléenbool
SMALLINTEntier signé de 16 bitstypedef qint16
INTEGEREntier signé 32 bitstypedef qint32
BIGINTEntier signé de 64 bitstypedef qint64
REALVirgule flottante 32 bits à précision variabletypedef qreal
DOUBLE PRÉCISIONvirgule flottante de 64 bits à précision variableCorrespond à QString pour les doubles de haute précision, sinon qreal
VARIABLE DÉCIMALEprécision spécifiée par l'utilisateur, exactetypedef qreal
VARIABLE NUMÉRIQUEprécision spécifiée par l'utilisateur, exactetypedef qreal
VARCHARchaîne de caractères de longueur variableCorrespond à QString
CHARACTERChaîne de caractères de longueur fixeMappé sur QString
TEXTEChaîne de caractères de longueur variableCorrespondant à QString
CLOBObjet de type chaîne de caractères de grande tailleAssocié à QString
TIMESTAMP8 octets, à la fois la date et l'heureAssocié à QDateTime
TIMESTAMP8 octets, date et heure, avec fuseau horaireCorrespondant à QDateTime
DATE4 octets, dates uniquementAssocié à QDate
HEURE8 octets, heures du jour uniquement 00:00:00.00 - 23:59:59.99Associé à QTime
TIME12 octets, heures du jour uniquement, avec fuseau horaire 00:00:00.00+12Associé à QDateTime

Types de données de QSQLITE SQLite version 3

Types de données de QSQLITE SQLite version 3Description du type SQLEntrée recommandée (type de données C++ ou Qt)
NULLValeur NULL.NULL
INTEGEREntier signé, stocké sur 8, 16, 24, 32, 48 ou 64 bits en fonction de l'ampleur de la valeur.typedef qint8/16/32/64
REALValeur à virgule flottante de 64 bits.typedef qreal
TEXTChaîne de caractères (UTF-8, UTF-16BE ou UTF-16-LE).Correspond à QString
CLOBObjet chaîne de caractères de grande tailleAssocié à QString
BLOBLa valeur est un BLOB de données, stocké exactement comme il a été saisi.Mappé sur QByteArray

Types de données Mimer SQL

Type SQL de MimerDescription du type SQLEntrée recommandée (type de données C++ ou Qt)
SMALLINTEntier signé de 16 bitstypedef qint16
INTEGEREntier signé 32 bitstypedef qint32
INTEGER(n)Entier avec une précision maximale de 45 chiffresCorrespond à QString
BIGINTEntier signé de 64 bitstypedef qint64
REALVirgule flottante IEEE 32 bits à simple précisiontypedef float
DOUBLE PRÉCISION64-bit Double-précision IEEE à virgule flottanteCorrespond à QString pour les doubles de haute précision, sinon qreal
FLOAT64-bit Double-précision IEEE à virgule flottanteCorrespond à QString pour les doubles de haute précision, sinon qreal
FLOAT(n)Virgule flottante avec une précision maximale de 45 chiffresCorrespond à QString
DECIMAL(p,s)Décimal avec une précision maximale de 45 chiffres et une échelleCorrespondant à QString
CHARChaîne de caractères Latin-1 de longueur fixe (CHAR ou caractère)Associé à QString
VARCHARChaîne de caractères Latin-1 de longueur variable (VARCHAR ou CHARACTER VARYING)Associé à QString
NCHARChaîne Unicode de longueur fixe (NCHAR ou NATIONAL CHARACTER)Associé à QString
NVARCHARChaîne Unicode de longueur variable (NVARCHAR ou NATIONAL CHARACTER VARYING)Associé à QString
BINARYDonnées binaires de longueur fixeCorrespondant à QByteArray
VARBINARYDonnées binaires de longueur variable (VARBINARY ou BINARY VARYING)Mises en correspondance avec des QByteArray
BLOBGrand objet binaire (BLOB ou BINARY LARGE OBJECT)Mappé sur QByteArray
CLOBGrand objet en caractères latins-1 (CLOB ou CHARACTER LARGE OBJECT)Mappé sur QString
NCLOBGrand objet de caractère Unicode (NCLOB ou NATIONAL CHARACTER LARGE OBJECT)Associé à QString
DATEDate composée de l'année, du mois et du jourCorrespondant à QDate
HEUREHeure composée des heures, minutes, secondes avec, en option, des fractions de secondesAssocié à QTime
TIMESTAMPDate et heure avec des fractions de secondes optionnellesAssocié à QDateTime
BUILTIN.UUIDIdentifiant unique universelAssocié à QUuid
BOOLEANBooléenbool
INTERVALLE ANNÉE(7)Année, format '±yyyyyyyy' (précision maximale)Associé à QString
INTERVALLE YEAR(7) TO MONTHAnnée au mois, format '±yyyyyyy-mm' (précision maximale)Associé à QString
INTERVALLE MOIS(7)Mois, format '±mmmmmmm' (précision maximale)Associé à QString
INTERVALLE JOUR(7)Jour, format '±ddddddd' (précision maximale)Associé à QString
INTERVALLE JOUR(7) À HEUREDu jour à l'heure, format '±ddddd hh' (précision maximale)Associé à l'intervalle QString
INTERVALLE JOUR(7) À MINUTEDu jour à la minute, format '±ddddd hh:mm' (précision maximale)Associé à QString
INTERVALLE JOUR(7) À SECONDE(9)Du jour à la seconde, format "±ddddd hh:mm:ss[.fffffffff]" (précision maximale)Associé à QString
INTERVALLE HEURE(8)Heure, format '±hhhhhh' (précision maximale)Associé à QString
INTERVALLE HEURE(8) VERS MINUTEHeure à minute, format '±hhhhhhh:mm' (précision maximale)Associé à l'intervalle QString
INTERVALLE HEURE(8) VERS SECONDE(9)De l'heure à la seconde, format '±hhhhhhh:mm:ss[.fffffffff]' (précision maximale)Associé à QString
INTERVALLE MINUTE(10)Minute, format '±mmmmmmmm' (précision maximale)Associé à QString
INTERVALLE MINUTE(10) À SECONDE(9)De minute à seconde, format '±mmmmmmmm:ss[.fffffffff]' (précision maximale)Associé à QString
INTERVALLE SECOND(12,9)Seconde, format '±ssssssssss[.fffffffff]' (précision maximale)Associé à 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.