* optimized a bit
* fixed an error in the FULLTEXT statement
This commit is contained in:
@@ -79,9 +79,9 @@ if (isset($submit)) {
|
|||||||
} // end for
|
} // end for
|
||||||
$query = ereg_replace(', ADD $', '', $query);
|
$query = ereg_replace(', ADD $', '', $query);
|
||||||
|
|
||||||
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD ' . $query;
|
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD ' . $query;
|
||||||
$result = mysql_query($sql_query) or mysql_die();
|
$result = mysql_query($sql_query) or mysql_die();
|
||||||
|
$sql_query_cpy = $sql_query . ';';
|
||||||
// Builds the primary keys statements and updates the table
|
// Builds the primary keys statements and updates the table
|
||||||
$primary = '';
|
$primary = '';
|
||||||
if (isset($field_primary)) {
|
if (isset($field_primary)) {
|
||||||
@@ -91,8 +91,9 @@ if (isset($submit)) {
|
|||||||
} // end for
|
} // end for
|
||||||
$primary = ereg_replace(', $', '', $primary);
|
$primary = ereg_replace(', $', '', $primary);
|
||||||
if (!empty($primary)) {
|
if (!empty($primary)) {
|
||||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
|
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')';
|
||||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD PRIMARY KEY (' . $primary . ')') or mysql_die();
|
$result = mysql_query($sql_query) or mysql_die();
|
||||||
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
@@ -105,8 +106,9 @@ if (isset($submit)) {
|
|||||||
} // end for
|
} // end for
|
||||||
$index = ereg_replace(', $', '', $index);
|
$index = ereg_replace(', $', '', $index);
|
||||||
if (!empty($index)) {
|
if (!empty($index)) {
|
||||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')';
|
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')';
|
||||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')') or mysql_die();
|
$result = mysql_query($sql_query) or mysql_die();
|
||||||
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
@@ -119,8 +121,9 @@ if (isset($submit)) {
|
|||||||
} // end for
|
} // end for
|
||||||
$unique = ereg_replace(', $', '', $unique);
|
$unique = ereg_replace(', $', '', $unique);
|
||||||
if (!empty($unique)) {
|
if (!empty($unique)) {
|
||||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')';
|
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')';
|
||||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')') or mysql_die();
|
$result = mysql_query($sql_query) or mysql_die();
|
||||||
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
@@ -134,13 +137,16 @@ if (isset($submit)) {
|
|||||||
} // end for
|
} // end for
|
||||||
$fulltext = ereg_replace(', $', '', $fulltext);
|
$fulltext = ereg_replace(', $', '', $fulltext);
|
||||||
if (!empty($fulltext)) {
|
if (!empty($fulltext)) {
|
||||||
$sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
|
$sql_query = 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD FULLTEXT (' . $fulltext . ')';
|
||||||
$result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $fulltext . ')') or mysql_die();
|
$result = mysql_query($sql_query) or mysql_die();
|
||||||
|
$sql_query_cpy .= "\n" . $sql_query . ';';
|
||||||
}
|
}
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
// Go back to table properties
|
// Go back to table properties
|
||||||
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
$sql_query = $sql_query_cpy;
|
||||||
|
unset($sql_query_cpy);
|
||||||
|
$message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
|
||||||
include('./tbl_properties.php3');
|
include('./tbl_properties.php3');
|
||||||
exit();
|
exit();
|
||||||
} // end do alter table
|
} // end do alter table
|
||||||
|
Reference in New Issue
Block a user