hi

since the update to qt 4.5 i can't get QSqlQuery::bindValue to work
i tried google and searched the forum but couldn't find an answer to this question.

the following sample code works perfectly using qt 4.3.4, but with qt 4.5 i get this error:

QSqlError(-1, "QPSQL: Unable to create query", "ERROR: syntax error at or near "(" at character 10")

Qt Code:
  1. #include <QCoreApplication>
  2. #include <QSqlDatabase>
  3. #include <QSqlQuery>
  4. #include <QSqlError>
  5. #include <QDebug>
  6. #include <QVariant>
  7.  
  8.  
  9. int main(int argc, char **argv) {
  10. QCoreApplication a(argc, argv);
  11. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
  12. db.setHostName("localhost");
  13. db.setDatabaseName("test");
  14. db.setUserName("testuser");
  15. db.setPassword("testpw");
  16. db.open();
  17.  
  18. QSqlQuery q(db);
  19. q.prepare("SELECT :bla FROM myTable");
  20. q.bindValue(":bla","foo");
  21. if(q.exec()) {
  22. while(q.next()) {
  23. qDebug() << "output:" << q.value(0).toString();
  24. }
  25. }
  26. else {
  27. qDebug() << q.lastError();
  28. }
  29. }
To copy to clipboard, switch view to plain text mode 

if i do a
Qt Code:
  1. q.prepare("SELECT foo FROM myTable");
To copy to clipboard, switch view to plain text mode 
everything works just fine :/ but i can't get bindValue to work in qt 4.5
does anyone know what's the problem here?