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.
This commit is contained in:
@@ -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 */
|
/* if this error isn't a deadlock OR if it is a deadlock and we've */
|
||||||
/* run out of retries, report the error */
|
/* 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)))
|
if(($iErrno != MYSQL_DEADLOCK_ERRNO) || (($iErrno == MYSQL_DEADLOCK_ERRNO) && ($iRetries <= 0)))
|
||||||
{
|
{
|
||||||
query_error($sQuery, $sComment);
|
query_error($sQuery, $sComment, $hAppdbLink);
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,12 +133,12 @@ function query_bugzilladb($sQuery,$sComment="")
|
|||||||
}
|
}
|
||||||
|
|
||||||
$hResult = mysql_query($sQuery, $hBugzillaLink);
|
$hResult = mysql_query($sQuery, $hBugzillaLink);
|
||||||
if(!$hResult) query_error($sQuery, $sComment);
|
if(!$hResult) query_error($sQuery, $sComment, $hBugzillaLink);
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function query_error($sQuery, $sComment="")
|
function query_error($sQuery, $sComment, $hLink)
|
||||||
{
|
{
|
||||||
static $bInQueryError = false;
|
static $bInQueryError = false;
|
||||||
|
|
||||||
@@ -151,8 +151,8 @@ function query_error($sQuery, $sComment="")
|
|||||||
$bInQueryError = true;
|
$bInQueryError = true;
|
||||||
|
|
||||||
error_log::log_error(ERROR_SQL, "Query: '".$sQuery."' ".
|
error_log::log_error(ERROR_SQL, "Query: '".$sQuery."' ".
|
||||||
"mysql_errno(): '".mysql_errno()."' ".
|
"mysql_errno(): '".mysql_errno($hLink)."' ".
|
||||||
"mysql_error(): '".mysql_error()."' ".
|
"mysql_error(): '".mysql_error($hLink)."' ".
|
||||||
"comment: '".$sComment."'");
|
"comment: '".$sComment."'");
|
||||||
|
|
||||||
$sStatusMessage = "<p><b>An internal error has occurred and has been logged and reported to appdb admins</b></p>";
|
$sStatusMessage = "<p><b>An internal error has occurred and has been logged and reported to appdb admins</b></p>";
|
||||||
|
|||||||
Reference in New Issue
Block a user