apply limit for max db/tale listed to SHOW also;

raised minimum MySQL version in case of error to 5.0.15;
there is only utf8 in PMA 3;
This commit is contained in:
Sebastian Mendel
2007-12-13 14:57:25 +00:00
parent 2179a190c2
commit b1939a554a

View File

@@ -245,7 +245,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
} else { } else {
$sql_where_table = ''; $sql_where_table = '';
} }
// for PMA bc: // for PMA bc:
// `SCHEMA_FIELD_NAME` AS `SHOW_TABLE_STATUS_FIELD_NAME` // `SCHEMA_FIELD_NAME` AS `SHOW_TABLE_STATUS_FIELD_NAME`
// //
@@ -254,7 +254,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
// comparison (if we are looking for the db Aa we don't want // comparison (if we are looking for the db Aa we don't want
// to find the db aa) // to find the db aa)
$this_databases = array_map('PMA_sqlAddslashes', $databases); $this_databases = array_map('PMA_sqlAddslashes', $databases);
$sql = ' $sql = '
SELECT *, SELECT *,
`TABLE_SCHEMA` AS `Db`, `TABLE_SCHEMA` AS `Db`,
@@ -280,7 +280,7 @@ function PMA_DBI_get_tables_full($database, $table = false,
FROM `information_schema`.`TABLES` FROM `information_schema`.`TABLES`
WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN (\'' . implode("', '", $this_databases) . '\') WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table; ' . $sql_where_table;
if ($limit_count) { if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset; $sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
} }
@@ -302,7 +302,13 @@ function PMA_DBI_get_tables_full($database, $table = false,
$sql = 'SHOW TABLE STATUS FROM ' $sql = 'SHOW TABLE STATUS FROM '
. PMA_backquote($each_database) . ';'; . PMA_backquote($each_database) . ';';
} }
$each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link); $each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link);
if ($limit_count) {
$each_tables = array_slice($each_tables, $limit_offset, $limit_count);
}
foreach ($each_tables as $table_name => $each_table) { foreach ($each_tables as $table_name => $each_table) {
if ('comment' === $tbl_is_group if ('comment' === $tbl_is_group
&& 0 === strpos($each_table['Comment'], $table)) && 0 === strpos($each_table['Comment'], $table))
@@ -530,7 +536,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
} }
} }
} }
/** /**
* apply limit and order manually now * apply limit and order manually now
@@ -785,7 +791,6 @@ function PMA_DBI_get_variable($var, $type = PMA_DBI_GETVAR_SESSION, $link = null
* @uses $GLOBALS['charset'] * @uses $GLOBALS['charset']
* @uses $GLOBALS['lang'] * @uses $GLOBALS['lang']
* @uses $GLOBALS['cfg']['Lang'] * @uses $GLOBALS['cfg']['Lang']
* @uses $GLOBALS['cfg']['ColumnTypes']
* @uses defined() * @uses defined()
* @uses explode() * @uses explode()
* @uses sprintf() * @uses sprintf()
@@ -810,8 +815,8 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
define('PMA_MYSQL_STR_VERSION', $mysql_version); define('PMA_MYSQL_STR_VERSION', $mysql_version);
unset($mysql_version, $match); unset($mysql_version, $match);
} else { } else {
define('PMA_MYSQL_INT_VERSION', 32332); define('PMA_MYSQL_INT_VERSION', 50015);
define('PMA_MYSQL_STR_VERSION', '3.23.32'); define('PMA_MYSQL_STR_VERSION', '5.00.15');
} }
} }
@@ -819,36 +824,12 @@ function PMA_DBI_postConnect($link, $is_controluser = false)
define('PMA_ENGINE_KEYWORD','ENGINE'); define('PMA_ENGINE_KEYWORD','ENGINE');
} }
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']]; if (! empty($GLOBALS['collation_connection'])) {
if ($is_controluser $mysql_charset = explode('_', $GLOBALS['collation_connection']);
|| empty($GLOBALS['collation_connection']) PMA_DBI_query("SET NAMES '" . $mysql_charset[0] . "' COLLATE '" . $GLOBALS['collation_connection'] . "';",
|| (strpos($GLOBALS['collation_connection'], '_')
? substr($GLOBALS['collation_connection'], 0, strpos($GLOBALS['collation_connection'], '_'))
: $GLOBALS['collation_connection']) == $mysql_charset) {
PMA_DBI_query('SET NAMES ' . $mysql_charset . ';', $link,
PMA_DBI_QUERY_STORE);
} else {
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link,
PMA_DBI_QUERY_STORE);
}
if (!empty($GLOBALS['collation_connection'])) {
PMA_DBI_query('SET collation_connection = \'' . $GLOBALS['collation_connection'] . '\';',
$link, PMA_DBI_QUERY_STORE); $link, PMA_DBI_QUERY_STORE);
} } else {
if (!$is_controluser) { PMA_DBI_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
$GLOBALS['collation_connection'] = PMA_DBI_get_variable('collation_connection',
PMA_DBI_GETVAR_SESSION, $link);
$GLOBALS['charset_connection'] = PMA_DBI_get_variable('character_set_connection',
PMA_DBI_GETVAR_SESSION, $link);
}
// Add some field types to the list, this needs to be done once per session!
if (!in_array('BINARY', $GLOBALS['cfg']['ColumnTypes'])) {
$GLOBALS['cfg']['ColumnTypes'][] = 'BINARY';
}
if (!in_array('VARBINARY', $GLOBALS['cfg']['ColumnTypes'])) {
$GLOBALS['cfg']['ColumnTypes'][] = 'VARBINARY';
} }
} }
@@ -1159,7 +1140,7 @@ function PMA_isSuperuser() {
// a $userlink // a $userlink
if (isset($GLOBALS['userlink'])) { if (isset($GLOBALS['userlink'])) {
return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user', return PMA_DBI_try_query('SELECT COUNT(*) FROM mysql.user',
$GLOBALS['userlink'], PMA_DBI_QUERY_STORE); $GLOBALS['userlink'], PMA_DBI_QUERY_STORE);
} else { } else {
return false; return false;
} }