Subject Re: Queryerror by Firebird - QT Connection
Author baloo_der_baer981
--- In firebird-support@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@...> wrote:
Hi,

I use the demo DB from AvERP (you can download it from
http://www.synerpy.de/?seite=download&nav=download).

I have created the table with:

CREATE TABLE "test"("id" integer)

But I get the same error if I use the following select statement:

SELECT "id" FROM "test"

The table creation I had commited.

Andre


>
> 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.
>
> HTH,
> Set
>
> 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("127.0.0.1");
> > db.setDatabaseName("xxx");
> > db.setUserName("SYSDBA");
> > db.setPassword("masterkey");
> >
> > if(db.open())
> > {
> > 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
>