[thelist] [OT] [Really OT] Excellent opportunity to acquire existing web business

Andrew Forsberg andrew at thepander.co.nz
Tue Apr 2 00:47:01 CST 2002

On Tue, 2002-04-02 at 18:36, Samir M. Nassar wrote:
> Oh I give up! I was making fun of it...


And you all owe tips peeps! :)

(See the subject line. OT is a really good indicator...)


<tip type="PEAR sequences">
Rather than rely on autoincrement columns in MySQL, hand-rolled
sequences, or Oracle/PostGreSQL's built in support, do it with PEAR and
get that funky non-db-dependent feelin':

$fooID = $db->nextID('fooSequence', TRUE);

Give each sequence a unique name and it'll behave well. TRUE tells
nextID() to generate a new sequence if one doesn't exist, it's also the
default. Otherwise you need to create a sequence with createSequence().

If you're using MySQL a table (1 column, 1 row) will be created by
PEAR::DB with the value of the last inserted ID, each call to nextID()
increments this column and returns the value.

Check support for your db in pear_base_dir/DB/STATUS. Last time I
checked it was emulated (without full testing) on FrontBase, emulated
(passed all tests) on MySQL, and implemented natively on Oracle and


More information about the thelist mailing list