$result = false;
// Determine index/fulltext/unique word
- $noIndex = (
- (
- isInStringIgnoreCase('INDEX', $sql)
- ) && (
- isInStringIgnoreCase('KEY', $sql)
- ) && (
- isInStringIgnoreCase('FULLTEXT', $sql)
- ) && (
- isInStringIgnoreCase('UNIQUE', $sql)
- )
+ $isAlterIndex = (
+ (
+ isInString('INDEX', $sql)
+ ) && (
+ isInString('KEY', $sql)
+ ) && (
+ isInString('FULLTEXT', $sql)
+ ) && (
+ isInString('UNIQUE', $sql)
+ )
);
// Extract table name
$tableName = str_replace('`', '', $tableArray[2]);
// Debug log
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>,isAlterIndex=' . intval($isAlterIndex));
// Shall we add/drop?
- if (((isInString('ADD', $sql)) || (isInString('DROP', $sql)) || (isInString('CHANGE', $sql))) && ($noIndex === true)) {
+ if (((isInString('ADD', $sql)) || (isInString('DROP', $sql)) || (isInString('CHANGE', $sql))) && ($isAlterIndex === false)) {
// Try two columns, one should fix
foreach (array(4,5) as $idx) {
// If an entry is not set, abort here
} 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));
- } elseif ($noIndex === false) {
+ } elseif ($isAlterIndex === true) {
// And column name as well without backticks
$keyName = str_replace('`', '', $tableArray[5]);
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'keyName=' . $keyName . ',tableArray=<pre>' . print_r($tableArray, true) . '</pre>');