Qt-interest Archive, July 2004
SQL transactions
Message 1 in thread
Hello,
it seems, that the number of SQL queries "in a transaction"
(between QSqlDatabase::database()->transaction() and
QSqlDatabase::database()->commit()/rollback()) is limited.
I would like to transmit a sequence of 167 SQL queries
to the database. There is no problem, if I don't use a transaction.
But I would like to transmit the whole sequence in one transaction.
Using a transaction, an error occurs ("Undefined name.
Could not prepare statement") when executing the 82th query.
Does anybody know how to avoid this problem? Is there a
possibility to adjust the maximal number of queries per transaction?
Thanks, Frank
Environment:
- Qt 3.3.2
- database driver: QIBASE (supports transactions)
- Windows 2000
Message 2 in thread
I would assume this to be a limitation of the database, and not the driver.
Have you tried running these queires at a console while connected directly to
the database, or have you only run them though Qt?
j----- k-----
On Tuesday 13 July 2004 05:14 am, Frank Büllesfeld said something like:
> Hello,
>
> it seems, that the number of SQL queries "in a transaction"
> (between QSqlDatabase::database()->transaction() and
> QSqlDatabase::database()->commit()/rollback()) is limited.
>
> I would like to transmit a sequence of 167 SQL queries
> to the database. There is no problem, if I don't use a transaction.
> But I would like to transmit the whole sequence in one transaction.
> Using a transaction, an error occurs ("Undefined name.
> Could not prepare statement") when executing the 82th query.
>
> Does anybody know how to avoid this problem? Is there a
> possibility to adjust the maximal number of queries per transaction?
>
> Thanks, Frank
>
>
> Environment:
> - Qt 3.3.2
> - database driver: QIBASE (supports transactions)
> - Windows 2000
>
> --
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Message 3 in thread
> I would assume this to be a limitation of the database,
> and not the driver. Have you tried running these queires
> at a console while connected directly to the database,
> or have you only run them though Qt?
Good point! Up to now, I've only run these queries via
a Qt application. Unfortunately, I don't know
how to specify a transaction outside of a Qt application.
But I'll study the manuals of the DBMS...
Thanks, Frank
Message 4 in thread
Frank Büllesfeld wrote:
>>I would assume this to be a limitation of the database,
>>and not the driver. Have you tried running these queires
>>at a console while connected directly to the database,
>>or have you only run them though Qt?
>
>
> Good point! Up to now, I've only run these queries via
> a Qt application. Unfortunately, I don't know
> how to specify a transaction outside of a Qt application.
> But I'll study the manuals of the DBMS...
>
> Thanks, Frank
>
> --
> List archive and information: http://lists.trolltech.com/qt-interest/
One typically starts a transaction with:
begin;
enters ones SQL statements,
backs out a transaction with:
rollback;
and commits a transaction with:
commit;
--
[ signature omitted ]
Message 5 in thread
I've further investigated the problem.
The limitation is not related to the
number of queries in a transaction.
The limitation is related to the "type"
of queries in a transaction: It's not
allowed to have a "CREATE TABLE"
SQL statement and a corresponding
"INSERT INTO" SQL statement in
the same transaction (at least for
InterBase 6.0).
Frank
Message 6 in thread
Frank Büllesfeld wrote:
>
>The limitation is related to the "type"
>of queries in a transaction: It's not
>allowed to have a "CREATE TABLE"
>SQL statement and a corresponding
>"INSERT INTO" SQL statement in
>the same transaction (at least for
>InterBase 6.0).
For most DBMS's, DDL statements perform an automatic commit as a
side-effect.
Chris
--
[ signature omitted ]