]> git.mxchange.org Git - mailer.git/blobdiff - inc/db/lib-mysql3.php
A lot forced-space characters ( ) removed, naming convention applied also in...
[mailer.git] / inc / db / lib-mysql3.php
index cd5efd46002ad1c872a9e526ae91c6721805f530..4f4b8cd0989c67d6fbadf6c02a587db58927357b 100644 (file)
@@ -76,8 +76,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
        $sqlString = str_replace('{PER}', '%', $sqlString);
 
        // Compile config entries out
-       $eval = '$sqlString = "' . FILTER_COMPILE_CONFIG(escapeQuotes($sqlString)) . '";';
-       eval($eval);
+       $sqlString = SQL_PREPARE_SQL_STRING($sqlString);
 
        // Starting time
        $querytimeBefore = microtime(true);
@@ -550,5 +549,21 @@ function SQL_HASZERONUMS ($result) {
        return (SQL_NUMROWS($result) === 0);
 }
 
+// Private function to prepare the SQL query string
+function SQL_PREPARE_SQL_STRING ($sqlString) {
+       // Is it already cached?
+       if (!isset($GLOBALS['sql_strings'][$sqlString])) {
+               // No, then generate the eval() command
+               $eval = '$sql = "' . FILTER_COMPILE_EXPRESSION_CODE(FILTER_COMPILE_CONFIG(escapeQuotes($sqlString))) . '";';
+               eval($eval);
+
+               // ... and set it
+               $GLOBALS['sql_strings'][$sqlString] = $sql;
+       } // END - if
+
+       // Return it
+       return $GLOBALS['sql_strings'][$sqlString];
+}
+
 // [EOF]
 ?>