]> git.mxchange.org Git - mailer.git/blobdiff - inc/db/lib-mysql3.php
Various fixes to fix bug #226, comment #562, removed extension dependency register...
[mailer.git] / inc / db / lib-mysql3.php
index 756f97ed3f4833171846489fd2bae653b15c4089..2f1c1b4fe1bfa93295d677caf688c1d40e7553ab 100644 (file)
@@ -73,7 +73,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) {
 
                // Cache it and remember as last SQL query
                $GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified;
-               $GLOBALS['last_sql'] = $sqlStringModified;
+               $GLOBALS['last_sql']               = $sqlStringModified;
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified);
        }  else {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString);
@@ -269,10 +269,18 @@ function SQL_FREERESULT ($resource) {
 // SQL string escaping
 function SQL_QUERY_ESC ($sqlString, $data, $F, $L, $run = true, $strip = true, $secure = true) {
        // Link is there?
-       if ((!SQL_IS_LINK_UP()) || (!is_array($data))) return false;
+       if ((!SQL_IS_LINK_UP()) || (!is_array($data))) {
+               // Link is down or data is not an array
+               /* DEBUG: */ logDebugMessage($F, $L, 'SQL_IS_LINK_UP()=' . intval(SQL_IS_LINK_UP()) . ',data[]=' . gettype($data) . ',sqlString=' . $sqlString . ': ABORTING!');
+               return false;
+       } // END - if
+
+       // Init array for escaped data with SQL string
+       $dataSecured = array(
+               '__sql_string' => $sqlString
+       );
 
        // Escape all data
-       $dataSecured['__sql_string'] = $sqlString;
        foreach ($data as $key => $value) {
                $dataSecured[$key] = SQL_ESCAPE($value, $secure, $strip);
        } // END - foreach
@@ -612,7 +620,10 @@ function ifSqlColumnExists ($tableName, $columnName) {
 
                // Get column information
                $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
-                       array($tableName, $columnName), __FUNCTION__, __LINE__);
+                       array(
+                               $tableName,
+                               $columnName
+                       ), __FUNCTION__, __LINE__);
 
                // Determine it
                $GLOBALS[__FUNCTION__][$tableName][$columnName] = (!SQL_HASZERONUMS($result));