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


PHP Table::countRecords方法代码示例

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


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

示例1: PMA_calculatePosForLastPage

/**
 * Function to calculate new pos if pos is higher than number of rows
 * of displayed table
 *
 * @param String   $db    Database name
 * @param String   $table Table name
 * @param Int|null $pos   Initial position
 *
 * @return Int Number of pos to display last page
 */
function PMA_calculatePosForLastPage($db, $table, $pos)
{
    if (null === $pos) {
        $pos = $_SESSION['tmpval']['pos'];
    }
    $_table = new Table($table, $db);
    $unlim_num_rows = $_table->countRecords(true);
    //If position is higher than number of rows
    if ($unlim_num_rows <= $pos && 0 != $pos) {
        $pos = PMA_getStartPosToDisplayRow($unlim_num_rows);
    }
    return $pos;
}
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:23,代码来源:sql.lib.php

示例2: testCountRecords

 /**
  * Test for countRecords
  *
  * @return void
  */
 public function testCountRecords()
 {
     $map = array(array(array('PMA', 'PMA_BookMark'), null, array('Comment' => "Comment222", 'TABLE_TYPE' => "VIEW")), array(array('PMA', 'PMA_BookMark', 'TABLE_TYPE'), null, 'VIEW'));
     $GLOBALS['dbi']->expects($this->any())->method('getCachedTableContent')->will($this->returnValueMap($map));
     $table = 'PMA_BookMark';
     $db = 'PMA';
     $tableObj = new Table($table, $db);
     $return = $tableObj->countRecords(true);
     $expect = 20;
     $this->assertEquals($expect, $return);
 }
开发者ID:pboutin44,项目名称:maintest,代码行数:16,代码来源:TableTest.php

示例3: _getMasterTable

 /**
  * Provides the main table to form the LEFT JOIN clause
  *
  * @param array $search_tables        Tables involved in the search
  * @param array $search_columns       Columns involved in the search
  * @param array $where_clause_columns Columns having criteria where clause
  * @param array $where_clause_tables  Tables having criteria where clause
  *
  * @return string table name
  */
 private function _getMasterTable($search_tables, $search_columns, $where_clause_columns, $where_clause_tables)
 {
     if (count($where_clause_tables) == 1) {
         // If there is exactly one column that has a decent where-clause
         // we will just use this
         $master = key($where_clause_tables);
         return $master;
     }
     // Now let's find out which of the tables has an index
     // (When the control user is the same as the normal user
     // because he is using one of his databases as pmadb,
     // the last db selected is not always the one where we need to work)
     $candidate_columns = $this->_getLeftJoinColumnCandidates($search_tables, $search_columns, $where_clause_columns);
     // Generally, we need to display all the rows of foreign (referenced)
     // table, whether they have any matching row in child table or not.
     // So we select candidate tables which are foreign tables.
     $foreign_tables = array();
     foreach ($candidate_columns as $one_table) {
         $foreigners = PMA_getForeigners($this->_db, $one_table);
         foreach ($foreigners as $key => $foreigner) {
             if ($key != 'foreign_keys_data') {
                 if (in_array($foreigner['foreign_table'], $candidate_columns)) {
                     $foreign_tables[$foreigner['foreign_table']] = $foreigner['foreign_table'];
                 }
                 continue;
             }
             foreach ($foreigner as $one_key) {
                 if (in_array($one_key['ref_table_name'], $candidate_columns)) {
                     $foreign_tables[$one_key['ref_table_name']] = $one_key['ref_table_name'];
                 }
             }
         }
     }
     if (count($foreign_tables)) {
         $candidate_columns = $foreign_tables;
     }
     // 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($candidate_columns) > 1)) {
         // Only one single candidate
         return reset($candidate_columns);
     }
     // Of course we only want to check each table once
     $checked_tables = $candidate_columns;
     $tsize = array();
     $csize = array();
     foreach ($candidate_columns as $table) {
         if ($checked_tables[$table] != 1) {
             $_table = new Table($table, $this->_db);
             $tsize[$table] = $_table->countRecords();
             $checked_tables[$table] = 1;
         }
         $csize[$table] = $tsize[$table];
     }
     // Return largest table
     return array_search(max($csize), $csize);
 }
开发者ID:rclakmal,项目名称:phpmyadmin,代码行数:70,代码来源:DbQbe.php

示例4: PMA_getHtmlForExportOptionsRows

/**
 * Prints Html For Export Options Rows
 *
 * @param String $db             Selected DB
 * @param String $table          Selected Table
 * @param String $unlim_num_rows Num of Rows
 *
 * @return string
 */
function PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows)
{
    $html = '<div class="exportoptions" id="rows">';
    $html .= '<h3>' . __('Rows:') . '</h3>';
    $html .= '<ul>';
    $html .= '<li>';
    $html .= '<input type="radio" name="allrows" value="0" id="radio_allrows_0"';
    if (isset($_GET['allrows']) && $_GET['allrows'] == 0) {
        $html .= ' checked="checked"';
    }
    $html .= '/>';
    $html .= '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>';
    $html .= '<ul>';
    $html .= '<li>';
    $html .= '<label for="limit_to">' . __('Number of rows:') . '</label>';
    $html .= '<input type="text" id="limit_to" name="limit_to" size="5" value="';
    if (isset($_GET['limit_to'])) {
        $html .= htmlspecialchars($_GET['limit_to']);
    } elseif (!empty($unlim_num_rows)) {
        $html .= $unlim_num_rows;
    } else {
        $_table = new Table($table, $db);
        $html .= $_table->countRecords();
    }
    $html .= '" onfocus="this.select()" />';
    $html .= '</li>';
    $html .= '<li>';
    $html .= '<label for="limit_from">' . __('Row to begin at:') . '</label>';
    $html .= '<input type="text" id="limit_from" name="limit_from" value="';
    if (isset($_GET['limit_from'])) {
        $html .= htmlspecialchars($_GET['limit_from']);
    } else {
        $html .= '0';
    }
    $html .= '" size="5" onfocus="this.select()" />';
    $html .= '</li>';
    $html .= '</ul>';
    $html .= '</li>';
    $html .= '<li>';
    $html .= '<input type="radio" name="allrows" value="1" id="radio_allrows_1"';
    if (!isset($_GET['allrows']) || $_GET['allrows'] == 1) {
        $html .= ' checked="checked"';
    }
    $html .= '/>';
    $html .= ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';
    $html .= '</li>';
    $html .= '</ul>';
    $html .= '</div>';
    return $html;
}
开发者ID:nijel,项目名称:phpmyadmin,代码行数:59,代码来源:display_export.lib.php

示例5: foreach

        foreach ($mime_map as $transformation) {
            $column_name = $transformation['column_name'];
            foreach ($transformation_types as $type) {
                $file = PMA_securePath($transformation[$type]);
                $extra_data = PMA_transformEditedValues($db, $table, $transformation, $edited_values, $file, $column_name, $extra_data, $type);
            }
        }
        // end of loop for each $mime_map
    }
    // Need to check the inline edited value can be truncated by MySQL
    // without informing while saving
    $column_name = $_REQUEST['fields_name']['multi_edit'][0][0];
    PMA_verifyWhetherValueCanBeTruncatedAndAppendExtraData($db, $table, $column_name, $extra_data);
    /**Get the total row count of the table*/
    $_table = new Table($_REQUEST['table'], $_REQUEST['db']);
    $extra_data['row_count'] = $_table->countRecords();
    $extra_data['sql_query'] = PMA\libraries\Util::getMessage($message, $GLOBALS['display_query']);
    $response = PMA\libraries\Response::getInstance();
    $response->setRequestStatus($message->isSuccess());
    $response->addJSON('message', $message);
    $response->addJSON($extra_data);
    exit;
}
if (!empty($return_to_sql_query)) {
    $disp_query = $GLOBALS['sql_query'];
    $disp_message = $message;
    unset($message);
    $GLOBALS['sql_query'] = $return_to_sql_query;
}
$scripts->addFile('tbl_change.js');
$active_page = $goto_include;
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_replace.php


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