Subject RE: [firebird-php] auto increment last insert
Author Johan van Zyl
Hi
Thx Helen for another non-hostile, and as usual, very informative response!
We newbie's are having a though time, well at least in THIS forum! At least
I am!
You (me) apparently have to RTFM or FO<g>

And thx to all the other POSITIVE responses I have had!
It is REALLY appreciated. It is not easy being a PHP newbie!
If I am supposed to study ALL manuals in great detail before I am allowed to
ask a question here.....?

Greetings


JVZ
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: 25 November 2004 00:23
To: firebird-php@yahoogroups.com
Subject: RE: [firebird-php] auto increment last insert


At 09:01 AM 25/11/2004 +1100, you wrote:

>I've just arrived in the office - did this thread get completed?
>Is the original poster satisfied with the information?
>
>Basically, a set-by-step approach to replacing MySQL's autoinc, without
>procedures, triggers, and trying to get the value after the insert(could
be
>inaccurate if the generator's been used since the insert...)
>
>This example will use the following simple table:
>CREATE TABLE tbl_test (
> int_ID NUMERIC(18,0) NOT NULL,
> str_name VARCHAR(100),
> PRIMARY KEY(int_ID)
>);
>/* This is the generator for the tbl_test table */
>CREATE GENERATOR gen_tbl_test;

For safety, you should also create a trigger, in case the database is used
by other applications at some point:

CREATE TRIGGER BI_tbl_test for tbl_test
ACTIVE BEFORE INSERT
AS
BEGIN
IF (new.int_ID IS NULL) THEN
new.int_ID = GEN_ID(gen_tbl_test, 1);
END ^




Yahoo! Groups Sponsor

Get unlimited calls to

U.S./Canada




----------------------------------------------------------------------------
--
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-php/

b.. To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19


[Non-text portions of this message have been removed]