[Qt-interest] QtSql documentation pointer

Andrew Hodgkinson ahodgkinson at endurancetech.co.uk
Wed Aug 26 21:11:17 CEST 2009


I'm going cross-eyed trying to plough through hundreds of method calls in 
the numerous classes making up QtSql and haven't found an answer I need 
yet... :-) So sorry for a potentially stupid question, but can someone 
please point me at the place where the following is documented?

After running a query with QSqlQuery::exec(), I can iterate over results 
and convert the values to different types, as per the example at the top 
level of the QtSql documentation:

   http://doc.trolltech.com/4.5/qtsql.html

   while (query.next()) {
       QString name = query.value(0).toString();
       int salary = query.value(1).toInt();
       qDebug() << name << salary;
   }

This interface is ideal for a piece of software where the database schema 
is precisely known and fixed, so the SQL data types returned from a query 
are equally precisely known and fixed. But when it comes to types, of 
QSqlQuery::value(), the docs merely say: "The different database types 
are automatically mapped into the closest Qt equivalent."

This is insufficient information. Which precise database types are mapped 
to which precise Qt equivalents? What variations might I expect from 
different backends, if any? Does the plugin API specify that a plugin 
must guarantee to support a lowest common denominator collection of types 
and if so, what are they? The ISO standard surely has much to say on the 
subject but is not freely available and I have no access to a copy. In 
any event, there are multiple revisions of the standard and it would be 
necessary to know to which Qt adhered.

I'm particularly concerned about accuracy issues with numeric types and 
support for bounded or unbounded length text strings.

Many thanks,

-- 
TTFN, Andrew Hodgkinson
Find some electronic music at:     Photos, wallpaper, software and more:
http://pond.org.uk/music.html                        http://pond.org.uk/



More information about the Qt-interest-old mailing list