本文整理汇总了PHP中PMA_Table::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::cache方法的具体用法?PHP PMA_Table::cache怎么用?PHP PMA_Table::cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Table
的用法示例。
在下文中一共展示了PMA_Table::cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
if (isset($_REQUEST['submitorderby']) && !empty($_REQUEST['order_field'])) {
list($sql_query, $result) = PMA_getQueryAndResultForReorderingTable();
}
// end if
/**
* A partition operation has been requested by the user
*/
$sql_query = '';
if (isset($_REQUEST['submit_partition']) && !empty($_REQUEST['partition_operation'])) {
list($sql_query, $result) = PMA_getQueryAndResultForPartition();
}
// end if
if ($reread_info) {
// to avoid showing the old value (for example the AUTO_INCREMENT) after
// a change, clear the cache
PMA_Table::$cache = array();
$page_checksum = $checksum = $delay_key_write = 0;
include 'libraries/tbl_info.inc.php';
}
unset($reread_info);
if (isset($result) && empty($message_to_show)) {
// set to success by default, because result set could be empty
// (for example, a table rename)
$_type = 'success';
if (empty($_message)) {
$_message = $result ? PMA_Message::success(__('Your SQL query has been executed successfully.')) : PMA_Message::error(__('Error'));
// $result should exist, regardless of $_message
$_type = $result ? 'success' : 'error';
if (isset($GLOBALS['ajax_request']) && $GLOBALS['ajax_request'] == true) {
$response = PMA_Response::getInstance();
$response->isSuccess($_message->isSuccess());
示例2: PMA_DBI_get_tables_full
//.........这里部分代码省略.........
$sql = 'SHOW TABLE STATUS FROM ' . PMA_backquote($each_database);
}
$each_tables = PMA_DBI_fetch_result($sql, 'Name', null, $link);
// Sort naturally if the config allows it and we're sorting
// the Name column.
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
uksort($each_tables, 'strnatcasecmp');
if ($sort_order == 'DESC') {
$each_tables = array_reverse($each_tables);
}
} else {
// Prepare to sort by creating array of the selected sort
// value to pass to array_multisort
foreach ($each_tables as $table_name => $table_data) {
${$sort_by}[$table_name] = strtolower($table_data[$sort_by]);
}
if ($sort_order == 'DESC') {
array_multisort(${$sort_by}, SORT_DESC, $each_tables);
} else {
array_multisort(${$sort_by}, SORT_ASC, $each_tables);
}
// cleanup the temporary sort array
unset(${$sort_by});
}
if ($limit_count) {
$each_tables = array_slice($each_tables, $limit_offset, $limit_count);
}
foreach ($each_tables as $table_name => $each_table) {
if ('comment' === $tbl_is_group && 0 === strpos($each_table['Comment'], $table)) {
// remove table from list
unset($each_tables[$table_name]);
continue;
}
if (!isset($each_tables[$table_name]['Type']) && isset($each_tables[$table_name]['Engine'])) {
// pma BC, same parts of PMA still uses 'Type'
$each_tables[$table_name]['Type'] =& $each_tables[$table_name]['Engine'];
} elseif (!isset($each_tables[$table_name]['Engine']) && isset($each_tables[$table_name]['Type'])) {
// old MySQL reports Type, newer MySQL reports Engine
$each_tables[$table_name]['Engine'] =& $each_tables[$table_name]['Type'];
}
// MySQL forward compatibility
// so pma could use this array as if every server is of version >5.0
$each_tables[$table_name]['TABLE_SCHEMA'] = $each_database;
$each_tables[$table_name]['TABLE_NAME'] =& $each_tables[$table_name]['Name'];
$each_tables[$table_name]['ENGINE'] =& $each_tables[$table_name]['Engine'];
$each_tables[$table_name]['VERSION'] =& $each_tables[$table_name]['Version'];
$each_tables[$table_name]['ROW_FORMAT'] =& $each_tables[$table_name]['Row_format'];
$each_tables[$table_name]['TABLE_ROWS'] =& $each_tables[$table_name]['Rows'];
$each_tables[$table_name]['AVG_ROW_LENGTH'] =& $each_tables[$table_name]['Avg_row_length'];
$each_tables[$table_name]['DATA_LENGTH'] =& $each_tables[$table_name]['Data_length'];
$each_tables[$table_name]['MAX_DATA_LENGTH'] =& $each_tables[$table_name]['Max_data_length'];
$each_tables[$table_name]['INDEX_LENGTH'] =& $each_tables[$table_name]['Index_length'];
$each_tables[$table_name]['DATA_FREE'] =& $each_tables[$table_name]['Data_free'];
$each_tables[$table_name]['AUTO_INCREMENT'] =& $each_tables[$table_name]['Auto_increment'];
$each_tables[$table_name]['CREATE_TIME'] =& $each_tables[$table_name]['Create_time'];
$each_tables[$table_name]['UPDATE_TIME'] =& $each_tables[$table_name]['Update_time'];
$each_tables[$table_name]['CHECK_TIME'] =& $each_tables[$table_name]['Check_time'];
$each_tables[$table_name]['TABLE_COLLATION'] =& $each_tables[$table_name]['Collation'];
$each_tables[$table_name]['CHECKSUM'] =& $each_tables[$table_name]['Checksum'];
$each_tables[$table_name]['CREATE_OPTIONS'] =& $each_tables[$table_name]['Create_options'];
$each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment'];
if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW' && $each_tables[$table_name]['Engine'] == NULL) {
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
} else {
/**
* @todo difference between 'TEMPORARY' and 'BASE TABLE' but how to detect?
*/
$each_tables[$table_name]['TABLE_TYPE'] = 'BASE TABLE';
}
}
$tables[$each_database] = $each_tables;
}
}
// cache table data
// so PMA_Table does not require to issue SHOW TABLE STATUS again
// Note: I don't see why we would need array_merge_recursive() here,
// as it creates double entries for the same table (for example a double
// entry for Comment when changing the storage engine in Operations)
// Note 2: Instead of array_merge(), simply use the + operator because
// array_merge() renumbers numeric keys starting with 0, therefore
// we would lose a db name thats consists only of numbers
PMA_Table::$cache = PMA_Table::$cache + $tables;
if (!is_array($database)) {
if (isset($tables[$database])) {
return $tables[$database];
} elseif (isset($tables[strtolower($database)])) {
// on windows with lower_case_table_names = 1
// MySQL returns
// with SHOW DATABASES or information_schema.SCHEMATA: `Test`
// but information_schema.TABLES gives `test`
// bug #1436171
// http://sf.net/support/tracker.php?aid=1436171
return $tables[strtolower($database)];
} else {
return $tables;
}
} else {
return $tables;
}
}
示例3: PMA_DBI_get_tables_full
//.........这里部分代码省略.........
`CHECK_TIME` AS `Check_time`,
`TABLE_COLLATION` AS `Collation`,
`CHECKSUM` AS `Checksum`,
`CREATE_OPTIONS` AS `Create_options`,
`TABLE_COMMENT` AS `Comment`
FROM `information_schema`.`TABLES`
WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
$tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link);
unset($sql_where_table, $sql);
}
// If permissions are wrong on even one database directory,
// information_schema does not return any table info for any database
// this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002
if (empty($tables)) {
foreach ($databases as $each_database) {
if (true === $tbl_is_group) {
$sql = 'SHOW TABLE STATUS FROM ' . PMA_backquote($each_database) . ' LIKE \'' . PMA_escape_mysql_wildcards(addslashes($table)) . '%\'';
} else {
$sql = 'SHOW TABLE STATUS FROM ' . PMA_backquote($each_database);
}
$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) {
if ('comment' === $tbl_is_group && 0 === strpos($each_table['Comment'], $table)) {
// remove table from list
unset($each_tables[$table_name]);
continue;
}
if (!isset($each_tables[$table_name]['Type']) && isset($each_tables[$table_name]['Engine'])) {
// pma BC, same parts of PMA still uses 'Type'
$each_tables[$table_name]['Type'] =& $each_tables[$table_name]['Engine'];
} elseif (!isset($each_tables[$table_name]['Engine']) && isset($each_tables[$table_name]['Type'])) {
// old MySQL reports Type, newer MySQL reports Engine
$each_tables[$table_name]['Engine'] =& $each_tables[$table_name]['Type'];
}
// MySQL forward compatibility
// so pma could use this array as if every server is of version >5.0
$each_tables[$table_name]['TABLE_SCHEMA'] = $each_database;
$each_tables[$table_name]['TABLE_NAME'] =& $each_tables[$table_name]['Name'];
$each_tables[$table_name]['ENGINE'] =& $each_tables[$table_name]['Engine'];
$each_tables[$table_name]['VERSION'] =& $each_tables[$table_name]['Version'];
$each_tables[$table_name]['ROW_FORMAT'] =& $each_tables[$table_name]['Row_format'];
$each_tables[$table_name]['TABLE_ROWS'] =& $each_tables[$table_name]['Rows'];
$each_tables[$table_name]['AVG_ROW_LENGTH'] =& $each_tables[$table_name]['Avg_row_length'];
$each_tables[$table_name]['DATA_LENGTH'] =& $each_tables[$table_name]['Data_length'];
$each_tables[$table_name]['MAX_DATA_LENGTH'] =& $each_tables[$table_name]['Max_data_length'];
$each_tables[$table_name]['INDEX_LENGTH'] =& $each_tables[$table_name]['Index_length'];
$each_tables[$table_name]['DATA_FREE'] =& $each_tables[$table_name]['Data_free'];
$each_tables[$table_name]['AUTO_INCREMENT'] =& $each_tables[$table_name]['Auto_increment'];
$each_tables[$table_name]['CREATE_TIME'] =& $each_tables[$table_name]['Create_time'];
$each_tables[$table_name]['UPDATE_TIME'] =& $each_tables[$table_name]['Update_time'];
$each_tables[$table_name]['CHECK_TIME'] =& $each_tables[$table_name]['Check_time'];
$each_tables[$table_name]['TABLE_COLLATION'] =& $each_tables[$table_name]['Collation'];
$each_tables[$table_name]['CHECKSUM'] =& $each_tables[$table_name]['Checksum'];
$each_tables[$table_name]['CREATE_OPTIONS'] =& $each_tables[$table_name]['Create_options'];
$each_tables[$table_name]['TABLE_COMMENT'] =& $each_tables[$table_name]['Comment'];
if (strtoupper($each_tables[$table_name]['Comment']) === 'VIEW') {
$each_tables[$table_name]['TABLE_TYPE'] = 'VIEW';
} else {
/**
* @todo difference between 'TEMPORARY' and 'BASE TABLE' but how to detect?
*/
$each_tables[$table_name]['TABLE_TYPE'] = 'BASE TABLE';
}
}
$tables[$each_database] = $each_tables;
}
}
if ($GLOBALS['cfg']['NaturalOrder']) {
foreach ($tables as $key => $val) {
uksort($tables[$key], 'strnatcasecmp');
}
}
// cache table data
// so PMA_Table does not require to issue SHOW TABLE STATUS again
PMA_Table::$cache = $tables;
if (!is_array($database)) {
if (isset($tables[$database])) {
return $tables[$database];
} elseif (isset($tables[strtolower($database)])) {
// on windows with lower_case_table_names = 1
// MySQL returns
// with SHOW DATABASES or information_schema.SCHEMATA: `Test`
// but information_schema.TABLES gives `test`
// bug #1436171
// http://sf.net/support/tracker.php?aid=1436171
return $tables[strtolower($database)];
} else {
return $tables;
}
} else {
return $tables;
}
}