/**
 * Prepares the $column_order array
 *
 * @return array
 */
function PMA_getColumnOrder()
{
    $column_order['DEFAULT_COLLATION_NAME'] = array('disp_name' => __('Collation'), 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation());
    $column_order['SCHEMA_TABLES'] = array('disp_name' => __('Tables'), 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_TABLE_ROWS'] = array('disp_name' => __('Rows'), 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_DATA_LENGTH'] = array('disp_name' => __('Data'), 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_INDEX_LENGTH'] = array('disp_name' => __('Indexes'), 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_LENGTH'] = array('disp_name' => __('Total'), 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_DATA_FREE'] = array('disp_name' => __('Overhead'), 'format' => 'byte', 'footer' => 0);
    return $column_order;
}
/**
 * Prepares the $column_order array
 *
 * @return array
 */
function PMA_getColumnOrder()
{
    $column_order = array();
    $column_order['DEFAULT_COLLATION_NAME'] = array('disp_name' => __('Collation'), 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation());
    $column_order['SCHEMA_TABLES'] = array('disp_name' => __('Tables'), 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_TABLE_ROWS'] = array('disp_name' => __('Rows'), 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_DATA_LENGTH'] = array('disp_name' => __('Data'), 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_INDEX_LENGTH'] = array('disp_name' => __('Indexes'), 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_LENGTH'] = array('disp_name' => __('Total'), 'format' => 'byte', 'footer' => 0);
    // At this point we were preparing the display of Overhead using DATA_FREE
    // but its content does not represent the real overhead in the case
    // of InnoDB
    return $column_order;
}
Example #3
0
  * to generate the links
  *
  * @global array $GLOBALS['db_url_params']
  * @name $db_url_params
  */
 $db_url_params['db'] = $_POST['new_db'];
 $is_superuser = $GLOBALS['dbi']->isSuperuser();
 $column_order = PMA_getColumnOrder();
 $url_query = PMA_URL_getCommon(array('db' => $_POST['new_db']));
 /**
  * String that will contain the output HTML
  * @name    $new_db_string
  */
 $new_db_string = '<tr>';
 if (empty($db_collation_for_ajax)) {
     $db_collation_for_ajax = PMA_getServerCollation();
 }
 // $dbstats comes from the create table dialog
 if (!empty($dbstats)) {
     $current = array('SCHEMA_NAME' => $_POST['new_db'], 'DEFAULT_COLLATION_NAME' => $db_collation_for_ajax, 'SCHEMA_TABLES' => '0', 'SCHEMA_TABLE_ROWS' => '0', 'SCHEMA_DATA_LENGTH' => '0', 'SCHEMA_MAX_DATA_LENGTH' => '0', 'SCHEMA_INDEX_LENGTH' => '0', 'SCHEMA_LENGTH' => '0', 'SCHEMA_DATA_FREE' => '0');
 } else {
     $current = array('SCHEMA_NAME' => $_POST['new_db'], 'DEFAULT_COLLATION_NAME' => $db_collation_for_ajax);
 }
 list($column_order, $generated_html) = PMA_buildHtmlForDb($current, $is_superuser, $url_query, $column_order, $replication_types, $GLOBALS['replication_info']);
 $new_db_string .= $generated_html;
 $new_db_string .= '</tr>';
 $response = PMA\libraries\Response::getInstance();
 $response->addJSON('message', $message);
 $response->addJSON('new_db_string', $new_db_string);
 $response->addJSON('sql_query', PMA\libraries\Util::getMessage(null, $sql_query, 'success'));
 $response->addJSON('url_query', PMA\libraries\Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . $url_query . '&amp;db=' . urlencode($current['SCHEMA_NAME']));
Example #4
0
if ($server > 0) {
    $databases = PMA_DBI_get_databases_full(null, $dbstats, null, $sort_by, $sort_order, $pos, true);
    $databases_count = $PMA_List_Database->count();
} else {
    $databases_count = 0;
}
/**
 * Displays the page
 */
if ($databases_count > 0) {
    reset($databases);
    $first_database = current($databases);
    // table col order
    // there is no db specific collation or charset prior 4.1.0
    if (PMA_MYSQL_INT_VERSION >= 40100) {
        $column_order['DEFAULT_COLLATION_NAME'] = array('disp_name' => $strCollation, 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation());
    }
    $column_order['SCHEMA_TABLES'] = array('disp_name' => $strNumTables, 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_TABLE_ROWS'] = array('disp_name' => $strRows, 'format' => 'number', 'footer' => 0);
    $column_order['SCHEMA_DATA_LENGTH'] = array('disp_name' => $strData, 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_INDEX_LENGTH'] = array('disp_name' => $strIndexes, 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_LENGTH'] = array('disp_name' => $strTotalUC, 'format' => 'byte', 'footer' => 0);
    $column_order['SCHEMA_DATA_FREE'] = array('disp_name' => $strOverhead, 'format' => 'byte', 'footer' => 0);
    $_url_params = array('pos' => $pos, 'dbstats' => $dbstats, 'sort_by' => $sort_by, 'sort_order' => $sort_order);
    if ($GLOBALS['cfg']['MaxDbList'] && $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
        // Move to the beginning or to the previous page
        if ($pos > 0) {
            // loic1: patch #474210 from Gosha Sakovich - part 1
            if ($GLOBALS['cfg']['NavigationBarIconic']) {
                $caption1 = '&lt;&lt;';
                $caption2 = ' &lt; ';
 function PMA_getDbCollation($db)
 {
     return PMA_getServerCollation();
 }
    $databases_count = 0;
}


/**
 * Displays the page
 */
if ($databases_count > 0) {
    reset($databases);
    $first_database = current($databases);
    // table col order
    $column_order['DEFAULT_COLLATION_NAME'] = array(
            'disp_name' => $strCollation,
            'description_function' => 'PMA_getCollationDescr',
            'format'    => 'string',
            'footer'    => PMA_getServerCollation(),
        );
    $column_order['SCHEMA_TABLES'] = array(
        'disp_name' => $strNumTables,
        'format'    => 'number',
        'footer'    => 0,
    );
    $column_order['SCHEMA_TABLE_ROWS'] = array(
        'disp_name' => $strRows,
        'format'    => 'number',
        'footer'    => 0,
    );
    $column_order['SCHEMA_DATA_LENGTH'] = array(
        'disp_name' => $strData,
        'format'    => 'byte',
        'footer'    => 0,
 /**
  * Test for PMA_getServerCollation
  *
  * @return void
  * @test
  */
 public function testGetServerCollation()
 {
     $GLOBALS['server'] = 1;
     $GLOBALS['cfg']['DBG']['sql'] = false;
     $this->assertEquals('utf8_general_ci', PMA_getServerCollation());
 }