removed MySQL < 5 code

This commit is contained in:
Sebastian Mendel
2007-10-02 09:53:43 +00:00
parent 619f6592ee
commit e1fd395631
6 changed files with 55 additions and 93 deletions

View File

@@ -23,7 +23,7 @@ $err_url = 'main.php?' . PMA_generate_common_url();
* Builds and executes the db creation sql query * Builds and executes the db creation sql query
*/ */
$sql_query = 'CREATE DATABASE ' . PMA_backquote($db); $sql_query = 'CREATE DATABASE ' . PMA_backquote($db);
if (!empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) { if (!empty($db_collation)) {
list($db_charset) = explode('_', $db_collation); list($db_charset) = explode('_', $db_collation);
if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) { if (in_array($db_charset, $mysql_charsets) && in_array($db_collation, $mysql_collations[$db_charset])) {
$sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation); $sql_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);

View File

@@ -61,9 +61,7 @@ $count = 0;
while ($row = PMA_DBI_fetch_assoc($rowset)) { while ($row = PMA_DBI_fetch_assoc($rowset)) {
$myfieldname = 'Tables_in_' . htmlspecialchars($db); $myfieldname = 'Tables_in_' . htmlspecialchars($db);
$table = $row[$myfieldname]; $table = $row[$myfieldname];
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) { $comments = PMA_getComments($db, $table);
$comments = PMA_getComments($db, $table);
}
if ($count != 0) { if ($count != 0) {
echo '<div style="page-break-before: always;">' . "\n"; echo '<div style="page-break-before: always;">' . "\n";
@@ -184,9 +182,7 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
if ($have_rel) { if ($have_rel) {
echo ' <th>' . $strLinksTo . '</th>' . "\n"; echo ' <th>' . $strLinksTo . '</th>' . "\n";
} }
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) { echo ' <th>' . $strComments . '</th>' . "\n";
echo ' <th>' . $strComments . '</th>' . "\n";
}
if ($cfgRelation['mimework']) { if ($cfgRelation['mimework']) {
echo ' <th>MIME</th>' . "\n"; echo ' <th>MIME</th>' . "\n";
} }
@@ -274,13 +270,11 @@ while ($row = PMA_DBI_fetch_assoc($rowset)) {
} }
echo '</td>' . "\n"; echo '</td>' . "\n";
} }
if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) { echo ' <td>';
echo ' <td>'; if (isset($comments[$field_name])) {
if (isset($comments[$field_name])) { echo htmlspecialchars($comments[$field_name]);
echo htmlspecialchars($comments[$field_name]);
}
echo '</td>' . "\n";
} }
echo '</td>' . "\n";
if ($cfgRelation['mimework']) { if ($cfgRelation['mimework']) {
$mime_map = PMA_getMIME($db, $table, true); $mime_map = PMA_getMIME($db, $table, true);

View File

@@ -48,7 +48,7 @@ $multi_values .= "\n";
foreach ($tables as $each_table) { foreach ($tables as $each_table) {
// ok we show also views // ok we show also views
//if (PMA_MYSQL_INT_VERSION >= 50000 && is_null($each_table['Engine'])) { //if (is_null($each_table['Engine'])) {
// Don't offer to export views yet. // Don't offer to export views yet.
// continue; // continue;
//} //}

View File

@@ -206,14 +206,11 @@ if (empty($is_info)) {
echo "\n"; echo "\n";
} }
if (PMA_MYSQL_INT_VERSION >= 40101) { $db_collation = PMA_getDbCollation($db);
$db_collation = PMA_getDbCollation($db); if ($db == 'information_schema') {
}
if (PMA_MYSQL_INT_VERSION < 50002
|| (PMA_MYSQL_INT_VERSION >= 50002 && $db != 'information_schema')) {
$is_information_schema = false;
} else {
$is_information_schema = true; $is_information_schema = true;
} else {
$is_information_schema = false;
} }
if (!$is_information_schema) { if (!$is_information_schema) {
@@ -313,11 +310,7 @@ if (!$is_information_schema) {
.' alt="" width="16" height="16" />'; .' alt="" width="16" height="16" />';
} }
echo $strDBCopy . ':'; echo $strDBCopy . ':';
if (PMA_MYSQL_INT_VERSION >= 50000) { $drop_clause = 'DROP TABLE / DROP VIEW';
$drop_clause = 'DROP TABLE / DROP VIEW';
} else {
$drop_clause = 'DROP TABLE';
}
?> ?>
</legend> </legend>
<input type="text" name="newname" size="30" class="textfield" value="" /><br /> <input type="text" name="newname" size="30" class="textfield" value="" /><br />
@@ -370,26 +363,22 @@ if (!$is_information_schema) {
/** /**
* Change database charset * Change database charset
*/ */
if (PMA_MYSQL_INT_VERSION >= 40101) { echo '<form method="post" action="./db_operations.php">' . "\n"
// MySQL supports setting default charsets / collations for databases since . PMA_generate_common_hidden_inputs($db, $table)
// version 4.1.1. . '<fieldset>' . "\n"
echo '<form method="post" action="./db_operations.php">' . "\n" . ' <legend>';
. PMA_generate_common_hidden_inputs($db, $table) if ($cfg['PropertiesIconic']) {
. '<fieldset>' . "\n" echo '<img class="icon" src="' . $pmaThemeImage . 's_asci.png"'
. ' <legend>'; .' alt="" width="16" height="16" />';
if ($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 's_asci.png"'
.' alt="" width="16" height="16" />';
}
echo ' <label for="select_db_collation">' . $strCollation . ':</label>' . "\n"
. ' </legend>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION,
'db_collation', 'select_db_collation', $db_collation, false, 3)
. ' <input type="submit" name="submitcollation"'
. ' value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
. '</fieldset>' . "\n"
. '</form>' . "\n";
} }
echo ' <label for="select_db_collation">' . $strCollation . ':</label>' . "\n"
. ' </legend>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION,
'db_collation', 'select_db_collation', $db_collation, false, 3)
. ' <input type="submit" name="submitcollation"'
. ' value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
. '</fieldset>' . "\n"
. '</form>' . "\n";
if ($num_tables > 0 if ($num_tables > 0
&& !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) { && !$cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false) {

View File

@@ -129,7 +129,6 @@ if (isset($_REQUEST['submit_search'])) {
* *
* @todo can we make use of fulltextsearch IN BOOLEAN MODE for this? * @todo can we make use of fulltextsearch IN BOOLEAN MODE for this?
* @uses PMA_DBI_query * @uses PMA_DBI_query
* PMA_MYSQL_INT_VERSION
* PMA_backquote * PMA_backquote
* PMA_DBI_free_result * PMA_DBI_free_result
* PMA_DBI_fetch_assoc * PMA_DBI_fetch_assoc
@@ -156,11 +155,9 @@ if (isset($_REQUEST['submit_search'])) {
$sqlstr_delete = 'DELETE'; $sqlstr_delete = 'DELETE';
// Fields to select // Fields to select
$res = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';'); $res = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';');
while ($current = PMA_DBI_fetch_assoc($res)) { while ($current = PMA_DBI_fetch_assoc($res)) {
if (PMA_MYSQL_INT_VERSION >= 40100) { list($current['Charset']) = explode('_', $current['Collation']);
list($current['Charset']) = explode('_', $current['Collation']);
}
$current['Field'] = PMA_backquote($current['Field']); $current['Field'] = PMA_backquote($current['Field']);
$tblfields[] = $current; $tblfields[] = $current;
} // while } // while
@@ -187,8 +184,7 @@ if (isset($_REQUEST['submit_search'])) {
$thefieldlikevalue = array(); $thefieldlikevalue = array();
foreach ($tblfields as $tblfield) { foreach ($tblfields as $tblfield) {
if (PMA_MYSQL_INT_VERSION >= 40100 if ($tblfield['Charset'] != $charset_connection
&& $tblfield['Charset'] != $charset_connection
&& $tblfield['Charset'] != 'NULL' && $tblfield['Charset'] != 'NULL'
&& $tblfield['Charset'] != '') { && $tblfield['Charset'] != '') {
$prefix = 'CONVERT(_utf8 '; $prefix = 'CONVERT(_utf8 ';

View File

@@ -52,10 +52,8 @@ if ($num_tables == 0) {
require_once './libraries/bookmark.lib.php'; require_once './libraries/bookmark.lib.php';
if (PMA_MYSQL_INT_VERSION >= 40101) { require_once './libraries/mysql_charsets.lib.php';
require_once './libraries/mysql_charsets.lib.php'; $db_collation = PMA_getDbCollation($db);
$db_collation = PMA_getDbCollation($db);
}
// Display function // Display function
/** /**
@@ -63,7 +61,6 @@ if (PMA_MYSQL_INT_VERSION >= 40101) {
* display table header (<table><thead>...</thead><tbody>) * display table header (<table><thead>...</thead><tbody>)
* *
* @uses PMA_showHint() * @uses PMA_showHint()
* @uses PMA_MYSQL_INT_VERSION
* @uses $GLOBALS['cfg']['PropertiesNumColumns'] * @uses $GLOBALS['cfg']['PropertiesNumColumns']
* @uses $GLOBALS['is_show_stats'] * @uses $GLOBALS['is_show_stats']
* @uses $GLOBALS['strTable'] * @uses $GLOBALS['strTable']
@@ -100,10 +97,8 @@ function PMA_TableHeader($db_is_information_schema = false)
if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {
echo ' <th>' . $GLOBALS['strType'] . '</th>' . "\n"; echo ' <th>' . $GLOBALS['strType'] . '</th>' . "\n";
$cnt++; $cnt++;
if (PMA_MYSQL_INT_VERSION >= 40100) { echo ' <th>' . $GLOBALS['strCollation'] . '</th>' . "\n";
echo ' <th>' . $GLOBALS['strCollation'] . '</th>' . "\n"; $cnt++;
$cnt++;
}
} }
if ($GLOBALS['is_show_stats']) { if ($GLOBALS['is_show_stats']) {
echo ' <th>' . $GLOBALS['strSize'] . '</th>' . "\n" echo ' <th>' . $GLOBALS['strSize'] . '</th>' . "\n"
@@ -227,17 +222,10 @@ foreach ($tables as $keyname => $each_table) {
if (! empty($each_table['TABLE_ROWS'])) { if (! empty($each_table['TABLE_ROWS'])) {
$empty_table = '<a href="sql.php?' . $tbl_url_query $empty_table = '<a href="sql.php?' . $tbl_url_query
. '&amp;sql_query='; . '&amp;sql_query=';
if (PMA_MYSQL_INT_VERSION >= 40000) { $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) . '&amp;zero_rows='
. '&amp;zero_rows=' . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME']))) . '" onclick="return confirmLink(this, \'TRUNCATE ';
. '" onclick="return confirmLink(this, \'TRUNCATE ';
} else {
$empty_table .= urlencode('DELETE FROM ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))
. '" onclick="return confirmLink(this, \'DELETE FROM ';
}
$empty_table .= PMA_jsFormat($each_table['TABLE_NAME']) . '\')">' . $titles['Empty'] . '</a>'; $empty_table .= PMA_jsFormat($each_table['TABLE_NAME']) . '\')">' . $titles['Empty'] . '</a>';
} else { } else {
$empty_table = $titles['NoEmpty']; $empty_table = $titles['NoEmpty'];
@@ -292,14 +280,12 @@ foreach ($tables as $keyname => $each_table) {
} }
} }
if (PMA_MYSQL_INT_VERSION >= 40100) { if (isset($each_table['Collation'])) {
if (isset($each_table['Collation'])) { $collation = '<dfn title="'
$collation = '<dfn title="' . PMA_getCollationDescr($each_table['Collation']) . '">'
. PMA_getCollationDescr($each_table['Collation']) . '">' . $each_table['Collation'] . '</dfn>';
. $each_table['Collation'] . '</dfn>'; } else {
} else { $collation = '---';
$collation = '---';
}
} }
if ($is_show_stats) { if ($is_show_stats) {
@@ -430,17 +416,14 @@ if (!($cfg['PropertiesNumColumns'] > 1)) {
echo ' <th align="center">' . "\n" echo ' <th align="center">' . "\n"
. ' <dfn title="' . ' <dfn title="'
. sprintf($strDefaultEngine, $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n"; . sprintf($strDefaultEngine, $default_engine) . '">' .$default_engine . '</dfn></th>' . "\n";
// Have to account for old MySQL with no collation (bug 1554885) // we got a case where $db_collation was empty
if (PMA_MYSQL_INT_VERSION >= 40100) { echo ' <th align="center">' . "\n";
// we got a case where $db_collation was empty if (! empty($db_collation)) {
echo ' <th align="center">' . "\n"; echo ' <dfn title="'
if (! empty($db_collation)) { . PMA_getCollationDescr($db_collation) . ' (' . $strDefault . ')">' . $db_collation
echo ' <dfn title="' . '</dfn>';
. PMA_getCollationDescr($db_collation) . ' (' . $strDefault . ')">' . $db_collation
. '</dfn>';
}
echo '</th>';
} }
echo '</th>';
} }
if ($is_show_stats) { if ($is_show_stats) {