From 73d1c2fe034660e81b453653491d1b0160172398 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 20 Dec 2010 15:03:45 +0000 Subject: [PATCH] Fix for broken cache handling in lib-mysql3.php, debug lines added --- inc/db/lib-mysql3.php | 9 +++++++-- inc/libs/country_functions.php | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index e982d87793..acb23bd238 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -44,6 +44,8 @@ if (!defined('__SECURITY')) { function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) { // Do we have cache? if (!isset($GLOBALS[__FUNCTION__][$sqlString])) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called: ' . $sqlString); + // Trim SQL string $sqlStringModified = trim($sqlString); @@ -72,11 +74,14 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) { // Cache it and remember as last SQL query $GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified; $GLOBALS['last_sql'] = $sqlStringModified; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified); } else { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used!'); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString); // Use cache (to save a lot function calls - $sqlString = $GLOBALS[__FUNCTION__][$sqlString]; + $GLOBALS['last_sql'] = $GLOBALS[__FUNCTION__][$sqlString]; + + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache is: ' . $sqlString); } // Starting time diff --git a/inc/libs/country_functions.php b/inc/libs/country_functions.php index f6874279e0..08628bc4e2 100644 --- a/inc/libs/country_functions.php +++ b/inc/libs/country_functions.php @@ -53,6 +53,7 @@ function generateCountryInfo ($id) { if (SQL_NUMROWS($result) == 1) { // Load entry $content = SQL_FETCHARRAY($result); + //* DEBUG: */ print($id.'=
'.print_r($content, true).'
'); // Construct human-readable description $ret = sprintf("%s (%s)", $content['descr'], $content['code']); -- 2.39.5