Even more fixes for SQL problems :-(
authorRoland Häder <roland@mxchange.org>
Sun, 13 Jun 2010 13:49:47 +0000 (13:49 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 13 Jun 2010 13:49:47 +0000 (13:49 +0000)
inc/db/lib-mysql3.php
inc/filters.php
inc/wrapper-functions.php

index 73bdd9004d6fa562ba70bcd2638d0522e6d13171..a851367cb6ff00ea9fc7b306cf076c50202b2233 100644 (file)
@@ -545,12 +545,8 @@ function SQL_HASZERONUMS ($result) {
 function SQL_PREPARE_SQL_STRING ($sqlString) {
        // Is it already cached?
        if (!isset($GLOBALS['sql_strings'][$sqlString])) {
-               // No, generate the eval() command
-               $eval = '$sql = "' . FILTER_COMPILE_EXPRESSION_CODE(FILTER_COMPILE_CONFIG($sqlString)) . '";';
-               eval($eval);
-
-               // ... and set it
-               $GLOBALS['sql_strings'][$sqlString] = $sql;
+               // No, so compile and set it
+               $GLOBALS['sql_strings'][$sqlString] = FILTER_COMPILE_EXPRESSION_CODE(compileSqlConfig($sqlString));
        } // END - if
 
        // Return it
index 424fe9f1048fe3fb6e7ef46971215bb7a7a2799a..fa28dba40068e882bdf918aab32727d3806a4327 100644 (file)
@@ -107,7 +107,7 @@ function FILTER_FLUSH_FILTERS () {
        } // END - if
 
        // Shall we update usage counters (ONLY FOR DEBUGGING!)
-       if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (getConfig('update_filter_usage') == 'Y')) {
+       if ((isExtensionInstalledAndNewer('sql_patches', '0.6.0')) && (isConfigEntrySet('update_filter_usage')) && (getConfig('update_filter_usage') == 'Y')) {
                // Update all counters
                foreach ($GLOBALS['cache_array']['filter']['counter'] as $filterName => $filterArray) {
                        // Walk through all filters
index 8877bcc150e85ff0c92416d0088ac8b35e44235e..a184c20331912e39e1c1e0651c62ed124c88bd51 100644 (file)
@@ -956,5 +956,17 @@ function getHttpStatus () {
        return $GLOBALS['http_status'];
 }
 
+// Compiles config entries for SQL queries
+function compileSqlConfig ($sqlString) {
+       // Replace all
+       foreach (array('_MYSQL_PREFIX', '_TABLE_TYPE') as $configEntry) {
+               // "Compile" it
+               $sqlString = str_replace('{?' . $configEntry . '?}', getConfig($configEntry), $sqlString);
+       } // END - foreach
+
+       // Return the compiled SQL string
+       return $sqlString;
+}
+
 // [EOF]
 ?>