[turba] Patch for MySQL auto-increment columns for object_id
Stephen Warren
swarren at wwwdotorg.org
Sat Sep 6 16:31:36 PDT 2003
This patch, against Turba 1.2, updates the SQL driver so that it can
support DBs with an auto_increment field for object_id, instead of the
uniq_id value. This allows other applications to more easily insert new
contacts into the Turba contacts database.
Implementation notes:
a) makeKey() is always called in the driver, but specifically ignored in
the SQL driver if it's in a mode where it uses the auto-increment column
type. Perhaps the driver should have a property/function indicating to
Source.php whether to use makeKey at all or not...
b) All driver addObject() calls now return either a key or a PEAR DB
error, so that addObject can actually create the key value if required.
c) There's a new parameter added to the SQL driver's parameter list
telling it whether to use this mode or not - that way one can choose the
existing or the new behaviour by setting this value true/false. One could
perhaps just make it look at whether the DB type is 'mysql' if one were to
require everyone to update their schema.
d) DB.php doesn't support MySQL's auto_increment columns except via the
sequence emulation hack. Consequently, there's MySQL-specific code in
sql.php now. Perhaps DB.php should be updated to support MySQL's new
column type concept, and return not-implemented for all its other backend
DBs (or emulate it via sequences - but I don't think it's powerful enough
to do that yet).
--
Stephen Warren, Software Engineer, Parama Networks, San Jose, CA
swarren at wwwdotorg.org http://www.wwwdotorg.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: turba-diff
Type: application/octet-stream
Size: 4506 bytes
Desc: not available
Url : http://lists.horde.org/archives/turba/attachments/20030906/2d814880/turba-diff.obj
More information about the turba
mailing list