Subject | Re: Complex generators? |
---|---|
Author | ivoras |
Post date | 2003-12-28T00:30:23Z |
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@m...>
wrote:
or is there something else?
I was thinking of writing a custom UDF library for making&hadling
generators.
generators from some experimenging around, but I thought I could
maybe (and very reluctantly) give up continous IDs.
I'm seeking a solution that would would ideally keep the IDs
sequential.
wrote:
> (ID field grows from 1 up, for a single TYPE value), and I'm havingthe
> problems implementing data entry in the database. I was thinking of
> using a autincrement-type trigger like this:
>
> CREATE TRIGGER ... BEGIN
> genname = 'GEN_' || new.type;
> new.id = gen_id(:genname, 1);
> END
> Your are right - you cannot construct dynamic constructor names at
> server.Is there relly no way at all? Is gen_id a special case of a function
or is there something else?
I was thinking of writing a custom UDF library for making&hadling
generators.
> But before we can suggest some alternatives, maybe you should tellus if
> having continuous ID fields is important. I ask because if you usetriggers
> in this simple way, then transaction rollbacks will cause lostgenerator
> values since generators are not subject to transaction control.Yes, actually it is important. I was aware of this behaviour of
generators from some experimenging around, but I thought I could
maybe (and very reluctantly) give up continous IDs.
I'm seeking a solution that would would ideally keep the IDs
sequential.