pgsql and adodb's genID() for unique id sequence...

From: <operationsengineer1(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: pgsql and adodb's genID() for unique id sequence...
Date: 2005-02-02 20:21:51
Message-ID: 20050202202151.39267.qmail@web52404.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

does anybody use this technique? it is supported by
pgsql, however, setting it up isn't intuitive to this
newbie.

-------------------------

http://phplens.com/lens/adodb/tips_portable_sql.htm

When you create records, you need to generate unique
id's for each record. There are two common techniques:
(1) auto-incrementing columns and (2) sequences.

Auto-incrementing columns are supported by MySQL,
Sybase and Microsoft Access and SQL Server. However
most other databases do not support this feature. So
for portability, you have little choice but to use
sequences. Sequences are special functions that return
a unique incrementing number every time you call it,
suitable to be used as database keys. In ADOdb, we use
the GenID( ) function. It has takes a parameter, the
sequence name. Different tables can have different
sequences.

$id = $connection->GenID('sequence_name');
$connection->Execute("insert into table (id,
firstname, lastname) values ($id, $firstname,
$lastname)");

For databases that do not support sequences natively,
ADOdb emulates sequences by creating a table for every
sequence.

-----------------------

i'm left wondering if i need to create a sequence
table with name 'sequence_name' before this technique
will work. or, rather, is it just a name i need to
plug in to uniquely identify a particular sequence
controlled by the function?

i'm sorry this is 50% off topic (adodb) and 50% on
topic (pqsql).

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2005-02-02 20:30:49 Re: pgsql and adodb's genID() for unique id sequence...
Previous Message Rodolfo J. Paiz 2005-02-02 20:10:11 Re: some help