Generator

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
fernandobanhos
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 02.05.2024, 01:29

Generator

Post 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.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Generator

Post 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;
fernandobanhos
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 02.05.2024, 01:29

Re: Generator

Post 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;
Post Reply