Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Recommended Use of Data Types in Databases

Recommended Use of Types in Qt Supported Databases

This table shows the recommended data types used when extracting data from the databases supported in Qt. It is important to note that the types used in Qt are not necessarily valid as input to the specific database. One example could be that a double would work perfectly as input for floating point records in a database, but not necessarily as a storage format for output from the database since it would be stored with 64-bit precision in C++.

IBM DB2 Data Types

IBM DB2 data typeSQL type descriptionRecommended input (C++ or Qt data type)
SMALLINT16-bit signed integertypedef qint16
INTEGER32-bit signed integertypedef qint32
BIGINT64-bit signed integertypedef qint64
REAL32-bit Single-precision floating pointBy default mapping to QString
DOUBLE PRECISION64-bit Double-precision floating pointBy default mapping to QString
FLOAT64-bit Double-precision floating pointBy default mapping to QString
CHARFixed-length, null-terminated character stringMapped to QString
VARCHARNull-terminated varying length stringMapped to QString
LONG VARCHARNot null-terminated varying length character stringMapped to QString
BLOBNot null-terminated varying binary string with 4-byte string length indicatorMapped to QByteArray
CLOBCharacter large string objectMapped to QString
DATENull-terminated character string of the following format: yyyy-mm-ddMapped to QDate
TIMENull-terminated character string of the following format: hh.mm.ssMapped to QTime
TIMESTAMPNull-terminated character string of the following format: yyyy-mm-dd-hh.mm.ss.nnnnnnMapped to QDateTime

Borland InterBase Data Types

Borland InterBase data typeSQL type descriptionRecommended input (C++ or Qt data type)
BOOLEANBooleanbool
TINYINT8 bit signed integertypedef qint8
SMALLINT16-bit signed integertypedef qint16
INTEGER32-bit signed integertypedef qint32
BIGINT LONG64-bit signed integertypedef qint64
REAL FLOAT32-bit floating pointBy default mapping to QString
FLOAT64-bit floating pointBy default mapping to QString
DOUBLE64-bit floating pointBy default mapping to QString
DOUBLE PRECISION64-bit Double-precision floating pointBy default mapping to QString
VARCHAR STRINGCharacter string, UnicodeMapped to QString
CLOBCharacter large string objectMapped to QString
DATEDisplays date. Format: 'yyyy-mm-dd'Mapped to QDate
TIMEDisplays time. Format is 'hh:mm:ss' in 24-hour formatMapped to QTime
TIMESTAMPDisplays a timestamp. Format is 'yyyy-mm-dd hh:mm:ss'Mapped to QDateTime

MySQL Data Types

MySQL data typeSQL type descriptionRecommended input (C++ or Qt data type)
TINYINT8 bit signed integertypedef qint8
TINYINT UNSIGNED8 bit unsigned integertypedef quint8
SMALLINT16-bit signed integertypedef qint16
SMALLINT UNSIGNED16-bit unsigned integertypedef quint16
INT32-bit signed integertypedef qint32
INT UNSIGNED32-bit unsigned integertypedef quint32
BIGINT64-bit signed integertypedef qint64
FLOAT32-bit Floating PointBy default mapping to QString
DOUBLE64-bit Floating PointBy default mapping to QString
CHARCharacter stringMapped to QString
VARCHARCharacter stringMapped to QString
TINYTEXTCharacter stringMapped to QString
TEXTCharacter stringMapped to QString
MEDIUMTEXTCharacter stringMapped to QString
LONGTEXTCharacter stringMapped to QString
CLOBCharacter large string objectMapped to QString
all BLOB typesBLOBMapped to QByteArray
DATEDate without TimeMapped to QDate
DATETIMEDate and TimeMapped to QDateTime
TIMESTAMPDate and TimeMapped to QDateTime
TIMETimeMapped to QTime
YEARYear (int)Mapped to QDateTime
ENUMEnumeration of Value SetMapped to QString

Oracle Call Interface Data Types

Oracle Call Interface data typeSQL type descriptionRecommended input (C++ or Qt data type)
NUMBERFLOAT, DOUBLE, PRECISIONc REALBy default mapping to QString
NUMBER(38)INTEGER INT SMALLINTtypedef qint8/16/32/64
NUMBER(p,s)NUMERIC(p,s) DECIMAL(p,s)aBy 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
CLOBCharacter large string objectMapped to QString
BLOBA binary large objectMapped to QByteArray
TIMESTAMPYear, month, and day values of date, as well as hour, minute, and second values of timeMapped to QDateTime

ODBC Data Types

ODBC data typeSQL type descriptionRecommended input (C++ or Qt data type)
BITBooleanBOOL
TINYINT8 bit integertypedef qint8
SMALLINT16-bit signed integertypedef qint16
INTEGER32-bit signed integertypedef qint32
BIGINT64-bit signed integertypedef qint64
REAL32-bit Single-precision floating pointBy default mapping to QString
FLOAT64-bit Double floating pointBy default mapping to QString
DOUBLE64-bit Double floating pointBy default mapping to QString
CHARCharacter stringMapped to QString
VARCHARCharacter stringMapped to QString
LONGVARCHARCharacter stringMapped to QString
CLOBCharacter large string objectMapped to QString
DATECharacter stringMapped to QDate
TIMECharacter Time, Character stringMapped to QTime
TIMESTAMPCharacter Time, Character stringMapped to QDateTime

PostgreSQL Data Types

PostgreSQL data typeSQL type descriptionRecommended input (C++ or Qt data type)
BOOLEANBooleanbool
SMALLINT16-bit signed integertypedef qint16
INTEGER32-bit signed integertypedef qint32
BIGINT64-bit signed integertypedef qint64
REAL32-bit variable-precision floating pointBy default mapping to QString
DOUBLE PRECISION64-bit variable-precision floating pointBy default mapping to QString
DECIMAL VARIABLEuser-specified precision, exactMapped to QString
NUMERIC VARIABLEuser-specified precision, exactMapped to QString
VARCHARvariable-length character stringMapped to QString
CHARACTERCharacter string of fixed-lengthMapped to QString
TEXTCharacter string of variable-lengthMapped to QString
CLOBCharacter large string objectMapped to QString
TIMESTAMP8 bytes, both date and timeMapped to QDateTime
TIMESTAMP8 bytes, both date and time, with time zoneMapped to QDateTime
DATE4 bytes, dates onlyMapped to QDate
TIME8 bytes, times of day only 00:00:00.00 - 23:59:59.99Mapped to QTime
TIME12 bytes times of day only, with time zone 00:00:00.00+12Mapped to QDateTime

QSQLITE SQLite version 3 Data Types

QSQLITE SQLite version 3 data typeSQL type descriptionRecommended input (C++ or Qt data type)
NULLNULL value.NULL
INTEGERSigned integer, stored in 8, 16, 24, 32, 48, or 64-bits depending on the magnitude of the value.typedef qint8/16/32/64
REAL64-bit floating point value.By default mapping to QString
TEXTCharacter string (UTF-8, UTF-16BE or UTF-16-LE).Mapped to QString
CLOBCharacter large string objectMapped to QString
BLOBThe value is a BLOB of data, stored exactly as it was input.Mapped to QByteArray

Sybase Adaptive Server Data Types

Sybase Adaptive Server data typeSQL type descriptionRecommended input (C++ or Qt data type)
BINARYDescribes a fixed-length binary value up to 255 bytes in size.Mapped to QByteArray
CHARCharacter StringMapped to QString
DATETIMEDate and time. Range: 1753-01-01 00:00:00 through 9999-12-31 23:59:59.Mapped to QDateTime
NCHARCharacter String of fixed lengthMapped to QString
NVARACHARCharacter String of variable lengthMapped to QString
VARCHARCharacter String of fixed lengthMapped to QString
CLOBCharacter large string objectMapped to QString
TIMESTAMPA unique number within a databaseMapped to QString
SMALLDATETIMEDate and time. Range: 1900-01-01 00:00 through 2079-12-31 23:59Mapped to QDateTime
UNICHARCharacter String of fixed length.(Unicode)Mapped to QString
UNIVARCHARCharacter String of variable length.(Unicode)Mapped to QString
VARBINARYDescribes a variable-length binary value up to 255 bytes in sizeMapped to QByteArray

SQLite Version 2

SQLite version 2 is "typeless". This means that you can store any kind of data you want in any column of any table, regardless of the declared data type of that column. We recommend that you map the data to QString.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 23
  2. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 45
  3. Une nouvelle ère d'IHM 3D pour les automobiles, un concept proposé par Digia et implémenté avec Qt 3
  4. Qt Creator 2.5 est sorti en beta, l'EDI supporte maintenant plus de fonctionnalités de C++11 2
  5. PySide devient un add-on Qt et rejoint le Qt Project et le modèle d'open gouvernance 1
  6. Vingt sociétés montrent leurs décodeurs basés sur Qt au IPTV World Forum, en en exploitant diverses facettes (déclaratif, Web, widgets) 0
  7. Thread travailleur avec Qt en utilisant les signaux et les slots, un article de Christophe Dumez traduit par Thibaut Cuvelier 1
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 50
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 23
  5. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 45
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web