当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_Table::sGetStatusInfo方法代码示例

本文整理汇总了PHP中PMA_Table::sGetStatusInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Table::sGetStatusInfo方法的具体用法?PHP PMA_Table::sGetStatusInfo怎么用?PHP PMA_Table::sGetStatusInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Table的用法示例。


在下文中一共展示了PMA_Table::sGetStatusInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: count

// end if
$tables_cnt = count($the_tables);
$counter = 0;
foreach ($the_tables as $key => $table) {
    if ($counter + 1 >= $tables_cnt) {
        $breakstyle = '';
    } else {
        $breakstyle = ' style="page-break-after: always;"';
    }
    $counter++;
    echo '<div' . $breakstyle . '>' . "\n";
    echo '<h1>' . htmlspecialchars($table) . '</h1>' . "\n";
    /**
     * Gets table informations
     */
    $showtable = PMA_Table::sGetStatusInfo($db, $table);
    $num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
    $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
    $tbl_is_view = PMA_Table::isView($db, $table);
    /**
     * Gets fields properties
     */
    $columns = PMA_DBI_get_columns($db, $table);
    // We need this to correctly learn if a TIMESTAMP is NOT NULL, since
    // SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL
    // and SHOW CREATE TABLE says NOT NULL (tested
    // in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
    $show_create_table = PMA_DBI_fetch_value('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), 0, 1);
    $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
    // Check if we can use Relations
    // Find which tables are related with the current one and write it in
开发者ID:rizwanaabbas,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_printview.php

示例2: PMA_getHtmlForDisplayTableStats

/**
 * Get HTML snippet for display table statistics
 *
 * @param array   $showtable           full table status info
 * @param integer $table_info_num_rows table info number of rows
 * @param boolean $tbl_is_view         whether table is view or not
 * @param boolean $db_is_system_schema whether db is information schema or not
 * @param string  $tbl_storage_engine  table storage engine
 * @param string  $url_query           url query
 * @param string  $tbl_collation       table collation
 *
 * @return string $html_output
 */
function PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine, $url_query, $tbl_collation)
{
    $html_output = '<div id="tablestatistics">';
    if (empty($showtable)) {
        $showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, true);
    }
    $nonisam = false;
    $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB';
    if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
        $nonisam = true;
    }
    // Gets some sizes
    $mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']);
    // this is to display for example 261.2 MiB instead of 268k KiB
    $max_digits = 3;
    $decimals = 1;
    list($data_size, $data_unit) = PMA_Util::formatByteDown($showtable['Data_length'], $max_digits, $decimals);
    if ($mergetable == false) {
        list($index_size, $index_unit) = PMA_Util::formatByteDown($showtable['Index_length'], $max_digits, $decimals);
    }
    // InnoDB returns a huge value in Data_free, do not use it
    if (!$is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
        list($free_size, $free_unit) = PMA_Util::formatByteDown($showtable['Data_free'], $max_digits, $decimals);
        list($effect_size, $effect_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals);
    } else {
        list($effect_size, $effect_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
    }
    list($tot_size, $tot_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
    if ($table_info_num_rows > 0) {
        list($avg_size, $avg_unit) = PMA_Util::formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
    }
    // Displays them
    $odd_row = false;
    $html_output .= '<fieldset>' . '<legend>' . __('Information') . '</legend>' . '<a id="showusage"></a>';
    if (!$tbl_is_view && !$db_is_system_schema) {
        $html_output .= '<table id="tablespaceusage" class="data">' . '<caption class="tblHeaders">' . __('Space usage') . '</caption>' . '<tbody>';
        $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Data'), $data_size, $data_unit);
        $odd_row = !$odd_row;
        if (isset($index_size)) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Index'), $index_size, $index_unit);
            $odd_row = !$odd_row;
        }
        if (isset($free_size)) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Overhead'), $free_size, $free_unit);
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Effective'), $effect_size, $effect_unit);
            $odd_row = !$odd_row;
        }
        if (isset($tot_size) && $mergetable == false) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Total'), $tot_size, $tot_unit);
            $odd_row = !$odd_row;
        }
        // Optimize link if overhead
        if (isset($free_size) && !PMA_DRIZZLE && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA' || $tbl_storage_engine == 'BDB')) {
            $html_output .= PMA_getHtmlForOptimizeLink($url_query);
        }
        $html_output .= '</tbody>' . '</table>';
    }
    $html_output .= getHtmlForRowStatsTable($showtable, $tbl_collation, $is_innodb, $mergetable, isset($avg_size) ? $avg_size : '', isset($avg_unit) ? $avg_unit : '');
    $html_output .= '</fieldset>' . '</div>';
    return $html_output;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:74,代码来源:structure.lib.php

示例3: getTableHtmlForMultipleQueries

/**
 * Generate table html when SQL statement have multiple queries
 * which return displayable results
 *
 * @param PMA_DisplayResults $displayResultsObject object
 * @param string             $db                   database name
 * @param array              $sql_data             information about SQL statement
 * @param string             $goto                 the URL to go back in case of errors
 * @param string             $pmaThemeImage        path for theme images directory
 * @param string             $text_dir             
 * @param string             $printview            
 * @param string             $url_query            URL query
 * @param array              $disp_mode            the display mode
 *
 * @return string   $table_html   html content
 */
function getTableHtmlForMultipleQueries(
    $displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage,
    $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append
) {
    
    $table_html = '';
        
    $tables_array = PMA_DBI_get_tables($db);
    $databases_array = PMA_DBI_get_databases_full();
    $multi_sql = implode(";", $sql_data['valid_sql']);    
    $querytime_before = array_sum(explode(' ', microtime()));

    // Assignment for variable is not needed since the results are
    // looiping using the connection
    @PMA_DBI_try_multi_query($multi_sql);

    $querytime_after = array_sum(explode(' ', microtime()));
    $querytime = $querytime_after - $querytime_before;        
    $sql_no = 0;

    do {

        $analyzed_sql = array();
        $is_affected = false;
        
        $result = PMA_DBI_store_result();
        $fields_meta = ($result !== false) ? PMA_DBI_get_fields_meta($result) : array();
        $fields_cnt  = count($fields_meta);
        
        // Initialize needed params related to each query in multiquery statement
        if (isset($sql_data['valid_sql'][$sql_no])) {
            
            // 'Use' query can change the database
            if (stripos($sql_data['valid_sql'][$sql_no], "use ")) {
                $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array);
            }
            $parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]);
            $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array);            
            
            $analyzed_sql = PMA_SQP_analyze($parsed_sql);
            $is_select = isset($analyzed_sql[0]['queryflags']['select_from']);        
            $unlim_num_rows = PMA_Table::countRecords($db, $table, $force_exact = true);
            $showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
            $url_query = PMA_generate_common_url($db, $table);
            
            list($is_group, $is_func, $is_count, $is_export, $is_analyse,
                $is_explain, $is_delete, $is_affected, $is_insert, $is_replace,
                $is_show, $is_maint)
                    = PMA_getDisplayPropertyParams(
                        $sql_data['valid_sql'][$sql_no], $is_select
                    );
            
            // Handle remembered sorting order, only for single table query
            if ($GLOBALS['cfg']['RememberSorting']
                && ! ($is_count || $is_export || $is_func || $is_analyse)
                && isset($analyzed_sql[0]['select_expr'])
                && (count($analyzed_sql[0]['select_expr']) == 0)
                && isset($analyzed_sql[0]['queryflags']['select_from'])
                && count($analyzed_sql[0]['table_ref']) == 1
            ) {
                PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]);
            }

            // Do append a "LIMIT" clause?
            if (($_SESSION['tmp_user_values']['max_rows'] != 'all')
                && ! ($is_count || $is_export || $is_func || $is_analyse)
                && isset($analyzed_sql[0]['queryflags']['select_from'])
                && ! isset($analyzed_sql[0]['queryflags']['offset'])
                && empty($analyzed_sql[0]['limit_clause'])
            ) {            
                $sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause(
                    $sql_data['valid_sql'][$sql_no], $analyzed_sql, $sql_limit_to_append
                );            
            }
            
            // Set the needed properties related to executing sql query
            $displayResultsObject->__set('_db', $db);
            $displayResultsObject->__set('_table', $table);
            $displayResultsObject->__set('_goto', $goto);
            
        }
        
        if (! $is_affected) {
            $num_rows = ($result) ? @PMA_DBI_num_rows($result) : 0;
//.........这里部分代码省略.........
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:101,代码来源:sql.php

示例4: PMA_DBI_select_db

// Seems we need to do this in MySQL 5.0.2,
// otherwise error #1046, no database selected
PMA_DBI_select_db($GLOBALS['db']);
/**
 * Holds information about the current table
 *
 * @todo replace this by PMA_Table
 * @global array $GLOBALS['showtable']
 * @name $showtable
 */
$GLOBALS['showtable'] = array();
// PMA_Table::sGetStatusInfo() does caching by default, but here
// we force reading of the current table status
// if $reread_info is true (for example, coming from tbl_operations.php
// and we just changed the table's storage engine)
$GLOBALS['showtable'] = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, isset($reread_info) && $reread_info ? true : false);
// need this test because when we are creating a table, we get 0 rows
// from the SHOW TABLE query
// and we don't want to mess up the $tbl_storage_engine coming from the form
if ($showtable) {
    if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) {
        $tbl_is_view = true;
        $tbl_storage_engine = __('View');
        $show_comment = null;
    } else {
        $tbl_is_view = false;
        $tbl_storage_engine = isset($showtable['Engine']) ? strtoupper($showtable['Engine']) : '';
        // a new comment could be coming from tbl_operations.php
        // and we want to show it in the header
        if (isset($submitcomment) && isset($comment)) {
            $show_comment = $comment;
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_info.inc.php

示例5: PMA_getTableHtmlForMultipleQueries

/**
 * Generate table html when SQL statement have multiple queries
 * which return displayable results
 *
 * @param object $displayResultsObject PMA_DisplayResults object
 * @param string $db                   database name
 * @param array  $sql_data             information about SQL statement
 * @param string $goto                 URL to go back in case of errors
 * @param string $pmaThemeImage        path for theme images  directory
 * @param string $printview            whether printview is enabled
 * @param string $url_query            URL query
 * @param array  $disp_mode            the display mode
 * @param string $sql_limit_to_append  limit clause
 * @param bool   $editable             whether editable or not
 *
 * @return string   $table_html   html content
 */
function PMA_getTableHtmlForMultipleQueries($displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage, $printview, $url_query, $disp_mode, $sql_limit_to_append, $editable)
{
    $table_html = '';
    $tables_array = $GLOBALS['dbi']->getTables($db);
    $databases_array = $GLOBALS['dbi']->getDatabasesFull();
    $multi_sql = implode(";", $sql_data['valid_sql']);
    $querytime_before = array_sum(explode(' ', microtime()));
    // Assignment for variable is not needed since the results are
    // looping using the connection
    @$GLOBALS['dbi']->tryMultiQuery($multi_sql);
    $querytime_after = array_sum(explode(' ', microtime()));
    $querytime = $querytime_after - $querytime_before;
    $sql_no = 0;
    do {
        $analyzed_sql = array();
        $is_affected = false;
        $showtable = array();
        $result = $GLOBALS['dbi']->storeResult();
        $fields_meta = $result !== false ? $GLOBALS['dbi']->getFieldsMeta($result) : array();
        $fields_cnt = count($fields_meta);
        // Initialize needed params related to each query in multiquery statement
        if (isset($sql_data['valid_sql'][$sql_no])) {
            // 'Use' query can change the database
            if (mb_stripos($sql_data['valid_sql'][$sql_no], "use ")) {
                $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array);
            }
            $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array);
            // for the use of the parse_analyze.inc.php
            $sql_query = $sql_data['valid_sql'][$sql_no];
            // Parse and analyze the query
            include 'libraries/parse_analyze.inc.php';
            $unlim_num_rows = PMA_Table::countRecords($db, $table, true);
            $showtable = PMA_Table::sGetStatusInfo($db, $table, null, true);
            $url_query = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
            // Handle remembered sorting order, only for single table query
            if ($GLOBALS['cfg']['RememberSorting'] && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['select_expr']) && count($analyzed_sql[0]['select_expr']) == 0 && isset($analyzed_sql[0]['queryflags']['select_from']) && count($analyzed_sql[0]['table_ref']) == 1) {
                PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]);
            }
            // Do append a "LIMIT" clause?
            if ($_SESSION['tmpval']['max_rows'] != 'all' && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && !isset($analyzed_sql[0]['queryflags']['offset']) && empty($analyzed_sql[0]['limit_clause'])) {
                $sql_limit_to_append = ' LIMIT ' . $_SESSION['tmpval']['pos'] . ', ' . $_SESSION['tmpval']['max_rows'] . " ";
                $sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause($analyzed_sql, $sql_limit_to_append);
            }
            // Set the needed properties related to executing sql query
            $displayResultsObject->__set('db', $db);
            $displayResultsObject->__set('table', $table);
            $displayResultsObject->__set('goto', $goto);
        }
        if (!$is_affected) {
            $num_rows = $result ? @$GLOBALS['dbi']->numRows($result) : 0;
        } elseif (!isset($num_rows)) {
            $num_rows = @$GLOBALS['dbi']->affectedRows();
        }
        if (isset($sql_data['valid_sql'][$sql_no])) {
            $displayResultsObject->__set('sql_query', $sql_data['valid_sql'][$sql_no]);
            $displayResultsObject->setProperties($unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $GLOBALS['text_dir'], $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query, $editable);
        }
        if ($num_rows == 0) {
            continue;
        }
        // With multiple results, operations are limited
        $disp_mode = 'nnnn000000';
        $is_limited_display = true;
        // Collect the tables
        $table_html .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql, $is_limited_display);
        // Free the result to save the memory
        $GLOBALS['dbi']->freeResult($result);
        $sql_no++;
    } while ($GLOBALS['dbi']->moreResults() && $GLOBALS['dbi']->nextResult());
    return $table_html;
}
开发者ID:harryboulderdash,项目名称:PlayGFC,代码行数:88,代码来源:sql.lib.php

示例6: PMA_sendHtmlForTableDropdownList

/**
 * Function to send html for table dropdown list
 *
 * @return void
 */
function PMA_sendHtmlForTableDropdownList()
{
    $response = PMA_Response::getInstance();
    $tables = array();
    $foreign = isset($_REQUEST['foreign']) && $_REQUEST['foreign'] === 'true';
    if ($foreign) {
        $tbl_storage_engine = strtoupper(PMA_Table::sGetStatusInfo($_REQUEST['db'], $_REQUEST['table'], 'Engine'));
    }
    // In Drizzle, 'SHOW TABLE STATUS' will show status only for the tables
    // which are currently in the table cache. Hence we have to use 'SHOW TABLES'
    // and manully retrieve table engine values.
    if ($foreign && !PMA_DRIZZLE) {
        $query = 'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($_REQUEST['foreignDb']);
        $tables_rs = $GLOBALS['dbi']->query($query, null, PMA_DatabaseInterface::QUERY_STORE);
        while ($row = $GLOBALS['dbi']->fetchArray($tables_rs)) {
            if (isset($row['Engine']) && strtoupper($row['Engine']) == $tbl_storage_engine) {
                $tables[] = htmlspecialchars($row['Name']);
            }
        }
    } else {
        $query = 'SHOW TABLES FROM ' . PMA_Util::backquote($_REQUEST['foreignDb']);
        $tables_rs = $GLOBALS['dbi']->query($query, null, PMA_DatabaseInterface::QUERY_STORE);
        while ($row = $GLOBALS['dbi']->fetchArray($tables_rs)) {
            if ($foreign && PMA_DRIZZLE) {
                $engine = strtoupper(PMA_Table::sGetStatusInfo($_REQUEST['foreignDb'], $row[0], 'Engine'));
                if (isset($engine) && $engine == $tbl_storage_engine) {
                    $tables[] = htmlspecialchars($row[0]);
                }
            } else {
                $tables[] = htmlspecialchars($row[0]);
            }
        }
    }
    $response->addJSON('tables', $tables);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:40,代码来源:tbl_relation.lib.php

示例7: dataDictionaryDoc

 public function dataDictionaryDoc($alltables)
 {
     global $db, $pdf, $orientation, $paper;
     // TOC
     $pdf->addpage($GLOBALS['orientation']);
     $pdf->Cell(0, 9, __('Table of contents'), 1, 0, 'C');
     $pdf->Ln(15);
     $i = 1;
     foreach ($alltables as $table) {
         $pdf->PMA_links['doc'][$table]['-'] = $pdf->AddLink();
         $pdf->SetX(10);
         // $pdf->Ln(1);
         $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['doc'][$table]['-']);
         $pdf->SetX(10);
         $pdf->Cell(0, 6, $i . ' ' . $table, 0, 1, 'L', 0, $pdf->PMA_links['doc'][$table]['-']);
         // $pdf->Ln(1);
         $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
         while ($row = PMA_DBI_fetch_assoc($result)) {
             $pdf->SetX(20);
             $field_name = $row['Field'];
             $pdf->PMA_links['doc'][$table][$field_name] = $pdf->AddLink();
             // $pdf->Cell(0, 6, $field_name,0,1,'L',0, $pdf->PMA_links['doc'][$table][$field_name]);
         }
         $lasttable = $table;
         $i++;
     }
     $pdf->PMA_links['RT']['-'] = $pdf->AddLink();
     $pdf->SetX(10);
     $pdf->Cell(0, 6, __('Page number:') . ' {' . sprintf("%02d", $i + 1) . '}', 0, 0, 'R', 0, $pdf->PMA_links['RT']['-']);
     $pdf->SetX(10);
     $pdf->Cell(0, 6, $i . ' ' . __('Relational schema'), 0, 1, 'L', 0, $pdf->PMA_links['RT']['-']);
     $z = 0;
     foreach ($alltables as $table) {
         $z++;
         $pdf->SetAutoPageBreak(true, 15);
         $pdf->addpage($GLOBALS['orientation']);
         $pdf->Bookmark($table);
         $pdf->SetAlias('{' . sprintf("%02d", $z) . '}', $pdf->PageNo());
         $pdf->PMA_links['RT'][$table]['-'] = $pdf->AddLink();
         $pdf->SetLink($pdf->PMA_links['doc'][$table]['-'], -1);
         $pdf->SetFont($this->_ff, 'B', 18);
         $pdf->Cell(0, 8, $z . ' ' . $table, 1, 1, 'C', 0, $pdf->PMA_links['RT'][$table]['-']);
         $pdf->SetFont($this->_ff, '', 8);
         $pdf->ln();
         $cfgRelation = PMA_getRelationsParam();
         $comments = PMA_getComments($db, $table);
         if ($cfgRelation['mimework']) {
             $mime_map = PMA_getMIME($db, $table, true);
         }
         /**
          * Gets table informations
          */
         $showtable = PMA_Table::sGetStatusInfo($db, $table);
         $num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
         $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
         $create_time = isset($showtable['Create_time']) ? PMA_localisedDate(strtotime($showtable['Create_time'])) : '';
         $update_time = isset($showtable['Update_time']) ? PMA_localisedDate(strtotime($showtable['Update_time'])) : '';
         $check_time = isset($showtable['Check_time']) ? PMA_localisedDate(strtotime($showtable['Check_time'])) : '';
         /**
          * Gets table keys and retains them
          */
         $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
         $primary = '';
         $indexes = array();
         $lastIndex = '';
         $indexes_info = array();
         $indexes_data = array();
         $pk_array = array();
         // will be use to emphasis prim. keys in the table
         // view
         while ($row = PMA_DBI_fetch_assoc($result)) {
             // Backups the list of primary keys
             if ($row['Key_name'] == 'PRIMARY') {
                 $primary .= $row['Column_name'] . ', ';
                 $pk_array[$row['Column_name']] = 1;
             }
             // Retains keys informations
             if ($row['Key_name'] != $lastIndex) {
                 $indexes[] = $row['Key_name'];
                 $lastIndex = $row['Key_name'];
             }
             $indexes_info[$row['Key_name']]['Sequences'][] = $row['Seq_in_index'];
             $indexes_info[$row['Key_name']]['Non_unique'] = $row['Non_unique'];
             if (isset($row['Cardinality'])) {
                 $indexes_info[$row['Key_name']]['Cardinality'] = $row['Cardinality'];
             }
             // I don't know what does following column mean....
             // $indexes_info[$row['Key_name']]['Packed']          = $row['Packed'];
             $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'])) {
                 $indexes_data[$row['Key_name']][$row['Seq_in_index']]['Sub_part'] = $row['Sub_part'];
             }
         }
         // end while
         if ($result) {
             PMA_DBI_free_result($result);
         }
         /**
          * Gets fields properties
//.........这里部分代码省略.........
开发者ID:bugyak,项目名称:phporadmin,代码行数:101,代码来源:Pdf_Relation_Schema.class.php

示例8: PMA_showMessage

/**
 * displays the message and the query
 * usually the message is the result of the query executed
 *
 * @param string  $message   the message to display
 * @param string  $sql_query the query to display
 * @param string  $type      the type (level) of the message
 * @param boolean $is_view   is this a message after a VIEW operation?
 *
 * @return  string
 *
 * @access  public
 */
function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view = false)
{
    /*
     * PMA_ajaxResponse uses this function to collect the string of HTML generated
     * for showing the message.  Use output buffering to collect it and return it
     * in a string.  In some special cases on sql.php, buffering has to be disabled
     * and hence we check with $GLOBALS['buffer_message']
     */
    if ($GLOBALS['is_ajax_request'] == true && !isset($GLOBALS['buffer_message'])) {
        ob_start();
    }
    global $cfg;
    if (null === $sql_query) {
        if (!empty($GLOBALS['display_query'])) {
            $sql_query = $GLOBALS['display_query'];
        } elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
            $sql_query = $GLOBALS['unparsed_sql'];
        } elseif (!empty($GLOBALS['sql_query'])) {
            $sql_query = $GLOBALS['sql_query'];
        } else {
            $sql_query = '';
        }
    }
    if (isset($GLOBALS['using_bookmark_message'])) {
        $GLOBALS['using_bookmark_message']->display();
        unset($GLOBALS['using_bookmark_message']);
    }
    // Corrects the tooltip text via JS if required
    // @todo this is REALLY the wrong place to do this - very unexpected here
    if (!$is_view && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
        $tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
        $uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
        echo "\n";
        echo '<script type="text/javascript">' . "\n";
        echo '//<![CDATA[' . "\n";
        echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
        echo '//]]>' . "\n";
        echo '</script>' . "\n";
    }
    // end if ... elseif
    // Checks if the table needs to be repaired after a TRUNCATE query.
    // @todo what about $GLOBALS['display_query']???
    // @todo this is REALLY the wrong place to do this - very unexpected here
    if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
        if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024 && !PMA_DRIZZLE) {
            PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
        }
    }
    unset($tbl_status);
    // In an Ajax request, $GLOBALS['cell_align_left'] may not be defined. Hence,
    // check for it's presence before using it
    echo '<div id="result_query" align="' . (isset($GLOBALS['cell_align_left']) ? $GLOBALS['cell_align_left'] : '') . '">' . "\n";
    if ($message instanceof PMA_Message) {
        if (isset($GLOBALS['special_message'])) {
            $message->addMessage($GLOBALS['special_message']);
            unset($GLOBALS['special_message']);
        }
        $message->display();
        $type = $message->getLevel();
    } else {
        echo '<div class="' . $type . '">';
        echo PMA_sanitize($message);
        if (isset($GLOBALS['special_message'])) {
            echo PMA_sanitize($GLOBALS['special_message']);
            unset($GLOBALS['special_message']);
        }
        echo '</div>';
    }
    if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
        // Html format the query to be displayed
        // If we want to show some sql code it is easiest to create it here
        /* SQL-Parser-Analyzer */
        if (!empty($GLOBALS['show_as_php'])) {
            $new_line = '\\n"<br />' . "\n" . '&nbsp;&nbsp;&nbsp;&nbsp;. "';
            $query_base = htmlspecialchars(addslashes($sql_query));
            $query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
        } else {
            $query_base = $sql_query;
        }
        $query_too_big = false;
        if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
            // when the query is large (for example an INSERT of binary
            // data), the parser chokes; so avoid parsing the query
            $query_too_big = true;
            $shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
        } elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
            // (here, use "! empty" because when deleting a bookmark,
//.........这里部分代码省略.........
开发者ID:AmberWish,项目名称:laba_web,代码行数:101,代码来源:common.lib.php

示例9: __

            /**
             * if $submit_mult == 'change', execution will have stopped
             * at this point
             */
            if (empty($message)) {
                $message = PMA_Message::success();
            }
        }
    } else {
        $response = PMA_Response::getInstance();
        $response->isSuccess(false);
        $response->addJSON('message', __('No column selected.'));
    }
}
// display secondary level tabs if necessary
$engine = PMA_Table::sGetStatusInfo($db, $table, 'ENGINE');
$response->addHTML(PMA_getStructureSecondaryTabs($engine));
$response->addHTML('<div id="structure_content">');
/**
 * Modifications have been submitted -> updates the table
 */
if (isset($_REQUEST['do_save_data'])) {
    $regenerate = PMA_updateColumns($db, $table);
    if ($regenerate) {
        // This happens when updating failed
        // @todo: do something appropriate
    } else {
        // continue to show the table's structure
        unset($_REQUEST['selected']);
    }
}
开发者ID:BrunoChauvet,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_structure.php

示例10: _getTableTabs

 /**
  * Returns the table tabs as an array
  *
  * @return array Data for generating table tabs
  */
 private function _getTableTabs()
 {
     $db_is_information_schema = PMA_is_system_schema($this->_db);
     $tbl_is_view = PMA_Table::isView($this->_db, $this->_table);
     $table_status = PMA_Table::sGetStatusInfo($this->_db, $this->_table);
     $table_info_num_rows = 0;
     if (isset($table_status['Rows'])) {
         $table_info_num_rows = $table_status['Rows'];
     }
     $tabs = array();
     $tabs['browse']['icon'] = 'b_browse.png';
     $tabs['browse']['text'] = __('Browse');
     $tabs['browse']['link'] = 'sql.php';
     $tabs['browse']['args']['pos'] = 0;
     $tabs['structure']['icon'] = 'b_props.png';
     $tabs['structure']['link'] = 'tbl_structure.php';
     $tabs['structure']['text'] = __('Structure');
     $tabs['sql']['icon'] = 'b_sql.png';
     $tabs['sql']['link'] = 'tbl_sql.php';
     $tabs['sql']['text'] = __('SQL');
     $tabs['search']['icon'] = 'b_search.png';
     $tabs['search']['text'] = __('Search');
     $tabs['search']['link'] = 'tbl_select.php';
     if (!$db_is_information_schema) {
         $tabs['insert']['icon'] = 'b_insrow.png';
         $tabs['insert']['link'] = 'tbl_change.php';
         $tabs['insert']['text'] = __('Insert');
     }
     $tabs['export']['icon'] = 'b_tblexport.png';
     $tabs['export']['link'] = 'tbl_export.php';
     $tabs['export']['args']['single_table'] = 'true';
     $tabs['export']['text'] = __('Export');
     /**
      * Don't display "Import" and "Operations"
      * for views and information_schema
      */
     if (!$tbl_is_view && !$db_is_information_schema) {
         $tabs['import']['icon'] = 'b_tblimport.png';
         $tabs['import']['link'] = 'tbl_import.php';
         $tabs['import']['text'] = __('Import');
         $tabs['operation']['icon'] = 'b_tblops.png';
         $tabs['operation']['link'] = 'tbl_operations.php';
         $tabs['operation']['text'] = __('Operations');
     }
     if (PMA_Tracker::isActive()) {
         $tabs['tracking']['icon'] = 'eye.png';
         $tabs['tracking']['text'] = __('Tracking');
         $tabs['tracking']['link'] = 'tbl_tracking.php';
     }
     if (!$db_is_information_schema && !PMA_DRIZZLE && PMA_currentUserHasPrivilege('TRIGGER', $this->_db, $this->_table) && !$tbl_is_view) {
         $tabs['triggers']['link'] = 'tbl_triggers.php';
         $tabs['triggers']['text'] = __('Triggers');
         $tabs['triggers']['icon'] = 'b_triggers.png';
     }
     /**
      * Views support a limited number of operations
      */
     if ($tbl_is_view && !$db_is_information_schema) {
         $tabs['operation']['icon'] = 'b_tblops.png';
         $tabs['operation']['link'] = 'view_operations.php';
         $tabs['operation']['text'] = __('Operations');
     }
     if ($table_info_num_rows == 0 && !$tbl_is_view) {
         $tabs['browse']['warning'] = __('Table seems to be empty!');
         $tabs['search']['warning'] = __('Table seems to be empty!');
     }
     return $tabs;
 }
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:73,代码来源:Menu.class.php

示例11: PMA_pluginGetOptions

<div id="div_container_sub_exportoptions">
<?php 
echo PMA_pluginGetOptions('Export', $export_list);
?>
</div>
</td></tr></table>

<script type="text/javascript">
//<![CDATA[
    init_options();
//]]>
</script>

<?php 
$is_merge = !PMA_Table::isView($db, $table) && strcasecmp(PMA_Table::sGetStatusInfo($db, $table, 'Engine'), 'MRG_MYISAM') == 0;
if (strlen($table) && !isset($num_tables) && !$is_merge) {
    ?>
    <div class="formelementrow">
        <?php 
    echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
    echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table)) . '" onfocus="this.select()" />', '<input type="text" name="limit_from" value="0" size="5"' . ' onfocus="this.select()" /> ');
    echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
    echo '<label for="radio_allrows_1">' . $strDumpAllRows . '</label>';
    ?>
    </div>
<?php 
}
?>
</fieldset>
开发者ID:kebyn,项目名称:apache_workspace,代码行数:29,代码来源:display_export.lib.php

示例12: isMerge

 /**
  * Checks if this is a merge table
  *
  * If the ENGINE of the table is MERGE or MRG_MYISAM (alias), this is a merge table.
  *
  * @param   string   the database name
  * @param   string   the table name
  * @return  boolean  true if it is a merge table
  * @access  public
  */
 public static function isMerge($db = null, $table = null)
 {
     // if called static, with parameters
     if (!empty($db) && !empty($table)) {
         $engine = PMA_Table::sGetStatusInfo($db, $table, 'ENGINE', null, true);
     } else {
         if (!empty($this)) {
             $engine = $this->get('ENGINE');
         }
     }
     return !empty($engine) && (strtoupper($engine) == 'MERGE' || strtoupper($engine) == 'MRG_MYISAM');
 }
开发者ID:bugyak,项目名称:phporadmin,代码行数:22,代码来源:Table.class.php

示例13: PMA_displayTableHeaders


//.........这里部分代码省略.........
                    } else {
                        $unsorted_sql_query_first_part = $unsorted_sql_query;
                        $unsorted_sql_query_second_part = '';
                    }
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $asc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Ascending') . ')</option>';
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $desc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Descending') . ')</option>';
                }
                echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"') . '>' . __('None') . '</option>';
                echo '</select>' . "\n";
                echo '<noscript><input type="submit" value="' . __('Go') . '" /></noscript>';
                echo '</form>' . "\n";
            }
        }
    }
    // Output data needed for grid editing
    echo '<input id="save_cells_at_once" type="hidden" value="' . $GLOBALS['cfg']['SaveCellsAtOnce'] . '" />';
    echo '<div class="common_hidden_inputs">';
    echo PMA_generate_common_hidden_inputs($db, $table);
    echo '</div>';
    // Output data needed for column reordering and show/hide column
    if (PMA_isSelect()) {
        // generate the column order, if it is set
        $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
        $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
        if ($col_order) {
            echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
        }
        $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB);
        if ($col_visib) {
            echo '<input id="col_visib" type="hidden" value="' . implode(',', $col_visib) . '" />';
        }
        // generate table create time
        if (!PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) {
            echo '<input id="table_create_time" type="hidden" value="' . PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />';
        }
    }
    $vertical_display['emptypre'] = 0;
    $vertical_display['emptyafter'] = 0;
    $vertical_display['textbtn'] = '';
    // Display options (if we are not in print view)
    if (!(isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) {
        echo '<form method="post" action="sql.php" name="displayOptionsForm" id="displayOptionsForm"';
        if ($GLOBALS['cfg']['AjaxEnable']) {
            echo ' class="ajax" ';
        }
        echo '>';
        $url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'display_options_form' => 1);
        echo PMA_generate_common_hidden_inputs($url_params);
        echo '<br />';
        PMA_generate_slider_effect('displayoptions', __('Options'));
        echo '<fieldset>';
        echo '<div class="formelement">';
        $choices = array('P' => __('Partial texts'), 'F' => __('Full texts'));
        PMA_display_html_radio('display_text', $choices, $_SESSION['tmp_user_values']['display_text']);
        echo '</div>';
        // prepare full/partial text button or link
        $url_params_full_text = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'full_text_button' => 1);
        if ($_SESSION['tmp_user_values']['display_text'] == 'F') {
            // currently in fulltext mode so show the opposite link
            $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_partialtext.png';
            $tmp_txt = __('Partial texts');
            $url_params_full_text['display_text'] = 'P';
        } else {
            $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_fulltext.png';
            $tmp_txt = __('Full texts');
            $url_params_full_text['display_text'] = 'F';
开发者ID:GStepOne,项目名称:CI,代码行数:67,代码来源:display_tbl.lib.php

示例14: PMA_showMessage

/**
 * displays the message and the query
 * usually the message is the result of the query executed
 *
 * @param   string  $message    the message to display
 * @param   string  $sql_query  the query to display
 * @param   string  $type       the type (level) of the message
 * @global  array   the configuration array
 * @uses    $cfg
 * @access  public
 */
function PMA_showMessage($message, $sql_query = null, $type = 'notice')
{
    global $cfg;
    if (null === $sql_query) {
        if (!empty($GLOBALS['display_query'])) {
            $sql_query = $GLOBALS['display_query'];
        } elseif ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {
            $sql_query = $GLOBALS['unparsed_sql'];
        } elseif (!empty($GLOBALS['sql_query'])) {
            $sql_query = $GLOBALS['sql_query'];
        } else {
            $sql_query = '';
        }
    }
    // Corrects the tooltip text via JS if required
    // @todo this is REALLY the wrong place to do this - very unexpected here
    if (strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {
        $tooltip = PMA_Table::sGetToolTip($GLOBALS['db'], $GLOBALS['table']);
        $uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);
        echo "\n";
        echo '<script type="text/javascript">' . "\n";
        echo '//<![CDATA[' . "\n";
        echo "if (window.parent.updateTableTitle) window.parent.updateTableTitle('" . $uni_tbl . "', '" . PMA_jsFormat($tooltip, false) . "');" . "\n";
        echo '//]]>' . "\n";
        echo '</script>' . "\n";
    }
    // end if ... elseif
    // Checks if the table needs to be repaired after a TRUNCATE query.
    // @todo what about $GLOBALS['display_query']???
    // @todo this is REALLY the wrong place to do this - very unexpected here
    if (strlen($GLOBALS['table']) && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {
        if (PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Index_length') > 1024) {
            PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));
        }
    }
    unset($tbl_status);
    echo '<div align="' . $GLOBALS['cell_align_left'] . '">' . "\n";
    if ($message instanceof PMA_Message) {
        if (isset($GLOBALS['special_message'])) {
            $message->addMessage($GLOBALS['special_message']);
            unset($GLOBALS['special_message']);
        }
        $message->display();
        $type = $message->getLevel();
    } else {
        echo '<div class="' . $type . '">';
        echo PMA_sanitize($message);
        if (isset($GLOBALS['special_message'])) {
            echo PMA_sanitize($GLOBALS['special_message']);
            unset($GLOBALS['special_message']);
        }
        echo '</div>';
    }
    if ($cfg['ShowSQL'] == true && !empty($sql_query)) {
        // Html format the query to be displayed
        // If we want to show some sql code it is easiest to create it here
        /* SQL-Parser-Analyzer */
        if (!empty($GLOBALS['show_as_php'])) {
            $new_line = '\\n"<br />' . "\n" . '&nbsp;&nbsp;&nbsp;&nbsp;. "';
            $query_base = htmlspecialchars(addslashes($sql_query));
            $query_base = preg_replace('/((\\015\\012)|(\\015)|(\\012))/', $new_line, $query_base);
        } else {
            $query_base = $sql_query;
        }
        $query_too_big = false;
        if (strlen($query_base) > $cfg['MaxCharactersInDisplayedSQL']) {
            // when the query is large (for example an INSERT of binary
            // data), the parser chokes; so avoid parsing the query
            $query_too_big = true;
            $shortened_query_base = nl2br(htmlspecialchars(substr($sql_query, 0, $cfg['MaxCharactersInDisplayedSQL']) . '[...]'));
        } elseif (!empty($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {
            // (here, use "! empty" because when deleting a bookmark,
            // $GLOBALS['parsed_sql'] is set but empty
            $parsed_sql = $GLOBALS['parsed_sql'];
        } else {
            // Parse SQL if needed
            $parsed_sql = PMA_SQP_parse($query_base);
        }
        // Analyze it
        if (isset($parsed_sql)) {
            $analyzed_display_query = PMA_SQP_analyze($parsed_sql);
            // Here we append the LIMIT added for navigation, to
            // enable its display. Adding it higher in the code
            // to $sql_query would create a problem when
            // using the Refresh or Edit links.
            // Only append it on SELECTs.
            /**
             * @todo what would be the best to do when someone hits Refresh:
             * use the current LIMITs ?
//.........这里部分代码省略.........
开发者ID:kebyn,项目名称:apache_workspace,代码行数:101,代码来源:common.lib.php

示例15: PMA_generate_slider_effect

</fieldset>
</form>
<br />
    <?php 
}
PMA_generate_slider_effect('tablestatistics', $strDetails);
/**
 * Displays Space usage and row statistics
 */
// BEGIN - Calc Table Space - staybyte - 9 June 2001
// loic1, 22 feb. 2002: updated with patch from
//                      Joshua Nye <josh at boxcarmedia.com> to get valid
//                      statistics whatever is the table type
if ($cfg['ShowStats']) {
    if (empty($showtable)) {
        $showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, true);
    }
    $nonisam = false;
    $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB';
    if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
        $nonisam = true;
    }
    // Gets some sizes
    $mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']);
    // this is to display for example 261.2 MiB instead of 268k KiB
    $max_digits = 5;
    $decimals = 1;
    list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length'], $max_digits, $decimals);
    if ($mergetable == false) {
        list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length'], $max_digits, $decimals);
    }
开发者ID:nesthub,项目名称:php_jannus,代码行数:31,代码来源:tbl_structure.php


注:本文中的PMA_Table::sGetStatusInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。