Hi,
I'm using QT 4.2, to access some tables in a MySQL database.
Everything was working OK until my (autoincrement) ID field for one of my tables reached 1,000,000.
Now, when I use QSqlQuery to read rows in that table... the id fields always come back as "0", instead of something like "1000085"
The offending code goes something like this:
p.prepare("select id from mytable where col1=? and col2=?");
p.addBindValue(var1);
p.addBindValue(var2);
q.exec();
while (q.next()){
// this incorrectly reports "0" for records with id numbers over 1 million
qDebug() << v.typeName(); // reports 'uint'
qDebug() << v.toString();
}
QSqlQuery q(db);
p.prepare("select id from mytable where col1=? and col2=?");
p.addBindValue(var1);
p.addBindValue(var2);
q.exec();
while (q.next()){
QVariant v = q.value(0);
// this incorrectly reports "0" for records with id numbers over 1 million
qDebug() << v.typeName(); // reports 'uint'
qDebug() << v.toString();
}
To copy to clipboard, switch view to plain text mode
Anyone know what the heck is going on?
Thanks,
Peter
Bookmarks