Using the PEAR DB abstraction layer, I can create a sequence like this:
$db->createSequence ('mySequence');
Then I can get the next ID of that sequence like this:
$id = $db->nextId('mySequ ence');
But how do I initialize the sequence to have the appropriate starting value
based on the table I'm using it as a unique key for? For example, I have a
users table that has a unique user_id column. How do I make it so that the
sequence picks up where the user_id column in the table leaves off?
Thanks,
Chris Finke
$db->createSequence ('mySequence');
Then I can get the next ID of that sequence like this:
$id = $db->nextId('mySequ ence');
But how do I initialize the sequence to have the appropriate starting value
based on the table I'm using it as a unique key for? For example, I have a
users table that has a unique user_id column. How do I make it so that the
sequence picks up where the user_id column in the table leaves off?
Thanks,
Chris Finke