[Interest] Qt4 QODBCDriver class and header file no longer in Qt5?

Niels Dekker mymailfromqt at xs4all.nl
Wed Jul 31 16:53:46 CEST 2013


On 2013-07-31 16:24, Sergio Ahumada wrote:
> I think those headers were made private in Qt 5.1 (they were
> public by mistake).
> Anyways, what if you do something like:
> QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");

Thank you, Sergio. So even Qt 4 users should not #include 
<QtSql/QODBCDriver> or do 'new QODBCDriver', right?

FWIW, I do think calling QSqlDatabase::addDatabase(new QODBCDriver) is 
more type safe than calling QSqlDatabase::addDatabase("QODBC"): Typo's 
in the class name 'QODBCDriver' are likely to be detected earlier than 
typo's in the string "QODBC".

Also note that the Qt 5.1 documentation still mentions the class 
QODBCDriver in a table of drivers included with Qt: 
http://qt-project.org/doc/qt-5.1/qtsql/qsqldatabase.html#addDatabase-2

Anyway, if I'm not supposed to use the QODBCDriver class, I think I'll 
just follow your advise.  :-)

   Kind regards, Niels

PS Karl Ruetz, also thanks for your information!
--
Niels Dekker
http://www.xs4all.nl/~nd/dekkerware
Scientific programmer at LKEB, Leiden University Medical Center



More information about the Interest mailing list