Skip to content

Commit

Permalink
#212 PR에서 DB 커넥션 지정 오류 수정 & sql_query_after 이벤트에 누락된 $source 파라메터 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kkigomi committed Dec 10, 2022
1 parent 69a4998 commit 3706ef9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/common.lib.php
Expand Up @@ -1648,21 +1648,21 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
$end_time = ($is_debug || G5_COLLECT_QUERY) ? get_microtime() : 0;

$error = null;
$source = array();
if ($is_debug || G5_COLLECT_QUERY) {
if(function_exists('mysqli_error') && G5_MYSQLI_USE) {
$error = array(
'error_code' => mysqli_errno($g5['connect_db']),
'error_message' => mysqli_error($g5['connect_db']),
'error_code' => mysqli_errno($link),
'error_message' => mysqli_error($link),
);
} else {
$error = array(
'error_code' => mysql_errno($g5['connect_db']),
'error_message' => mysql_error($g5['connect_db']),
'error_code' => mysql_errno($link),
'error_message' => mysql_error($link),
);
}

$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$source = array();
$found = false;

foreach ($stack as $index => $trace) {
Expand Down Expand Up @@ -1706,7 +1706,7 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null)
);
}

run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error);
run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error, $source);

return $result;
}
Expand Down

0 comments on commit 3706ef9

Please sign in to comment.