Update of /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend
In directory usw-pr-cvs1:/tmp/cvs-serv9722/lib/WikiDB/backend
Modified Files:
PearDB.php
Log Message:
SF bug #492511: Don't assume DB:isManip() exists.
Index: PearDB.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend/PearDB.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** PearDB.php 2001/12/03 03:18:34 1.11
--- PearDB.php 2001/12/14 22:20:44 1.12
***************
*** 682,690 ****
*/
function _is_false_error($error) {
! $code = $error->getCode();
$query = $this->_dbh->last_query;
! return ($code == DB_ERROR
! && ! DB::isManip($query)
! && preg_match('/^\s*"?(LOCK|UNLOCK)\s/', $query));
}
--- 682,709 ----
*/
function _is_false_error($error) {
! if ($error->getCode() != DB_ERROR)
! return false;
!
$query = $this->_dbh->last_query;
!
! if (! preg_match('/^\s*"?(INSERT|UPDATE|DELETE|REPLACE|CREATE'
! . '|DROP|ALTER|GRANT|REVOKE|LOCK|UNLOCK)\s/', $query)) {
! // Last query was not of the sort which doesn't return any data.
! return false;
! }
!
! if (! in_array('ismanip', get_class_methods('DB'))) {
! // Pear shipped with PHP 4.0.4pl1 (and before, presumably)
! // does not have the DB::isManip method.
! return true;
! }
!
! if (DB::isManip($query)) {
! // If Pear thinks it's an isManip then it wouldn't have thrown
! // the error we're testing for....
! return false;
! }
!
! return true;
}
|