Date: 05/02/01
- Next message: Chris Padfield: "Re: [phplib] mysql_insert_id with phpLib?"
- Previous message: varin <email protected>: "[phplib] mysql_insert_id with phpLib?"
- In reply to: Dennis Gearon: "[phplib] Explaination of 'db_swquence'"
- Next in thread: Ajay Sharma: "Re: [phplib] Explaination of 'db_swquence'"
- Reply: Ajay Sharma: "Re: [phplib] Explaination of 'db_swquence'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 5/2/01 11:52 AM, Dennis Gearon at gearond <email protected> wrote:
> Would someone give me a brief explanation of the purpose of
> 'db_sequence'?
>
First read: http://phplib.netuse.de/documentation/documentation-3.html#ss3.1
(note the using next_id() subsction at the end of section-3.1)
Make a table called db_sequence
# --------------------------------------------------------
#
# Table structure for table 'db_sequence'
#
CREATE TABLE db_sequence (
seq_name varchar(127) NOT NULL,
nextid int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (seq_name)
);
Then add the sequences you want by name (INSERT INTO db_sequence
seq_name='foo', nextid='0');
and then call $idToUse = $db->next_id("foo"); to get an atomic id that will
not be any place else. This is just a kludge around the various versions of
AUTO INCREMENT or whatever sequences that the different databases that
exist.
The nice thing is that you have a record of how your keys are used in other
tables if you set up a seq_name for each table that you use, ie: you can do
a little extra checking for inconsistencies in your tables.
-n
-- ...... nathan hruby - nhruby <email protected> computer support specialist department of drama and theatre http://www.drama.uga.edu/ ......--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Chris Padfield: "Re: [phplib] mysql_insert_id with phpLib?"
- Previous message: varin <email protected>: "[phplib] mysql_insert_id with phpLib?"
- In reply to: Dennis Gearon: "[phplib] Explaination of 'db_swquence'"
- Next in thread: Ajay Sharma: "Re: [phplib] Explaination of 'db_swquence'"
- Reply: Ajay Sharma: "Re: [phplib] Explaination of 'db_swquence'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

