[Qt-interest] qt 4.5.3 / qt 4.6 / qt 4.5.1 : what is wrong with this use of QSqlQuery ??
wim.delvaux at adaptiveplanet.com
wim.delvaux at adaptiveplanet.com
Sun Nov 8 03:17:28 CET 2009
Hi all,
All above versions are Linux versions.
I have a program built in 4.5.1 in code hereafter produces nice result
("QSQLITE", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC")
("qt_sql_default_connection")
ACTIVE
QVariant(int, 46)
DONE
ACTIVE
QVariant(int, 46)
DONE
which is exactly what should be expected.
HOWEVER ! when I compile this code - untouched - with 4.5.3 I get NO output
whatsoever nor for the first try nor for the second.
For the first block I get as result
("QSQLITE", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC")
("qt_sql_default_connection")
ACTIVE
DONE
and for the second part I get an EEEE error with something like
NOEXEC
EEE5EEER "Using unsupported buffer type: 7448448 (parameter: 1) QMYSQL3:
Unable to bind value" "Using unsupported buffer type: 7448448 (parameter: 1)"
"QMYSQL3: Unable to bind value"
EEEEE6ER "Using unsupported buffer type: 7448448 (parameter: 1) QMYSQL3:
Unable to bind value" "Using unsupported buffer type: 7448448 (parameter: 1)"
"QMYSQL3: Unable to bind value"
DONE
sometimes it just crashes !
under 4.6 I get again a different result :
("QSQLITE", "QMYSQL3", "QMYSQL")
("qt_sql_default_connection")
ACTIVE
QVariant(int, 46)
DONE
NOEXEC
EEE5EEER "Using unsupported buffer type: 24 (parameter: 1) QMYSQL3: Unable
to bind value" "Using unsupported buffer type: 24 (parameter: 1)" "QMYSQL3:
Unable to bind value"
EEEEE6ER "Using unsupported buffer type: 24 (parameter: 1) QMYSQL3: Unable
to bind value" "Using unsupported buffer type: 24 (parameter: 1)" "QMYSQL3:
Unable to bind value"
DONE
First query works just fine, second again with errors
code ....
qDebug() << QSqlDatabase::drivers();
qDebug() << QSqlDatabase::connectionNames();
{
QSqlQuery query("select * from pb_dbversion" );
if( query.lastError().isValid() ) {
qDebug() << " EE1EEEER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( ! query.exec() ) {
qDebug() << " NOEXEC";
}
if( query.lastError().isValid() ) {
qDebug() << " EE2EEER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( query.isActive() ) {
qDebug() << "ACTIVE";
}
if( query.lastError().isValid() ) {
qDebug() << " EE3EEEER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( query.next()) {
qDebug() << query.value(0);
}
qDebug() << "DONE";
}
{
QSqlQuery query;
if( ! query.prepare("select version from pb_dbversion where version =
:Version") ) {
qDebug() << " NOT PREPARED";
}
query.bindValue( ":Version", 46 );
if( query.lastError().isValid() ) {
qDebug() << " EEE4EEER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( ! query.exec() ) {
qDebug() << " NOEXEC";
}
if( query.lastError().isValid() ) {
qDebug() << " EEE5EEER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( query.isActive() ) {
qDebug() << "ACTIVE";
}
if( query.lastError().isValid() ) {
qDebug() << " EEEEE6ER" << query.lastError().text()
<< query.lastError().databaseText()
<< query.lastError().driverText();
}
if( query.next()) {
qDebug() << query.value(0);
}
qDebug() << "DONE";
exit(0);
}
More information about the Qt-interest-old
mailing list