cvs: pear /MDB2 MDB2.php
| From: | Lukas Smith | Date: | Tue, 20 Jun 2006 08:45:29 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-40838@lists.php.net to get a copy of this message | ||
lsmith Tue Jun 20 08:45:29 2006 UTC
Modified files:
/pear/MDB2 MDB2.php
Log:
- cosmetic fixes to raiseError userinfo output
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2.php?r1=1.220&r2=1.221&diff_format=u
Index: pear/MDB2/MDB2.php
diff -u pear/MDB2/MDB2.php:1.220 pear/MDB2/MDB2.php:1.221
--- pear/MDB2/MDB2.php:1.220 Sun Jun 18 14:30:15 2006
+++ pear/MDB2/MDB2.php Tue Jun 20 08:45:29 2006
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2.php,v 1.220 2006/06/18 14:30:15 lsmith Exp $
+// $Id: MDB2.php,v 1.221 2006/06/20 08:45:29 lsmith Exp $
//
/**
@@ -1352,6 +1352,7 @@
*/
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
{
+ $userinfo = "[Error message: $userinfo]\n";
// The error is yet a MDB2 error object
if (PEAR::isError($code)) {
// because we use the static PEAR::raiseError, our global
@@ -1365,19 +1366,17 @@
}
$code = $code->getCode();
} elseif (isset($this->connection)) {
- if (is_null($userinfo) && !empty($this->last_query)) {
- $userinfo = "[Last query: {$this->last_query}]\n";
+ if (!empty($this->last_query)) {
+ $userinfo.= "[Last query: {$this->last_query}]\n";
}
$native_errno = $native_msg = null;
list($code, $native_errno, $native_msg) = $this->errorInfo($code);
- if (!is_null($native_errno)) {
+ if (!is_null($native_errno) && $native_errno !== '') {
$userinfo.= "[Native code: $native_errno]\n";
}
- if (!is_null($native_msg)) {
+ if (!is_null($native_msg) && $native_msg !== '') {
$userinfo.= "[Native message: ". strip_tags($native_msg)
."]\n";
}
- } else {
- $userinfo = "[Error message: $userinfo]\n";
}
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo,
'MDB2_Error', true);
@@ -1955,6 +1954,9 @@
if ($this->in_transaction > 1) {
--$this->in_transaction;
return MDB2_OK;
+ } elseif ($this->in_transaction <= 0) {
+ return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
+ 'completeNestedTransaction: no transaction is opene to complete');
}
if ($this->has_transaction_error) {
return $this->rollback();