Check if table exists, before checking column/key
authorRoland Häder <roland@mxchange.org>
Mon, 12 Nov 2012 19:09:23 +0000 (19:09 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 12 Nov 2012 19:09:23 +0000 (19:09 +0000)
inc/db/lib-mysql3.php

index 3755ea6e0dc3723789012713593d93e80460cadd..c9370f33a802c90ad79ffe75161aae5186d1dab2 100644 (file)
@@ -670,6 +670,12 @@ function ifSqlColumnExists ($tableName, $columnName) {
                // And column name as well
                $columnName = str_replace('`', '', $columnName);
 
+               // If the table is not there, it is okay
+               if (!ifSqlTableExists($tableName)) {
+                       // Then abort here
+                       return FALSE;
+               } // END - if
+
                // Get column information
                $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
                        array(
@@ -708,6 +714,12 @@ function isSqlTableIndexFound ($tableName, $keyName) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $keyName . ' - ENTERED!');
        // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$tableName][$keyName])) {
+               // If the table is not there, it is okay
+               if (!ifSqlTableExists($tableName)) {
+                       // Then abort here
+                       return FALSE;
+               } // END - if
+
                // Show indexes
                $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);