Page 1 of 1

Generator

Posted: 15.09.2024, 01:53
by fernandobanhos
When trying to change the value of a generator, I found that it was not changed.

I'm using Firebird 4 with Zeos 8 (trunk)

In the following script: set generator GEN_CODIGO to 99

I already tried using the TZQuery, TZSQLProcessor components and was unsuccessful
I also tried running directly through the connection, without success.

Re: Generator

Posted: 16.09.2024, 21:00
by marsupilami
There seems to be some weird interaction between the set generator statement and Firebird transactions. The following works for me:

Code: Select all

  Conn.Connect;
  Conn.StartTransaction;
  Conn.ExecuteDirect('set generator TEST to 99');
  Conn.Commit;

Re: Generator

Posted: 16.09.2024, 22:21
by fernandobanhos
problem solved. You have to use it

StartTransaction and Commit

Example:

Conn.StartTransaction;
Qry. Close;
Qry. SQL. Clear;
Qry. SQL. Add('set generator TEST to 99');
Qry. ExecSQL;
Conn.Commit;

or

Conn.Connect;
Conn.StartTransaction;
Conn.ExecuteDirect('set generator TEST to 99');
Conn.Commit;