Renamed isSqlTableColumnFound() to ifSqlColumnExists()
authorRoland Häder <roland@mxchange.org>
Sun, 30 Sep 2012 17:03:58 +0000 (17:03 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 30 Sep 2012 17:03:58 +0000 (17:03 +0000)
inc/db/lib-mysql3.php
inc/extensions-functions.php

index 17caef397c5f9ee472bf9242c8ddf84df30fb0da..756f97ed3f4833171846489fd2bae653b15c4089 100644 (file)
@@ -413,32 +413,32 @@ function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
                        $columnName = $tableArray[$idx];
 
                        // Debug log
-                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(isSqlTableColumnFound($tableName, $columnName)));
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(ifSqlColumnExists($tableName, $columnName)));
 
                        // Do we have no entry on ADD or an entry on DROP/CHANGE?
-                       if (((!isSqlTableColumnFound($tableName, $columnName)) && (isInString('ADD', $sql))) || ((isSqlTableColumnFound($tableName, $columnName)) && ((isInString('DROP', $sql)) || ((isInString('CHANGE', $sql)) && ($idx == 4) && ((!isSqlTableColumnFound($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
+                       if (((!ifSqlColumnExists($tableName, $columnName)) && (isInString('ADD', $sql))) || ((ifSqlColumnExists($tableName, $columnName)) && ((isInString('DROP', $sql)) || ((isInString('CHANGE', $sql)) && ($idx == 4) && ((!ifSqlColumnExists($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
                                // Do the query
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
                                $result = SQL_QUERY($sql, $F, $L, false);
 
                                // Skip further attempt(s)
                                break;
-                       } elseif ((((isSqlTableColumnFound($tableName, $columnName)) && (isInString('ADD', $sql))) || ((!isSqlTableColumnFound($tableName, $columnName)) && ((isInString('DROP', $sql))) || (isInString('CHANGE', $sql)))) && ($columnName != 'KEY')) {
+                       } elseif ((((ifSqlColumnExists($tableName, $columnName)) && (isInString('ADD', $sql))) || ((!ifSqlColumnExists($tableName, $columnName)) && ((isInString('DROP', $sql))) || (isInString('CHANGE', $sql)))) && ($columnName != 'KEY')) {
                                // Abort here because it is alreay there
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: sql=' . $sql . ',columnName=' . $columnName . ',idx=' . $idx);
                                break;
-                       } elseif ((!isSqlTableColumnFound($tableName, $columnName)) && (isInString('DROP', $sql))) {
+                       } elseif ((!ifSqlColumnExists($tableName, $columnName)) && (isInString('DROP', $sql))) {
                                // Abort here because we tried to drop a column which is not there (never created maybe)
                                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No drop: ' . $sql);
                                break;
                        } elseif ($columnName != 'KEY') {
                                // Something didn't fit, we better log it
-                               logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(isSqlTableColumnFound($tableName, $columnName)) . '');
+                               logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(ifSqlColumnExists($tableName, $columnName)) . '');
                        }
                } // END - foreach
        } elseif ((getTableType() == 'InnoDB') && (isInString('FULLTEXT', $sql))) {
                // Skip this query silently because InnoDB does not understand fulltext indexes
-               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : isSqlTableColumnFound($columnName)), $F, $L));
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : ifSqlColumnExists($columnName)), $F, $L));
        } elseif ($isAlterIndex === true) {
                // And column name as well without backticks
                $keyName = str_replace('`', '', $tableArray[5]);
@@ -603,7 +603,7 @@ function ifSqlTableExists ($tableName) {
 }
 
 // Is a table column there?
-function isSqlTableColumnFound ($tableName, $columnName) {
+function ifSqlColumnExists ($tableName, $columnName) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $columnName . ' - ENTERED!');
        // Do we have cache?
        if (!isset($GLOBALS[__FUNCTION__][$tableName][$columnName])) {
index 714483dac359db6fb19c53ca17a067dd807d5c48..00722ad55fccae68cc0931c7dc683e96b3adbc17 100644 (file)
@@ -1973,7 +1973,7 @@ function addSponsorMenuSql ($action, $what, $title, $active, $sort) {
 // Add configuration entry if not found for actual extension
 function addConfigAddSql ($columnName, $columnSql) {
        // Is the column there?
-       if (!isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+       if (!ifSqlColumnExists('{?_MYSQL_PREFIX?}_config', $columnName)) {
                // Not found, so add it
                addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `' . $columnName . '` ' . $columnSql);
        } elseif (isDebugModeEnabled()) {
@@ -1985,7 +1985,7 @@ function addConfigAddSql ($columnName, $columnSql) {
 // Drop configuration entry if found for actual extension
 function addConfigDropSql ($columnName) {
        // Is the column there?
-       if (isSqlTableColumnFound('{?_MYSQL_PREFIX?}_config', $columnName)) {
+       if (ifSqlColumnExists('{?_MYSQL_PREFIX?}_config', $columnName)) {
                // Found, so add it
                addExtensionSql('ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `' . $columnName . '`');
        } elseif (isDebugModeEnabled()) {