Date: 05/02/01
- Next message: Peter Holm: "[phplib] From CVS: class DB_MySQL_Sql extends DB_Generic_Sql ???"
- Previous message: Chris Padfield: "Re: [phplib] mysql_insert_id with phpLib?"
- In reply to: nathan r. hruby: "Re: [phplib] Explaination of 'db_swquence'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You don't need to manually insert the sequences. On the first call to
next_id('my_super_seq'), it will automatically create it for your. The
only reason to manually insert the sequence names would be if you wanted
to start at a number higher then 1.
later,
ajay
On Wed, 2 May 2001, nathan r. hruby wrote:
> 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
>
-- ---------------------------------------------------------------- Satyajot (Ajay) Sharma ssharma <email protected> Digital Odyssey System Administrator Voting for the lesser of two evils is still voting for evil. ------------------------------------------------------------------------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Peter Holm: "[phplib] From CVS: class DB_MySQL_Sql extends DB_Generic_Sql ???"
- Previous message: Chris Padfield: "Re: [phplib] mysql_insert_id with phpLib?"
- In reply to: nathan r. hruby: "Re: [phplib] Explaination of 'db_swquence'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

