[Qt-interest] Qt ODBC driver bug

RZ rz at razfazz.at
Thu May 21 23:13:34 CEST 2009


Hello,

I discovered a weird error "introduced" in Qt4.5 (and was for sure never 
there until Qt4.4.0).

I connect via ODBC to an underlying MS Accesss database:

QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("ZeFlex");
db.open();
model = new QSqlTableModel();
model->setTable("tblAnfrage");

And here it goes: for _every_ field that is defined as a number (even as 
an Integer !!!) I get "values" with exactly one decimal position. So e.g.

model->record(selectedRow).value("ANr").toString();

returned e.g. "23" in Qt4.4.0 but now returns "23.0" (though defined as 
an Integer in the DB !!). Even more "funny" is that "23.0" is not a 
number (or at least with my locale ?!?!) so

model->record(selectedRow).value("ANr").toInt() = 23  (in Qt4.4)

and

model->record(selectedRow).value("ANr").toInt() = 0 (in Qt4.5)

Has anyone observed this behaviour? Or is there some new "setting" I 
overlloked? Or a workaround? (It is obvious that this "feature" destroys 
my application)

Thx for any help,

RZ



More information about the Qt-interest-old mailing list