Final batch of PHP3-Compatibility fixes. Please test. :-)

This commit is contained in:
Garvin Hicking
2003-11-22 20:57:48 +00:00
parent 096094b74d
commit c2b46ac945
66 changed files with 570 additions and 989 deletions

View File

@@ -61,12 +61,7 @@ if (!$rowset) {
}
$count = 0;
while ($row = mysql_fetch_array($rowset)) {
if (PMA_MYSQL_INT_VERSION >= 32303) {
$myfieldname = 'Tables_in_' . htmlspecialchars($db);
}
else {
$myfieldname = 'Tables in ' . htmlspecialchars($db);
}
$myfieldname = 'Tables_in_' . htmlspecialchars($db);
$table = $row[$myfieldname];
if ($cfgRelation['commwork']) {
$comments = PMA_getComments($db, $table);
@@ -81,19 +76,11 @@ while ($row = mysql_fetch_array($rowset)) {
* Gets table informations
*/
// The 'show table' statement works correct since 3.23.03
if (PMA_MYSQL_INT_VERSION >= 32303) {
$local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = PMA_mysql_fetch_array($result);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
} else {
$local_query = 'SELECT COUNT(*) AS count FROM ' . PMA_backquote($table);
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = array();
$num_rows = PMA_mysql_result($result, 0, 'count');
$show_comment = '';
} // end display comments
$local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
$result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
$showtable = PMA_mysql_fetch_array($result);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
if ($result) {
mysql_free_result($result);
}
@@ -130,10 +117,7 @@ while ($row = mysql_fetch_array($rowset)) {
// I don't know what does following column mean....
// $indexes_info[$row['Key_name']]['Packed'] = $row['Packed'];
if (PMA_MYSQL_INT_VERSION >= 32300) {
// rabus: The 'Comment' field was added in MySQL 3.23.0.
$indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
}
$indexes_info[$row['Key_name']]['Comment'] = $row['Comment'];
$indexes_data[$row['Key_name']][$row['Seq_in_index']]['Column_name'] = $row['Column_name'];
if (isset($row['Sub_part'])) {
@@ -214,8 +198,8 @@ while ($row = mysql_fetch_array($rowset)) {
$type = $row['Type'];
// reformat mysql query output - staybyte - 9. June 2001
// loic1: set or enum types: slashes single quotes inside options
if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
$tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
$tmp[2] = substr(preg_replace('@([^,])\'\'', '\\1\\\'@', ',' . $tmp[2]), 1);
$type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
$type_nowrap = '';
@@ -223,13 +207,13 @@ while ($row = mysql_fetch_array($rowset)) {
$unsigned = 0;
$zerofill = 0;
} else {
$binary = eregi('BINARY', $row['Type'], $test);
$unsigned = eregi('UNSIGNED', $row['Type'], $test);
$zerofill = eregi('ZEROFILL', $row['Type'], $test);
$binary = stristr($row['Type'], 'binary');
$unsigned = stristr($row['Type'], 'unsigned');
$zerofill = stristr($row['Type'], 'zerofill');
$type_nowrap = ' nowrap="nowrap"';
$type = eregi_replace('BINARY', '', $type);
$type = eregi_replace('ZEROFILL', '', $type);
$type = eregi_replace('UNSIGNED', '', $type);
$type = preg_replace('@BINARY@i', '', $type);
$type = preg_replace('@ZEROFILL@i', '', $type);
$type = preg_replace('@UNSIGNED@i', '', $type);
if (empty($type)) {
$type = ' ';
}
@@ -334,4 +318,4 @@ function printPage()
echo '<br /><br />&nbsp;<input type="button" style="visibility: ; width: 100px; height: 25px" name="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
require('./footer.inc.php');
?>
?>