Subject | Re: [firebird-php] [info/tip] dynamically created generators (inside stored procedures). |
---|---|
Author | Jochem Maas |
Post date | 2006-02-23T16:21:30Z |
hi Lester,
your efforts on this list are appreciated btw (at least by me)!
Lester Caine wrote:
alien to me (I have my own custom firebird DB classes that I wrote with Ard - I think
I posted them here once but one was interested :-)
'sequences' are known as generators in firebird - not that this really important.
I'm not talking about creating a database and it's 'fixed' generators (and
relevant 'auto-inc'-like triggers) - by 'fixed' I mean that a table such as COMPANY
would probably have it's own generator calld something like GEN_COMPANY_ID - such
a generator doesn't need to be created on the fly.
what I am talking about is created a generator on the fly as a reaction to the
insertion of a record in a particular table (in my case each row represents a
prizedraw and each prizedraw requires it's own generator, given that the client
only starts creating 'prizedraws' after I deliver the app means I can't create
the generators for the 'prizedraws' (pretty obvious given thgat the 'prizedraws'
don't exist when I ship the app.) - another important thing to consider is atomicity:
I want my record to be inserted and the generator created as one operation
(therefore inserting the record and then letting php extension/code create the
generator is not an option - and if it had been it would have been easy).
your efforts on this list are appreciated btw (at least by me)!
Lester Caine wrote:
> Jochem Maas wrote:huh? did you read the rest of my post? I'll admit that adoDB is completely
>
>
>>in the mean time.... today I have spent most of my time trying to
>>figure out how I can dynamically create GENERATORS (a process
>>that is triggered on a successful insert of a certain table of my
>>db). why would I want to do this? well I have a table that stores
>>'prizedraw' [marketing] actions that the client can add to (& edit)
>>via a CMS - according to local law the [3] winning prizedraw numbers
>>must be determined beforehand and the numbers deposited with a
>>sollicitor - the upshot being that entrants must be handed out prizedraw
>>numbers from a predefined range (in fact a start number is enough) and to avoid
>>any kind of race condition when handing out prizedraw numbers from
>>the predefined range I chose to use firebird GENERATORs (why re-invent the wheel
>>right).
>
>
> How about looking at how ADOdb does it then ?
alien to me (I have my own custom firebird DB classes that I wrote with Ard - I think
I posted them here once but one was interested :-)
> bitweaver uses this to build the original database and add 'sequences'(what do you mean by 'original database' btw?)
'sequences' are known as generators in firebird - not that this really important.
I'm not talking about creating a database and it's 'fixed' generators (and
relevant 'auto-inc'-like triggers) - by 'fixed' I mean that a table such as COMPANY
would probably have it's own generator calld something like GEN_COMPANY_ID - such
a generator doesn't need to be created on the fly.
what I am talking about is created a generator on the fly as a reaction to the
insertion of a record in a particular table (in my case each row represents a
prizedraw and each prizedraw requires it's own generator, given that the client
only starts creating 'prizedraws' after I deliver the app means I can't create
the generators for the 'prizedraws' (pretty obvious given thgat the 'prizedraws'
don't exist when I ship the app.) - another important thing to consider is atomicity:
I want my record to be inserted and the generator created as one operation
(therefore inserting the record and then letting php extension/code create the
generator is not an option - and if it had been it would have been easy).
> as required :)
>