]> git.mxchange.org Git - mailer.git/commitdiff
Fixes for installation phase
authorRoland Häder <roland@mxchange.org>
Mon, 12 Nov 2012 18:39:00 +0000 (18:39 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 12 Nov 2012 18:39:00 +0000 (18:39 +0000)
inc/db/lib-mysql3.php

index 4b8c5a299a01bfed117e976008b6c8623256d8c1..428f262bfd2910550149790843bdbbf63e392b80 100644 (file)
@@ -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;