Module: appdb Branch: master Commit: c3f47364ae098a81afcec346a53d99136a4a54fa URL: http://source.winehq.org/git/appdb.git/?a=commit;h=c3f47364ae098a81afcec346a...
Author: Chris Morgan cmorgan@alum.wpi.edu Date: Sun Oct 28 22:05:26 2007 -0400
Pass database link handle to database error retrieval functions so we retrieve the error from the correct database connection. Add explicit link handle to query_error() and remove the option to not specify an error.
---
include/query.php | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/query.php b/include/query.php index bc1ab63..a5e7c71 100644 --- a/include/query.php +++ b/include/query.php @@ -28,10 +28,10 @@ function query_appdb($sQuery, $sComment="") { /* if this error isn't a deadlock OR if it is a deadlock and we've */ /* run out of retries, report the error */ - $iErrno = mysql_errno(); + $iErrno = mysql_errno($hAppdbLink); if(($iErrno != MYSQL_DEADLOCK_ERRNO) || (($iErrno == MYSQL_DEADLOCK_ERRNO) && ($iRetries <= 0))) { - query_error($sQuery, $sComment); + query_error($sQuery, $sComment, $hAppdbLink); return $hResult; }
@@ -133,12 +133,12 @@ function query_bugzilladb($sQuery,$sComment="") }
$hResult = mysql_query($sQuery, $hBugzillaLink); - if(!$hResult) query_error($sQuery, $sComment); + if(!$hResult) query_error($sQuery, $sComment, $hBugzillaLink); return $hResult; }
-function query_error($sQuery, $sComment="") +function query_error($sQuery, $sComment, $hLink) { static $bInQueryError = false;
@@ -151,8 +151,8 @@ function query_error($sQuery, $sComment="") $bInQueryError = true;
error_log::log_error(ERROR_SQL, "Query: '".$sQuery."' ". - "mysql_errno(): '".mysql_errno()."' ". - "mysql_error(): '".mysql_error()."' ". + "mysql_errno(): '".mysql_errno($hLink)."' ". + "mysql_error(): '".mysql_error($hLink)."' ". "comment: '".$sComment."'");
$sStatusMessage = "<p><b>An internal error has occurred and has been logged and reported to appdb admins</b></p>";