Subject | Re: Complex generators? |
---|---|
Author | ivoras |
Post date | 2003-12-28T10:07:30Z |
--- In firebird-support@yahoogroups.com, "Florian Hector"
Yes, that was my first solution, and it fails when there are
concurrent users. TYPE+ID is the primary key.
Maybe there's a way to execute code on commit that would atomicaly
update the ID field?
> Create Trigger ADD_ID for MyTablebring. But if you create a unique
> active before insert position 0
> as
> Declare Variable ID Integer;
> begin
> Select Max(id) from MyTable WHERE TYPE=NEW.TYPE into :ID;
> NEW.ID = :ID + 1;
> end
>
> I take it that you are aware of the possible problems that can
> index on Type+ID, the server doesn't let you insert rows with thesame combination of Type and ID.
Yes, that was my first solution, and it fails when there are
concurrent users. TYPE+ID is the primary key.
Maybe there's a way to execute code on commit that would atomicaly
update the ID field?