Qt4-preview-feedback Archive, February 2008
PSQL driver regression
Message 1 in thread
Hi,
some days ago a tried out a snapshot of Qt 4.4 (Qt-4.4.0-snapshot-20080128)
and tested a little database application which has been developed previously
with Qt 4.2.
With Qt-4.4 I've got some SQL errors related to prepared queris, which I
didn't get with 4.2. I think this is may be a regression in the PSQL driver
code.
I attach a minimal example which exposes the problem (see below)
When I compile with Qt 4.2.2 I get the following (correct) output:
ANSWER: "false"
But with the Qt-4.4 snapshot I get:
QSqlError(-1, "QPSQL: Unable to create query", "ERROR: syntax error at or
near "("
LINE 1: EXECUTE ('123')
^
")
BTW: I'm using postgresql-8.2.4-27 on OpenSUSE-10.3.
Best regards,
-Rainer
======= main.cpp ===========
#include <cstdlib>
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDebug>
#include <QVariant>
int main(int argc, char **argv)
{
QCoreApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
db.setHostName("localhost");
db.setDatabaseName("test");
db.setUserName("test");
db.setPassword("********");
bool ok = db.open();
Q_ASSERT(ok == true);
QSqlQuery q(db);
q.prepare("SELECT ? IS NULL");
q.addBindValue("123");
ok=q.exec();
if(ok)
{
while(q.next())
{
qDebug() << "ANSWER:" << q.value(0).toString();
}
}
else
{
qDebug() << q.lastError();
}
}
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx