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


PHP PMA_countRecords函数代码示例

本文整理汇总了PHP中PMA_countRecords函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_countRecords函数的具体用法?PHP PMA_countRecords怎么用?PHP PMA_countRecords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: isset

        $tbl_type = $GLOBALS['strView'];
        $show_comment = null;
    } else {
        $tbl_is_view = false;
        $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
        // a new comment could be coming from tbl_properties_operations.php
        // and we want to show it in the header
        if (isset($submitcomment) && isset($comment)) {
            $show_comment = $comment;
        } else {
            $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
        }
    }
    $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
    if (null === $showtable['Rows']) {
        $showtable['Rows'] = PMA_countRecords($GLOBALS['db'], $showtable['Name'], true, true);
    }
    $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
    $auto_increment = isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '';
    $create_options = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
    // export create options by its name as variables into gloabel namespace
    // f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
    foreach ($create_options as $each_create_option) {
        $each_create_option = explode('=', $each_create_option);
        if (isset($each_create_option[1])) {
            ${$each_create_option}[0] = $each_create_option[1];
        }
    }
    unset($create_options, $each_create_option);
}
// end if
开发者ID:hoogle,项目名称:ttt,代码行数:31,代码来源:tbl_properties_table_info.inc.php

示例2: PMA_setDisplayMode


//.........这里部分代码省略.........
            $do_display['del_lnk'] = 'nn';
            // no delete link
            $do_display['sort_lnk'] = (string) '0';
            $do_display['nav_bar'] = (string) '0';
            $do_display['ins_row'] = (string) '0';
            $do_display['bkm_form'] = (string) '0';
            $do_display['text_btn'] = (string) '0';
            $do_display['pview_lnk'] = (string) '0';
        } else {
            if ($GLOBALS['is_count'] || $GLOBALS['is_analyse'] || $GLOBALS['is_maint'] || $GLOBALS['is_explain']) {
                $do_display['edit_lnk'] = 'nn';
                // no edit link
                $do_display['del_lnk'] = 'nn';
                // no delete link
                $do_display['sort_lnk'] = (string) '0';
                $do_display['nav_bar'] = (string) '0';
                $do_display['ins_row'] = (string) '0';
                $do_display['bkm_form'] = (string) '1';
                if ($GLOBALS['is_analyse']) {
                    $do_display['text_btn'] = (string) '1';
                } else {
                    $do_display['text_btn'] = (string) '0';
                }
                $do_display['pview_lnk'] = (string) '1';
            } else {
                if ($GLOBALS['is_show']) {
                    // 2.2.1 TODO : defines edit/delete links depending on show statement
                    $tmp = preg_match('@^SHOW[[:space:]]+(VARIABLES|(FULL[[:space:]]+)?PROCESSLIST|STATUS|TABLE|GRANTS|CREATE|LOGS|DATABASES|FIELDS)@i', $GLOBALS['sql_query'], $which);
                    if (isset($which[1]) && strpos(' ' . strtoupper($which[1]), 'PROCESSLIST') > 0) {
                        $do_display['edit_lnk'] = 'nn';
                        // no edit link
                        $do_display['del_lnk'] = 'kp';
                        // "kill process" type edit link
                    } else {
                        // Default case -> no links
                        $do_display['edit_lnk'] = 'nn';
                        // no edit link
                        $do_display['del_lnk'] = 'nn';
                        // no delete link
                    }
                    // 2.2.2 Other settings
                    $do_display['sort_lnk'] = (string) '0';
                    $do_display['nav_bar'] = (string) '0';
                    $do_display['ins_row'] = (string) '0';
                    $do_display['bkm_form'] = (string) '1';
                    $do_display['text_btn'] = (string) '1';
                    $do_display['pview_lnk'] = (string) '1';
                } else {
                    $prev_table = $fields_meta[0]->table;
                    $do_display['text_btn'] = (string) '1';
                    for ($i = 0; $i < $GLOBALS['fields_cnt']; $i++) {
                        $is_link = $do_display['edit_lnk'] != 'nn' || $do_display['del_lnk'] != 'nn' || $do_display['sort_lnk'] != '0' || $do_display['ins_row'] != '0';
                        // 2.3.2 Displays edit/delete/sort/insert links?
                        if ($is_link && ($fields_meta[$i]->table == '' || $fields_meta[$i]->table != $prev_table)) {
                            $do_display['edit_lnk'] = 'nn';
                            // don't display links
                            $do_display['del_lnk'] = 'nn';
                            // TODO: May be problematic with same fields names in
                            //       two joined table.
                            // $do_display['sort_lnk'] = (string) '0';
                            $do_display['ins_row'] = (string) '0';
                            if ($do_display['text_btn'] == '1') {
                                break;
                            }
                        }
                        // end if (2.3.2)
                        // 2.3.3 Always display print view link
                        $do_display['pview_lnk'] = (string) '1';
                        $prev_table = $fields_meta[$i]->table;
                    }
                    // end for
                }
            }
        }
        // end if..elseif...else (2.1 -> 2.3)
    }
    // end if (2)
    // 3. Gets the total number of rows if it is unknown
    if (isset($unlim_num_rows) && $unlim_num_rows != '') {
        $the_total = $unlim_num_rows;
    } else {
        if (($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') && (!empty($db) && !empty($table))) {
            $the_total = PMA_countRecords($db, $table, TRUE);
        }
    }
    // 4. If navigation bar or sorting fields names urls should be
    //    displayed but there is only one row, change these settings to
    //    false
    if ($do_display['nav_bar'] == '1' || $do_display['sort_lnk'] == '1') {
        if (isset($unlim_num_rows) && $unlim_num_rows < 2) {
            // garvin: force display of navbar for vertical/horizontal display-choice.
            // $do_display['nav_bar']  = (string) '0';
            $do_display['sort_lnk'] = (string) '0';
        }
    }
    // end if (3)
    // 5. Updates the synthetic var
    $the_disp_mode = join('', $do_display);
    return $do_display;
}
开发者ID:BackupTheBerlios,项目名称:smileinstaller,代码行数:101,代码来源:display_tbl.lib.php

示例3: PMA_countRecords

 */
// lem9: we always show the foreign field in the drop-down; if a display
// field is defined, we show it besides the foreign field
$foreign_link = false;
if ($foreigners && isset($foreigners[$field])) {
    $foreigner = $foreigners[$field];
    $foreign_db = $foreigner['foreign_db'];
    $foreign_table = $foreigner['foreign_table'];
    $foreign_field = $foreigner['foreign_field'];
    // Count number of rows in the foreign table. Currently we do
    // not use a drop-down if more than 200 rows in the foreign table,
    // for speed reasons and because we need a better interface for this.
    //
    // We could also do the SELECT anyway, with a LIMIT, and ensure that
    // the current value of the field is one of the choices.
    $the_total = PMA_countRecords($foreign_db, $foreign_table, TRUE);
    if (isset($override_total) && $override_total == true || $the_total < 200) {
        // foreign_display can be FALSE if no display field defined:
        $foreign_display = PMA_getDisplayField($foreign_db, $foreign_table);
        $dispsql = 'SELECT ' . PMA_backquote($foreign_field) . ($foreign_display == FALSE ? '' : ', ' . PMA_backquote($foreign_display)) . ' FROM ' . PMA_backquote($foreign_db) . '.' . PMA_backquote($foreign_table) . ($foreign_display == FALSE ? '' : ' ORDER BY ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($foreign_display)) . (isset($foreign_limit) ? $foreign_limit : '');
        $disp = PMA_DBI_query($dispsql);
        if ($disp) {
            // garvin: If a resultset has been created, pre-cache it in the $disp_row array
            // This helps us from not needing to use mysql_data_seek by accessing a pre-cached
            // PHP array. Usually those resultsets are not that big, so a performance hit should
            // not be expected.
            $disp_row = array();
            while ($single_disp_row = @PMA_DBI_fetch_assoc($disp)) {
                $disp_row[] = $single_disp_row;
            }
            @PMA_DBI_free_result($disp);
开发者ID:alexhava,项目名称:elixirjuice,代码行数:31,代码来源:get_foreign.lib.php

示例4: htmlspecialchars

<tr>
    <td bgcolor="<?php 
            echo $bgcolor;
            ?>
" nowrap="nowrap">
        <b><?php 
            echo htmlspecialchars($tables[$i]);
            ?>
&nbsp;</b>
    </td>
    <td align="right" bgcolor="<?php 
            echo $bgcolor;
            ?>
" nowrap="nowrap">
        &nbsp;<?php 
            PMA_countRecords($db, $tables[$i]);
            ?>
    </td>
</tr>
        <?php 
            $i++;
        }
        // end while
        echo "\n";
        ?>
</table>
    <?php 
    }
}
// end if
/**
开发者ID:SalokineTerata,项目名称:intranet,代码行数:31,代码来源:db_printview.php

示例5: show_checked_option

                show_checked_option();
            //-->
            </script>
        </td>
    </tr>
<?php 
if (isset($table) && !empty($table) && !isset($num_tables)) {
    ?>
    <tr>
        <td colspan="3" align="center">
          <div style="background-color: <?php 
    echo $cfg['BgcolorOne'];
    ?>
; padding: 3px; margin: 1px;">
           <b><?php 
    echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_countRecords($db, $table, TRUE)) . '" class="textfield" style="vertical-align: middle" onfocus="this.select()" style="vertical-align: middle; text-align: center;" />', '<input type="text" name="limit_from" value="0" size="5" class="textfield" style="vertical-align: middle" onfocus="this.select()" style="vertical-align: middle; text-align: center;" />') . "\n";
    ?>
</b>
          </div>
        </td>
    </tr>
<?php 
}
?>

    <tr>
        <!-- Export to screen or to file -->
        <td colspan="3">
        <table width="100%" border="0" cellpadding="3" cellspacing="1">
        <tr>
            <th align="left">
开发者ID:mike503,项目名称:phpmyadmin,代码行数:31,代码来源:display_export.lib.php

示例6: foreach

         } else {
             $col_cand = $sg;
             // None of the candidates where in a where-clause
         }
     }
     // If our array of candidates has more than one member we'll just
     // find the smallest table.
     // Of course the actual query would be faster if we check for
     // the Criteria which gives the smallest result set in its table,
     // but it would take too much time to check this
     if (count($col_cand) > 1) {
         // Of course we only want to check each table once
         $checked_tables = $col_cand;
         foreach ($col_cand as $tab) {
             if ($checked_tables[$tab] != 1) {
                 $tsize[$tab] = PMA_countRecords($db, $tab, true, false);
                 $checked_tables[$tab] = 1;
             }
             $csize[$tab] = $tsize[$tab];
         }
         asort($csize);
         reset($csize);
         $master = key($csize);
         // Smallest
     } else {
         reset($col_cand);
         $master = current($col_cand);
         // Only one single candidate
     }
 }
 // end if (exactly one where clause)
开发者ID:hoogle,项目名称:ttt,代码行数:31,代码来源:db_details_qbe.php

示例7: PMA_countRecords

?>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    &nbsp;<?php 
echo $strStartingRecord;
?>
&nbsp;
                    <input type="text" name="limit_from" value="0" size="5" class="textfield" style="vertical-align: middle" onfocus="this.select()" />
                    &nbsp;--&nbsp;<?php 
echo $strNbRecords;
?>
&nbsp;
                    <input type="text" name="limit_to" size="5" value="<?php 
echo PMA_countRecords($db, $table, TRUE);
?>
" class="textfield" style="vertical-align: middle" onfocus="this.select()" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="<?php 
echo $strGo;
?>
" />
                </td>
            </tr>
            </table>
        </form>
    </li>
开发者ID:SalokineTerata,项目名称:intranet,代码行数:31,代码来源:tbl_properties.php

示例8: urlencode

            echo urlencode('DELETE FROM ' . PMA_backquote($table));
            ?>
&amp;zero_rows=<?php 
            echo urlencode(sprintf($strTableHasBeenEmptied, $table_name));
            ?>
"><?php 
            echo $strEmpty;
            ?>
</a>
    </td>
    <td align="right" bgcolor="<?php 
            echo $bgcolor;
            ?>
">
        <?php 
            PMA_countRecords($db, $table);
            echo "\n";
            ?>
    </td>
</tr>
        <?php 
            $i++;
        }
        // end while
        echo "\n";
        // Check all tables url
        $checkall_url = 'db_details.php' . '?lang=' . $lang . '&amp;server=' . $server . '&amp;db=' . urlencode($db);
        ?>
<tr>
    <td colspan="9">
        <img src="./images/arrow_<?php 
开发者ID:SalokineTerata,项目名称:intranet,代码行数:31,代码来源:db_details.php

示例9: PMA_generate_common_hidden_inputs

<form method="post" action="db_details_structure.php" name="tablesForm" id="tablesForm">
<?php 
echo PMA_generate_common_hidden_inputs($db);
PMA_TableHeader($db_is_information_schema);
$i = $sum_entries = 0;
$sum_size = (double) 0;
$overhead_size = (double) 0;
$overhead_check = '';
$checked = !empty($checkall) ? ' checked="checked"' : '';
$num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0;
$row_count = 0;
$hidden_fields = array();
$odd_row = true;
foreach ($tables as $keyname => $each_table) {
    if ($each_table['TABLE_ROWS'] === NULL || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {
        $each_table['TABLE_ROWS'] = PMA_countRecords($db, $each_table['TABLE_NAME'], $return = true, $force_exact = true);
    }
    $table_encoded = urlencode($each_table['TABLE_NAME']);
    // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"
    $table_is_view = $each_table['TABLE_TYPE'] === 'VIEW' || $each_table['TABLE_TYPE'] === 'SYSTEM VIEW';
    $alias = !empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']]) ? htmlspecialchars($tooltip_aliasname[$each_table['TABLE_NAME']]) : htmlspecialchars($each_table['TABLE_NAME']);
    $truename = !empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']]) ? htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']]) : htmlspecialchars($each_table['TABLE_NAME']);
    // Sets parameters for links
    $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
    $i++;
    $row_count++;
    if ($table_is_view) {
        $hidden_fields[] = '<input type="hidden" name="views[]" value="' . $table_encoded . '" />';
    }
    if ($each_table['TABLE_ROWS'] > 0) {
        $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($each_table['TABLE_NAME']) . '\'', 'label');
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:db_details_structure.php

示例10: PMA_countRecords

 if (empty($sql_limit_to_append)) {
     $unlim_num_rows = $num_rows;
     // if we did not append a limit, set this to get a correct
     // "Showing rows..." message
     $GLOBALS['session_max_rows'] = 'all';
 } else {
     if ($is_select) {
         //    c o u n t    q u e r y
         // If we are "just browsing", there is only one table,
         // and no where clause (or just 'WHERE 1 '),
         // so we do a quick count (which uses MaxExactCount)
         // because SQL_CALC_FOUND_ROWS
         // is not quick on large InnoDB tables
         if (!$is_group && !isset($analyzed_sql[0]['queryflags']['union']) && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ')) {
             // "j u s t   b r o w s i n g"
             $unlim_num_rows = PMA_countRecords($db, $table, TRUE);
         } else {
             // n o t   " j u s t   b r o w s i n g "
             if (PMA_MYSQL_INT_VERSION < 40000) {
                 // detect this case:
                 // SELECT DISTINCT x AS foo, y AS bar FROM sometable
                 if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
                     $count_what = 'DISTINCT ';
                     $first_expr = TRUE;
                     foreach ($analyzed_sql[0]['select_expr'] as $part) {
                         $count_what .= (!$first_expr ? ', ' : '') . $part['expr'];
                         $first_expr = FALSE;
                     }
                 } else {
                     $count_what = '*';
                 }
开发者ID:lifecom,项目名称:test,代码行数:31,代码来源:sql.php

示例11: isset

        $tbl_type = $strView;
        $show_comment = NULL;
    } else {
        $tbl_is_view = FALSE;
        $tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
        // a new comment could be coming from tbl_properties_operations.php
        // and we want to show it in the header
        if (isset($submitcomment) && isset($comment)) {
            $show_comment = $comment;
        } else {
            $show_comment = isset($showtable['Comment']) ? $showtable['Comment'] : '';
        }
    }
    $tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
    if (NULL === $showtable['Rows']) {
        $showtable['Rows'] = PMA_countRecords($GLOBALS['db'], $showtable['Name'], $return = true, $force_exact = true);
    }
    $table_info_num_rows = isset($showtable['Rows']) ? $showtable['Rows'] : 0;
    $auto_increment = isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '';
    $tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
    $tmp_cnt = count($tmp);
    for ($i = 0; $i < $tmp_cnt; $i++) {
        $tmp1 = explode('=', $tmp[$i]);
        if (isset($tmp1[1])) {
            ${$tmp1}[0] = $tmp1[1];
        }
    }
    // end for
    PMA_DBI_free_result($table_info_result);
    unset($tmp1, $tmp, $table_info_result);
}
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:tbl_properties_table_info.php

示例12: show_checked_option

?>
    <input type="hidden" name="xml_data" value="xml_data" />
</fieldset>

<script type="text/javascript">
<!--
    show_checked_option();
//-->
</script>

<?php 
if (!empty($table) && !isset($num_tables)) {
    ?>
    <div class="formelementrow">
        <?php 
    echo sprintf($strDumpXRows, '<input type="text" name="limit_to" size="5" value="' . (isset($unlim_num_rows) ? $unlim_num_rows : PMA_countRecords($db, $table, TRUE)) . '" onfocus="this.select()" />', '<input type="text" name="limit_from" value="0" size="5"' . ' onfocus="this.select()" /> ');
    ?>
    </div>
<?php 
}
?>
</fieldset>

<fieldset>
    <legend>
        <input type="checkbox" name="asfile" value="sendit"
            id="checkbox_dump_asfile" <?php 
PMA_exportCheckboxCheck('asfile');
?>
 />
        <label for="checkbox_dump_asfile"><?php 
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:31,代码来源:display_export.lib.php

示例13: PMA_getTableList

 /**
  * returns array with tables of given db with extended infomation and grouped
  *
  * @uses    $GLOBALS['cfg']['LeftFrameTableSeparator']
  * @uses    $GLOBALS['cfg']['LeftFrameTableLevel']
  * @uses    $GLOBALS['cfg']['ShowTooltipAliasTB']
  * @uses    $GLOBALS['cfg']['NaturalOrder']
  * @uses    PMA_DBI_fetch_result()
  * @uses    PMA_backquote()
  * @uses    count()
  * @uses    array_merge
  * @uses    uksort()
  * @uses    strstr()
  * @uses    explode()
  * @param   string  $db     name of db
  * return   array   (rekursive) grouped table list
  */
 function PMA_getTableList($db)
 {
     $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
     $tables = PMA_DBI_get_tables_full($db);
     if (count($tables) < 1) {
         return $tables;
     }
     if ($GLOBALS['cfg']['NaturalOrder']) {
         uksort($tables, 'strcmp');
     }
     $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
     $table_groups = array();
     foreach ($tables as $table_name => $table) {
         // check for correct row count
         if (NULL === $table['Rows']) {
             $table['Rows'] = PMA_countRecords($db, $table['Name'], $return = true, $force_exact = true);
         }
         // in $group we save the reference to the place in $table_groups
         // where to store the table info
         if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
             $parts = explode($sep, $table_name);
             $group =& $table_groups;
             $i = 0;
             $group_name_full = '';
             while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                 $group_name = $parts[$i] . $sep;
                 $group_name_full .= $group_name;
                 if (!isset($group[$group_name])) {
                     $group[$group_name] = array();
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                     $table = $group[$group_name];
                     $group[$group_name] = array();
                     $group[$group_name][$group_name] = $table;
                     unset($table);
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } else {
                     $group[$group_name]['tab_count']++;
                 }
                 $group =& $group[$group_name];
                 $i++;
             }
         } else {
             if (!isset($table_groups[$table_name])) {
                 $table_groups[$table_name] = array();
             }
             $group =& $table_groups;
         }
         if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
             // switch tooltip and name
             $table['Comment'] = $table['Name'];
             $table['disp_name'] = $table['Comment'];
         } else {
             $table['disp_name'] = $table['Name'];
         }
         $group[$table_name] = array_merge($default, $table);
     }
     return $table_groups;
 }
开发者ID:BackupTheBerlios,项目名称:vhcs-svn,代码行数:80,代码来源:common.lib.php

示例14: PMA_getTableList

 /**
  * returns array with tables of given db with extended infomation and grouped
  *
  * @uses    $GLOBALS['cfg']['LeftFrameTableSeparator']
  * @uses    $GLOBALS['cfg']['LeftFrameTableLevel']
  * @uses    $GLOBALS['cfg']['ShowTooltipAliasTB']
  * @uses    $GLOBALS['cfg']['NaturalOrder']
  * @uses    PMA_DBI_fetch_result()
  * @uses    PMA_backquote()
  * @uses    count()
  * @uses    array_merge
  * @uses    uksort()
  * @uses    strstr()
  * @uses    explode()
  * @param   string  $db     name of db
  * return   array   (rekursive) grouped table list
  */
 function PMA_getTableList($db, $tables = null)
 {
     $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];
     if (null === $tables) {
         $tables = PMA_DBI_get_tables_full($db);
         if ($GLOBALS['cfg']['NaturalOrder']) {
             uksort($tables, 'strnatcasecmp');
         }
     }
     if (count($tables) < 1) {
         return $tables;
     }
     $default = array('Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '');
     $table_groups = array();
     foreach ($tables as $table_name => $table) {
         // check for correct row count
         if (null === $table['Rows']) {
             // Do not check exact row count here,
             // if row count is invalid possibly the table is defect
             // and this would break left frame;
             // but we can check row count if this is a view,
             // since PMA_countRecords() returns a limited row count
             // in this case.
             // set this because PMA_countRecords() can use it
             $tbl_is_view = PMA_tableIsView($db, $table['Name']);
             if ($tbl_is_view) {
                 $table['Rows'] = PMA_countRecords($db, $table['Name'], $return = true);
             }
         }
         // in $group we save the reference to the place in $table_groups
         // where to store the table info
         if ($GLOBALS['cfg']['LeftFrameDBTree'] && $sep && strstr($table_name, $sep)) {
             $parts = explode($sep, $table_name);
             $group =& $table_groups;
             $i = 0;
             $group_name_full = '';
             while ($i < count($parts) - 1 && $i < $GLOBALS['cfg']['LeftFrameTableLevel']) {
                 $group_name = $parts[$i] . $sep;
                 $group_name_full .= $group_name;
                 if (!isset($group[$group_name])) {
                     $group[$group_name] = array();
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } elseif (!isset($group[$group_name]['is' . $sep . 'group'])) {
                     $table = $group[$group_name];
                     $group[$group_name] = array();
                     $group[$group_name][$group_name] = $table;
                     unset($table);
                     $group[$group_name]['is' . $sep . 'group'] = true;
                     $group[$group_name]['tab' . $sep . 'count'] = 1;
                     $group[$group_name]['tab' . $sep . 'group'] = $group_name_full;
                 } else {
                     $group[$group_name]['tab' . $sep . 'count']++;
                 }
                 $group =& $group[$group_name];
                 $i++;
             }
         } else {
             if (!isset($table_groups[$table_name])) {
                 $table_groups[$table_name] = array();
             }
             $group =& $table_groups;
         }
         if ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] !== 'nested') {
             // switch tooltip and name
             $table['Comment'] = $table['Name'];
             $table['disp_name'] = $table['Comment'];
         } else {
             $table['disp_name'] = $table['Name'];
         }
         $group[$table_name] = array_merge($default, $table);
     }
     return $table_groups;
 }
开发者ID:hoogle,项目名称:ttt,代码行数:92,代码来源:common.lib.php

示例15: elseif

     $unlim_num_rows = $num_rows;
     // if we did not append a limit, set this to get a correct
     // "Showing rows..." message
     $GLOBALS['session_max_rows'] = 'all';
 } elseif ($is_select) {
     //    c o u n t    q u e r y
     // If we are "just browsing", there is only one table,
     // and no where clause (or just 'WHERE 1 '),
     // so we do a quick count (which uses MaxExactCount)
     // because SQL_CALC_FOUND_ROWS
     // is not quick on large InnoDB tables
     // but do not count again if we did it previously
     // due to $find_real_end == true
     if (!$is_group && !isset($analyzed_sql[0]['queryflags']['union']) && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) && (empty($analyzed_sql[0]['where_clause']) || $analyzed_sql[0]['where_clause'] == '1 ') && !isset($find_real_end)) {
         // "j u s t   b r o w s i n g"
         $unlim_num_rows = PMA_countRecords($db, $table, true);
     } else {
         // n o t   " j u s t   b r o w s i n g "
         if (PMA_MYSQL_INT_VERSION < 40000) {
             // detect this case:
             // SELECT DISTINCT x AS foo, y AS bar FROM sometable
             if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
                 $count_what = 'DISTINCT ';
                 $first_expr = true;
                 foreach ($analyzed_sql[0]['select_expr'] as $part) {
                     $count_what .= (!$first_expr ? ', ' : '') . $part['expr'];
                     $first_expr = false;
                 }
             } else {
                 $count_what = '*';
             }
开发者ID:hoogle,项目名称:ttt,代码行数:31,代码来源:sql.php


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