} // END - if
// Shall we run it?
- if (!isSqlTableIndexAdded($tableName, $tableArray[3])) {
+ if (!isSqlTableIndexAdded($tableName, $tableArray[3], $keyName)) {
// Send it to the SQL_QUERY() function
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
$result = SQL_QUERY($sql, $F, $L, $enableCodes);
}
// Check if there is a SQL table created
-function isSqlTableCreated ($table) {
+function isSqlTableCreated ($tableName) {
// Do we have cache?
- if (!isset($GLOBALS[__FUNCTION__][$table])) {
+ if (!isset($GLOBALS[__FUNCTION__][$tableName])) {
// Check if the table is there
$result = SQL_QUERY_ESC("SHOW TABLES FROM `{?__DB_NAME?}` WHERE `Tables_in_{?__DB_NAME?}`='{?_MYSQL_PREFIX?}_%s'",
- array($table), __FILE__, __LINE__);
+ array($tableName), __FILE__, __LINE__);
// Is there an entry?
- $GLOBALS[__FUNCTION__][$table] = (SQL_NUMROWS($result) == 1);
+ $GLOBALS[__FUNCTION__][$tableName] = (SQL_NUMROWS($result) == 1);
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',numRows=' . intval($GLOBALS[__FUNCTION__][$tableName]));
} // END - if
// Return cache
- return $GLOBALS[__FUNCTION__][$table];
+ return $GLOBALS[__FUNCTION__][$tableName];
}
// Checks depending on the mode if the table is there
-function isSqlTableIndexAdded ($tableName, $mode) {
+function isSqlTableIndexAdded ($tableName, $mode, $keyName) {
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__][$tableName][$mode])) {
// Show indexes
// But should we DROP?
if ($mode == 'DROP') {
// Then skip if nothing found
- $GLOBALS[__FUNCTION__][$tableName][$mode] = true;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Going to drop key ' . $keyName);
+ $GLOBALS[__FUNCTION__][$tableName][$mode] = true;
} // END - if
// Walk through all