[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-doc
Subject:    [PEAR-DOC] [PEAR-BUG] Req #4418 [Opn->Csd]: Clarification of DB::nextId & sequence reqs
From:       danielc () analysisandsolutions ! com
Date:       2005-05-24 15:58:49
Message-ID: 20050524155849.76618.qmail () pb12 ! pair ! com
[Download RAW message or body]

Edit report at http://pear.php.net/bugs/bug.php?id=4418&edit=1

 ID:               4418
 Updated by:       danielc@analysisandsolutions.com
 Reported By:      apthorpe at cynistar dot net
-Status:           Open
+Status:           Closed
 Type:             Feature/Change Request
 Package:          Documentation
 Operating System: All
 PHP Version:      4.3.4
-Assigned To:      
+Assigned To:      danielc
 New Comment:

The problems you're raising are common sense issues that database
developers should know.  None the less, I've modified the
documentation.  The changes should show up on Sunday when the docs get
rebuilt.


Previous Comments:
------------------------------------------------------------------------

[2005-05-24 10:35:17] apthorpe at cynistar dot net

Description:
------------
Based on the current documentation for PEAR DB, regarding sequences:

1. It's not clear that CREATE permission is needed to use
DB::nextId($seq_name, $onDemand) when $onDemand is set to TRUE
(default.)

2. There are implied limitations on the contents of $seq_name. For
example, using $seq_name = 'staff.staff_id' with MySQL will cause the
sequence table name to be generated as 'staff.staff_id_seq' - the '.'
causes MySQL to interpret 'staff' as the database and 'staff_id_seq' as
the table name. In retrospect this is expected, but it's not obvious
unless you understand the implemenation of sequences in PEAR::DB. One
of three things should happen: 1) special characters in $seq_name
should be stripped or encoded, 2) an error should be thrown if
$seq_name contains special characters, or 3) the documentation should
explicitly suggest safe characters to use in $seq_name, or at least
warn against using special characters.

3. DB::nextId() on a existing table will not work if used on a table
with IDs that were assigned before nextId() was first used. One must
manually set the id column in the sequence table to MAX(id) before
using nextId(). While it's doubtful that DB could be made psychic
enough to do this automatically, the documentation should warn against
using nextId() on an existing table without dumping/reinserting the
data using nextId() or adjusting the sequence id manually.

Thank you for taking the time to read this and for releasing and
maintaining PEAR::DB

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


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=4418&edit=1

-- 
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic