Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #9364 DataObjects PostgreSQL Native Sequence
Submitted: 2006-11-17 15:38 UTC
From: cron at odi dot com dot br Assigned: alan_k
Status: Closed Package: DB_DataObject (version 1.8.4)
PHP Version: 5.0.2 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-17 15:38 UTC] cron at odi dot com dot br (Cron)
Description: ------------ DataObjects don't honor the PostgreSQL native sequences. To honor the native sequences i believe this changes should be make. I think this also reflects on the: http://pear.php.net/bugs/bug.php?id=3773 In DB_DataObjects.php function SequenceKey, line 2013: if ( in_array($dbtype , array( 'mysql', 'mysqli', 'mssql', 'ifx')) && should be(note extra pgsql): if ( in_array($dbtype , array( 'mysql', 'mysqli', 'mssql', 'ifx', 'pgsql')) &&

Comments

 [2007-01-16 03:39 UTC] alan_k (Alan Knowles)
Can you test this and confirm it works - Otherwise It looks like bug#3773 covers this issue.
 [2007-08-09 10:58 UTC] kaleissin (Kale Pseudonymous)
This works for version 1.8.7 (with MDB2), the correct sequence is incremented and read from, the insert works, *but* afterwards it leads to a new error: DataObject attempts to call getOne() on line 1071, which it can't find. There is no getOne in the MDB2-driver for postgres but there is one in MDB2/Extended.php, which I don't know how to "turn on". Mimicking the code for 'mssql', which chooses between queryOne() and getOne(), the insert works, the "can't find getOne()"-error is gone, but I get an unknown error so that it *seems* that the insert failed. However there is no error-message in the table-object.
 [2007-08-09 12:18 UTC] kaleissin (Kale Pseudonymous)
I've added the patch "Get_correct_sequence". It incorporates Cron's suggestions, lowercases the table-name so that getSequenceName() in MDB2 will work correctly, and uses queryOne() if getOne() can't be found. With this patch it works for me (finally). Using strtolower() directly might be considered somewhat hackish but it works. Oh and if the patch closes this bug, it might be useful to add notes to bugs #42, #3773, #9762, #11624 and feature request #97 also, who all discuss the same problem.
 [2007-08-10 03:42 UTC] alan_k (Alan Knowles)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.