From: Roland Häder Date: Mon, 12 Nov 2012 19:09:23 +0000 (+0000) Subject: Check if table exists, before checking column/key X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7951ec8b4305ee6589de803b85c4058349c0fb4c;p=mailer.git Check if table exists, before checking column/key --- diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 3755ea6e0d..c9370f33a8 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -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__);