Subject Re: [firebird-support] Queryerror by Firebird - QT Connection
Author Svein Erling Tysvaer
Hi Baloo!

How was the database created? I know nothing about QT (not even if it
works with Firebird), but if a table or field is defined with double
quotes (e.g. CREATE TABLE "test"("id" integer)), then it becomes case
sensitive. Your select will be converted to all uppercase, i.e. SELECT
ID FROM TEST unless you double quote the field and table name separately
(SELECT "id" FROM "test"). Though I would rather recommend creating the
table/field without double quotes to avoid case sensitivity.

Your query seems OK, but the error indicates that it is not, and that is
why I guess it has something to do with the table or field name.

Oh, one more thing. You do not mention transactions. Creating a table is
DDL, and that transaction has to be committed before you do your DML
(select, insert etc.). Just thought I should mention this in case your
are doing the select just after you created your table.


baloo_der_baer981 wrote:
> i my problem:
> I build a db connection to an 1.5 Firebird db server whit QT - no
> problems. I open the connection - no problem. But if I execute a
> QSqlQuery I get the following error from query.lastError().text() and
> query.lastError().databaseText():
> Unsuccessful execution caused by system error that does
> not preclude successful execution of subsequent statements
> Could not prepare statement
> code:
> QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
> db.setHostName("");
> db.setDatabaseName("xxx");
> db.setUserName("SYSDBA");
> db.setPassword("masterkey");
> if(
> {
> QSqlQuery query;
> query.exec("SELECT id FROM test");
> }
> I have checked the following things:
> 1. the table exist
> 2. the colum exist
> 3. db.lastError().driverText() return no error
> 4. db.lastError().databaseText() return no error
> I hope you can help me. Thanks.
> baloo