Introduction - Portability (Previous) (Next) DB

Last updated: Sun, 16 May 2004

Introduction - Sequences

Introduction - Sequences -- Sequences and auto-incrementing

ïÐÉÓÁÎÉÅ

Sequences are a way of offering unique IDs for data rows. If you do most of your work with e.g. MySQL, think of sequences as another way of doing AUTO_INCREMENT.

It's quite simple, first you request an ID, and then you insert that value in the ID field of the new row you're creating. You can have more than one sequence for all your tables, just be sure that you always use the same sequence for any particular table. To get the value of this unique ID use nextId(), if a sequence doesn't exists, it will be created automatically.

úÁÍÅÔËÁ

If you need to manually access the database objects PEAR DB uses to store sequence information, take note that the backend objects are named by passing the $seq_name argument you provide to PEAR DB's sequence methods through PHP's sprintf() function using the value from the seqname_format option as the sprintf() format argument.

The default seqname_format is %s_seq, which can be changed when connect()'ing or via setOption().

Introduction - Portability (Previous) (Next) DB

Download Documentation Last updated: Sun, 16 May 2004
Hosting
HIVE: All information for read only. Please respect copyright!
Hosted by hive ÊÃÁ: Êèåâñêàÿ ãîðîäñêàÿ áèáëèîòåêà