From 13d49e2e460309945446feacde3c9e6c91a34172 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 12 Nov 2012 18:39:00 +0000 Subject: [PATCH] Fixes for installation phase --- inc/db/lib-mysql3.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 4b8c5a299a..428f262bfd 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -639,6 +639,18 @@ function ifSqlTableExists ($tableName) { $result = SQL_QUERY_ESC("SHOW TABLES FROM `{?__DB_NAME?}` WHERE `Tables_in_{?__DB_NAME?}`='{?_MYSQL_PREFIX?}_%s'", array($tableName), __FILE__, __LINE__); + // Is a link there? + if (!is_resource($result)) { + // Is installation phase? + if (isInstallationPhase()) { + // Then silently abort here + return FALSE; + } else { + // Please report this + reportBug(__FUNCTION__, __LINE__, 'result[]=' . gettype($result) . ' is not a resource.'); + } + } // END - if + // Is there an entry? $GLOBALS[__FUNCTION__][$tableName] = (SQL_NUMROWS($result) == 1); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',numRows=' . intval($GLOBALS[__FUNCTION__][$tableName])); @@ -664,6 +676,18 @@ function ifSqlColumnExists ($tableName, $columnName) { $columnName ), __FUNCTION__, __LINE__); + // Is a link there? + if (!is_resource($result)) { + // Is installation phase? + if (isInstallationPhase()) { + // Then silently abort here + return FALSE; + } else { + // Please report this + reportBug(__FUNCTION__, __LINE__, 'result[]=' . gettype($result) . ' is not a resource.'); + } + } // END - if + // Determine it $GLOBALS[__FUNCTION__][$tableName][$columnName] = (!SQL_HASZERONUMS($result)); //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $columnName . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)) . ',numRows=' . intval($GLOBALS[__FUNCTION__][$tableName][$columnName])); @@ -685,6 +709,18 @@ function isSqlTableIndexFound ($tableName, $keyName) { // Show indexes $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__); + // Is a link there? + if (!is_resource($result)) { + // Is installation phase? + if (isInstallationPhase()) { + // Then silently abort here + return FALSE; + } else { + // Please report this + reportBug(__FUNCTION__, __LINE__, 'result[]=' . gettype($result) . ' is not a resource.'); + } + } // END - if + // The column is not found by default $GLOBALS[__FUNCTION__][$tableName][$keyName] = FALSE; -- 2.39.5