From 7951ec8b4305ee6589de803b85c4058349c0fb4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 12 Nov 2012 19:09:23 +0000 Subject: [PATCH] Check if table exists, before checking column/key --- inc/db/lib-mysql3.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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__); -- 2.39.5