While class names and #include-s are certainly safer because they are checked at compile-time, but text names unleash the real power of QtSql — unified API (which, IMHO, doesn't make much sense if you stick your application to one particular RDBMS) and ability to make the database interface selectable by the final user. :)
P.S.: I know SQL is not 100% the same everywhere, but this problem is much less serious than different native database APIs. :) On 07/31/2013 07:23 PM, Niels Dekker wrote: > On 2013-07-31 16:52, Mark Brand wrote: >> The SQL driver headers were made explicitly private. For the reasoning >> behind >> this, see commit 1ee11474622e7da068fb1cd26f509ed10848a3b5 and the related >> change in Gerrit. > > Thanks, I found the commit at > http://qt.gitorious.org/~peter-h/qt/peter-hs-qtbase/commit/1ee11474622e7da068fb1cd26f509ed10848a3b5 > > It says that "no one used those headers in Qt 4", but well... I did :-) > >> If you follow the pattern in the "Detailed Description" [1] of the >> documentation of the QSqlDatabase class, you won't need to explicitly >> instantiate the driver in your code, or include the header that declares its >> constructor. > > FWIW, in general, as a C++ programmer, I prefer to type class names and > #include statements, which are checked at compile time, rather than > literal strings, which are only checked at run-time. But if the > QODBCDriver class is unsupported, I'll stop using it, of course! > >> [1] https://qt-project.org/doc/qt-5.1/qtsql/qsqldatabase.html#details > > Thanks for the link! > > Kind regards, Niels > -- > Niels Dekker > http://www.xs4all.nl/~nd/dekkerware > Scientific programmer at LKEB, Leiden University Medical Center
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest