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


PHP PMA_DBI_fetch_single_row函数代码示例

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


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

示例1: PMA_load_userprefs

/**
 * Loads user preferences
 *
 * Returns an array:
 * * config_data - path => value pairs
 * * mtime - last modification time
 * * type - 'db' (config read from pmadb) or 'session' (read from user session)
 *
 * @return array
 */
function PMA_load_userprefs()
{
    $cfgRelation = PMA_getRelationsParam();
    if (! $cfgRelation['userconfigwork']) {
        // no pmadb table, use session storage
        if (! isset($_SESSION['userconfig'])) {
            $_SESSION['userconfig'] = array(
                'db' => array(),
                'ts' => time());
        }
        return array(
            'config_data' => $_SESSION['userconfig']['db'],
            'mtime' => $_SESSION['userconfig']['ts'],
            'type' => 'session');
    }
    // load configuration from pmadb
    $query_table = PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['userconfig']);
    $query = '
        SELECT `config_data`, UNIX_TIMESTAMP(`timevalue`) ts
        FROM ' . $query_table . '
          WHERE `username` = \'' . PMA_sqlAddSlashes($cfgRelation['user']) . '\'';
    $row = PMA_DBI_fetch_single_row($query, 'ASSOC', $GLOBALS['controllink']);

    return array(
        'config_data' => $row ? (array)json_decode($row['config_data']) : array(),
        'mtime' => $row ? $row['ts'] : time(),
        'type' => 'db');
}
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:38,代码来源:user_preferences.lib.php

示例2: countRecords

 /**
  * Counts and returns (or displays) the number of records in a table
  *
  * Revision 13 July 2001: Patch for limiting dump size from
  * vinay@sanisoft.com & girish@sanisoft.com
  *
  * @param   string   the current database name
  * @param   string   the current table name
  * @param   boolean  whether to retain or to displays the result
  * @param   boolean  whether to force an exact count
  *
  * @return  mixed    the number of records if "retain" param is true,
  *                   otherwise true
  *
  * @access  public
  */
 public static function countRecords($db, $table, $ret = false, $force_exact = false, $is_view = null)
 {
     if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) {
         $row_count = PMA_Table::$cache[$db][$table]['ExactRows'];
     } else {
         $row_count = false;
         if (null === $is_view) {
             $is_view = PMA_Table::isView($db, $table);
         }
         if (!$force_exact) {
             if (!isset(PMA_Table::$cache[$db][$table]['Rows']) && !$is_view) {
                 PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table, true) . '\'');
             }
             $row_count = PMA_Table::$cache[$db][$table]['Rows'];
         }
         // for a VIEW, $row_count is always false at this point
         if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
             if (!$is_view) {
                 $row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
             } else {
                 // For complex views, even trying to get a partial record
                 // count could bring down a server, so we offer an
                 // alternative: setting MaxExactCountViews to 0 will bypass
                 // completely the record counting for views
                 if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) {
                     $row_count = 0;
                 } else {
                     // Counting all rows of a VIEW could be too long, so use
                     // a LIMIT clause.
                     // Use try_query because it can fail (a VIEW is based on
                     // a table that no longer exists)
                     $result = PMA_DBI_try_query('SELECT 1 FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCountViews'], null, PMA_DBI_QUERY_STORE);
                     if (!PMA_DBI_getError()) {
                         $row_count = PMA_DBI_num_rows($result);
                         PMA_DBI_free_result($result);
                     }
                 }
             }
             PMA_Table::$cache[$db][$table]['ExactRows'] = $row_count;
         }
     }
     if ($ret) {
         return $row_count;
     }
     /**
      * @deprecated at the moment nowhere is $return = false used
      */
     // Note: as of PMA 2.8.0, we no longer seem to be using
     // PMA_Table::countRecords() in display mode.
     echo PMA_formatNumber($row_count, 0);
     if ($is_view) {
         echo '&nbsp;' . sprintf($GLOBALS['strViewHasAtLeast'], $GLOBALS['cfg']['MaxExactCount'], '[a@./Documentation.html#cfg_MaxExactCount@_blank]', '[/a]');
     }
 }
开发者ID:lavsurgut,项目名称:autoauc2,代码行数:70,代码来源:Table.class.php

示例3: PMA_getHtmlToDisplayPrivilegesTable

/**
 * Displays the privileges form table
 *
 * @param string  $db       the database
 * @param string  $table    the table
 * @param boolean $submit   wheather to display the submit button or not
 *
 * @global  array      $cfg         the phpMyAdmin configuration
 * @global  ressource  $user_link   the database connection
 *
 * @return string html snippet
 */
function PMA_getHtmlToDisplayPrivilegesTable($db = '*', $table = '*', $submit = true)
{
    $html_output = '';
    if ($db == '*') {
        $table = '*';
    }
    if (isset($GLOBALS['username'])) {
        $username = $GLOBALS['username'];
        $hostname = $GLOBALS['hostname'];
        $sql_query = PMA_getSqlQueryForDisplayPrivTable($db, $table, $username, $hostname);
        $row = PMA_DBI_fetch_single_row($sql_query);
    }
    if (empty($row)) {
        if ($table == '*') {
            if ($db == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`user`;';
            } elseif ($table == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`db`;';
            }
            $res = PMA_DBI_query($sql_query);
            while ($row1 = PMA_DBI_fetch_row($res)) {
                if (substr($row1[0], 0, 4) == 'max_') {
                    $row[$row1[0]] = 0;
                } else {
                    $row[$row1[0]] = 'N';
                }
            }
            PMA_DBI_free_result($res);
        } else {
            $row = array('Table_priv' => '');
        }
    }
    if (isset($row['Table_priv'])) {
        $row1 = PMA_DBI_fetch_single_row('SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', 'ASSOC', $GLOBALS['userlink']);
        // note: in MySQL 5.0.3 we get "Create View', 'Show view';
        // the View for Create is spelled with uppercase V
        // the view for Show is spelled with lowercase v
        // and there is a space between the words
        $av_grants = explode('\',\'', substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3));
        unset($row1);
        $users_grants = explode(',', $row['Table_priv']);
        foreach ($av_grants as $current_grant) {
            $row[$current_grant . '_priv'] = in_array($current_grant, $users_grants) ? 'Y' : 'N';
        }
        unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);
        // get columns
        $res = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_Util::backquote(PMA_Util::unescapeMysqlWildcards($db)) . '.' . PMA_Util::backquote($table) . ';');
        $columns = array();
        if ($res) {
            while ($row1 = PMA_DBI_fetch_row($res)) {
                $columns[$row1[0]] = array('Select' => false, 'Insert' => false, 'Update' => false, 'References' => false);
            }
            PMA_DBI_free_result($res);
        }
        unset($res, $row1);
    }
    // t a b l e - s p e c i f i c    p r i v i l e g e s
    if (!empty($columns)) {
        $html_output .= PMA_getHtmlForTableSpecificPrivileges($username, $hostname, $db, $table, $columns, $row);
    } else {
        // g l o b a l    o r    d b - s p e c i f i c
        $html_output .= PMA_getHtmlForGlobalOrDbSpecificPrivs($db, $table, $row);
    }
    $html_output .= '</fieldset>' . "\n";
    if ($submit) {
        $html_output .= '<fieldset id="fieldset_user_privtable_footer" ' . 'class="tblFooters">' . "\n" . '<input type="submit" name="update_privs" ' . 'value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n";
    }
    return $html_output;
}
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:81,代码来源:server_privileges.lib.php

示例4: PMA_DBI_postConnect

/**
 * Function called just after a connection to the MySQL database server has
 * been established. It sets the connection collation, and determins the
 * version of MySQL which is running.
 *
 * @param mixed   $link           mysql link resource|object
 * @param boolean $is_controluser whether link is for control user
 *
 * @return void
 */
function PMA_DBI_postConnect($link, $is_controluser = false)
{
    $common_functions = PMA_CommonFunctions::getInstance();
    if (!defined('PMA_MYSQL_INT_VERSION')) {
        if ($common_functions->cacheExists('PMA_MYSQL_INT_VERSION', true)) {
            define('PMA_MYSQL_INT_VERSION', $common_functions->cacheGet('PMA_MYSQL_INT_VERSION', true));
            define('PMA_MYSQL_MAJOR_VERSION', $common_functions->cacheGet('PMA_MYSQL_MAJOR_VERSION', true));
            define('PMA_MYSQL_STR_VERSION', $common_functions->cacheGet('PMA_MYSQL_STR_VERSION', true));
            define('PMA_MYSQL_VERSION_COMMENT', $common_functions->cacheGet('PMA_MYSQL_VERSION_COMMENT', true));
        } else {
            $version = PMA_DBI_fetch_single_row('SELECT @@version, @@version_comment', 'ASSOC', $link);
            if ($version) {
                $match = explode('.', $version['@@version']);
                define('PMA_MYSQL_MAJOR_VERSION', (int) $match[0]);
                define('PMA_MYSQL_INT_VERSION', (int) sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
                define('PMA_MYSQL_STR_VERSION', $version['@@version']);
                define('PMA_MYSQL_VERSION_COMMENT', $version['@@version_comment']);
            } else {
                define('PMA_MYSQL_INT_VERSION', 50015);
                define('PMA_MYSQL_MAJOR_VERSION', 5);
                define('PMA_MYSQL_STR_VERSION', '5.00.15');
                define('PMA_MYSQL_VERSION_COMMENT', '');
            }
            $common_functions->cacheSet('PMA_MYSQL_INT_VERSION', PMA_MYSQL_INT_VERSION, true);
            $common_functions->cacheSet('PMA_MYSQL_MAJOR_VERSION', PMA_MYSQL_MAJOR_VERSION, true);
            $common_functions->cacheSet('PMA_MYSQL_STR_VERSION', PMA_MYSQL_STR_VERSION, true);
            $common_functions->cacheSet('PMA_MYSQL_VERSION_COMMENT', PMA_MYSQL_VERSION_COMMENT, true);
        }
        // detect Drizzle by version number:
        // <year>.<month>.<build number>(.<patch rev)
        define('PMA_DRIZZLE', PMA_MYSQL_MAJOR_VERSION >= 2009);
    }
    // Skip charsets for Drizzle
    if (!PMA_DRIZZLE) {
        if (!empty($GLOBALS['collation_connection'])) {
            PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
            $set_collation_con_query = "SET collation_connection = '" . $common_functions->sqlAddSlashes($GLOBALS['collation_connection']) . "';";
            PMA_DBI_query($set_collation_con_query, $link, PMA_DBI_QUERY_STORE);
        } else {
            PMA_DBI_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
        }
    }
    // Cache plugin list for Drizzle
    if (PMA_DRIZZLE && !$common_functions->cacheExists('drizzle_engines', true)) {
        $sql = "SELECT p.plugin_name, m.module_library\n            FROM data_dictionary.plugins p\n                JOIN data_dictionary.modules m USING (module_name)\n            WHERE p.plugin_type = 'StorageEngine'\n                AND p.plugin_name NOT IN ('FunctionEngine', 'schema')\n                AND p.is_active = 'YES'";
        $engines = PMA_DBI_fetch_result($sql, 'plugin_name', null, $link);
        $common_functions->cacheSet('drizzle_engines', $engines, true);
    }
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:59,代码来源:database_interface.lib.php

示例5: PMA_getDisplayField

/**
 * Gets the display field of a table
 *
 * @param string $db    the name of the db to check for
 * @param string $table the name of the table to check for
 *
 * @return  string   field name
 *
 * @access  public
 */
function PMA_getDisplayField($db, $table)
{
    $cfgRelation = PMA_getRelationsParam();
    /**
     * Try to fetch the display field from DB.
     */
    if ($cfgRelation['displaywork']) {
        $disp_query = '
             SELECT `display_field`
               FROM ' . PMA_backquote($cfgRelation['db']) . '.' . PMA_backquote($cfgRelation['table_info']) . '
              WHERE `db_name`    = \'' . PMA_sqlAddSlashes($db) . '\'
                AND `table_name` = \'' . PMA_sqlAddSlashes($table) . '\'';
        $row = PMA_DBI_fetch_single_row($disp_query, 'ASSOC', $GLOBALS['controllink']);
        if (isset($row['display_field'])) {
            return $row['display_field'];
        }
    }
    /**
     * Emulating the display field for some information_schema tables.
     */
    if ($db == 'information_schema') {
        switch ($table) {
            case 'CHARACTER_SETS':
                return 'DESCRIPTION';
            case 'TABLES':
                return 'TABLE_COMMENT';
        }
    }
    /**
     * No Luck...
     */
    return false;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:43,代码来源:relation.lib.php

示例6: array

                $exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
                $value = floatval($matches[1]) * pow(1024, $exp[strtolower($matches[3])]);
            } else {
                $value = PMA_sqlAddslashes($value);
            }

            if (! is_numeric($value)) {
                $value="'" . $value . "'";
            }

            if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])
                && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)
            ) {
                // Some values are rounded down etc.
                $varValue = PMA_DBI_fetch_single_row(
                    'SHOW GLOBAL VARIABLES WHERE Variable_name="'
                    . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM'
                );

                exit(
                    json_encode(
                        array(
                            'success' => true,
                            'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
                        )
                    )
                );
            }

            exit(
                json_encode(
                    array(
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:32,代码来源:server_variables.php

示例7: PMA_displayPrivTable

/**
 * Displays the privileges form table
 *
 * @param string  $db     the database
 * @param string  $table  the table
 * @param boolean $submit wheather to display the submit button or not
 *
 * @global  array      $cfg         the phpMyAdmin configuration
 * @global  ressource  $user_link   the database connection
 *
 * @return void
 */
function PMA_displayPrivTable($db = '*', $table = '*', $submit = true)
{
    global $random_n;

    if ($db == '*') {
        $table = '*';
    }

    if (isset($GLOBALS['username'])) {
        $username = $GLOBALS['username'];
        $hostname = $GLOBALS['hostname'];
        if ($db == '*') {
            $sql_query = "SELECT * FROM `mysql`.`user`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "';";
        } elseif ($table == '*') {
            $sql_query = "SELECT * FROM `mysql`.`db`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'"
                ." AND '" . PMA_unescape_mysql_wildcards($db) . "'"
                ." LIKE `Db`;";
        } else {
            $sql_query = "SELECT `Table_priv`"
                ." FROM `mysql`.`tables_priv`"
                ." WHERE `User` = '" . PMA_sqlAddSlashes($username) . "'"
                ." AND `Host` = '" . PMA_sqlAddSlashes($hostname) . "'"
                ." AND `Db` = '" . PMA_unescape_mysql_wildcards($db) . "'"
                ." AND `Table_name` = '" . PMA_sqlAddSlashes($table) . "';";
        }
        $row = PMA_DBI_fetch_single_row($sql_query);
    }
    if (empty($row)) {
        if ($table == '*') {
            if ($db == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`user`;';
            } elseif ($table == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`db`;';
            }
            $res = PMA_DBI_query($sql_query);
            while ($row1 = PMA_DBI_fetch_row($res)) {
                if (substr($row1[0], 0, 4) == 'max_') {
                    $row[$row1[0]] = 0;
                } else {
                    $row[$row1[0]] = 'N';
                }
            }
            PMA_DBI_free_result($res);
        } else {
            $row = array('Table_priv' => '');
        }
    }
    if (isset($row['Table_priv'])) {
        $row1 = PMA_DBI_fetch_single_row(
            'SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';',
            'ASSOC', $GLOBALS['userlink']
        );
        // note: in MySQL 5.0.3 we get "Create View', 'Show view';
        // the View for Create is spelled with uppercase V
        // the view for Show is spelled with lowercase v
        // and there is a space between the words

        $av_grants = explode(
            '\',\'',
            substr(
                $row1['Type'],
                strpos($row1['Type'], '(') + 2,
                strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3
            )
        );
        unset($row1);
        $users_grants = explode(',', $row['Table_priv']);

        foreach ($av_grants as $current_grant) {
            $row[$current_grant . '_priv']
                = in_array($current_grant, $users_grants) ? 'Y' : 'N';
        }
        unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);

        // get collumns
        $res = PMA_DBI_try_query(
            'SHOW COLUMNS FROM '
            . PMA_backquote(PMA_unescape_mysql_wildcards($db))
            . '.' . PMA_backquote($table) . ';'
        );
        $columns = array();
        if ($res) {
            while ($row1 = PMA_DBI_fetch_row($res)) {
                $columns[$row1[0]] = array(
//.........这里部分代码省略.........
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:101,代码来源:server_privileges.php

示例8: PMA_EVN_getDataFromName

/**
 * This function will generate the values that are required to complete
 * the "Edit event" form given the name of a event.
 *
 * @param   string   $name   The name of the event.
 *
 * @return  array    Data necessary to create the editor.
 */
function PMA_EVN_getDataFromName($name)
{
    global $db;
    $retval = array();
    $columns = "`EVENT_NAME`, `STATUS`, `EVENT_TYPE`, `EXECUTE_AT`, " . "`INTERVAL_VALUE`, `INTERVAL_FIELD`, `STARTS`, `ENDS`, " . "`EVENT_DEFINITION`, `ON_COMPLETION`, `DEFINER`, `EVENT_COMMENT`";
    $where = "EVENT_SCHEMA='" . PMA_sqlAddSlashes($db) . "' " . "AND EVENT_NAME='" . PMA_sqlAddSlashes($name) . "'";
    $query = "SELECT {$columns} FROM `INFORMATION_SCHEMA`.`EVENTS` WHERE {$where};";
    $item = PMA_DBI_fetch_single_row($query);
    if (!$item) {
        return false;
    }
    $retval['item_name'] = $item['EVENT_NAME'];
    $retval['item_status'] = $item['STATUS'];
    $retval['item_type'] = $item['EVENT_TYPE'];
    if ($retval['item_type'] == 'RECURRING') {
        $retval['item_type_toggle'] = 'ONE TIME';
    } else {
        $retval['item_type_toggle'] = 'RECURRING';
    }
    $retval['item_execute_at'] = $item['EXECUTE_AT'];
    $retval['item_interval_value'] = $item['INTERVAL_VALUE'];
    $retval['item_interval_field'] = $item['INTERVAL_FIELD'];
    $retval['item_starts'] = $item['STARTS'];
    $retval['item_ends'] = $item['ENDS'];
    $retval['item_preserve'] = '';
    if ($item['ON_COMPLETION'] == 'PRESERVE') {
        $retval['item_preserve'] = " checked='checked'";
    }
    $retval['item_definition'] = $item['EVENT_DEFINITION'];
    $retval['item_definer'] = $item['DEFINER'];
    $retval['item_comment'] = $item['EVENT_COMMENT'];
    return $retval;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:41,代码来源:rte_events.lib.php

示例9: PMA_getCurrentValueForDifferentTypes

/**
 * Get the current column value in the form for different data types
 *
 * @param string  $possibly_uploaded_val        uploaded file content
 * @param string  $key                          an md5 of the column name
 * @param array   $multi_edit_columns_type      array of multi edit column types
 * @param string  $current_value                current column value in the form
 * @param array   $multi_edit_auto_increment    multi edit auto increment
 * @param string  $rownumber                    index of where clause array
 * @param array   $multi_edit_columns_name      multi edit column names array
 * @param array   $multi_edit_columns_null      multi edit columns null array
 * @param array   $multi_edit_columns_null_prev multi edit columns previous null
 * @param boolean $is_insert                    whether insert or not
 * @param boolean $using_key                    whether editing or new row
 * @param array   $where_clause                 where clauses
 * @param string  $table                        table name
 *
 * @return string $current_value                current column value in the form
 */
function PMA_getCurrentValueForDifferentTypes($possibly_uploaded_val, $key, $multi_edit_columns_type, $current_value, $multi_edit_auto_increment, $rownumber, $multi_edit_columns_name, $multi_edit_columns_null, $multi_edit_columns_null_prev, $is_insert, $using_key, $where_clause, $table)
{
    // Fetch the current values of a row to use in case we have a protected field
    if ($is_insert && $using_key && isset($multi_edit_columns_type) && is_array($multi_edit_columns_type) && isset($where_clause)) {
        $protected_row = PMA_DBI_fetch_single_row('SELECT * FROM ' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';');
    }
    if (false !== $possibly_uploaded_val) {
        $current_value = $possibly_uploaded_val;
    } else {
        // c o l u m n    v a l u e    i n    t h e    f o r m
        if (isset($multi_edit_columns_type[$key])) {
            $type = $multi_edit_columns_type[$key];
        } else {
            $type = '';
        }
        if ($type != 'protected' && $type != 'set' && 0 === strlen($current_value)) {
            // best way to avoid problems in strict mode
            // (works also in non-strict mode)
            if (isset($multi_edit_auto_increment) && isset($multi_edit_auto_increment[$key])) {
                $current_value = 'NULL';
            } else {
                $current_value = "''";
            }
        } elseif ($type == 'set') {
            if (!empty($_REQUEST['fields']['multi_edit'][$rownumber][$key])) {
                $current_value = implode(',', $_REQUEST['fields']['multi_edit'][$rownumber][$key]);
                $current_value = "'" . PMA_Util::sqlAddSlashes($current_value) . "'";
            } else {
                $current_value = "''";
            }
        } elseif ($type == 'protected') {
            // here we are in protected mode (asked in the config)
            // so tbl_change has put this special value in the
            // coulmns array, so we do not change the column value
            // but we can still handle column upload
            // when in UPDATE mode, do not alter field's contents. When in INSERT
            // mode, insert empty field because no values were submitted.
            // If protected blobs where set, insert original fields content.
            if (!empty($protected_row[$multi_edit_columns_name[$key]])) {
                $current_value = '0x' . bin2hex($protected_row[$multi_edit_columns_name[$key]]);
            } else {
                $current_value = '';
            }
        } elseif ($type == 'bit') {
            $current_value = preg_replace('/[^01]/', '0', $current_value);
            $current_value = "b'" . PMA_Util::sqlAddSlashes($current_value) . "'";
        } elseif (!($type == 'datetime' || $type == 'timestamp') || $current_value != 'CURRENT_TIMESTAMP') {
            $current_value = "'" . PMA_Util::sqlAddSlashes($current_value) . "'";
        }
        // Was the Null checkbox checked for this field?
        // (if there is a value, we ignore the Null checkbox: this could
        // be possible if Javascript is disabled in the browser)
        if (!empty($multi_edit_columns_null[$key]) && ($current_value == "''" || $current_value == '')) {
            $current_value = 'NULL';
        }
        // The Null checkbox was unchecked for this field
        if (empty($current_value) && !empty($multi_edit_columns_null_prev[$key]) && !isset($multi_edit_columns_null[$key])) {
            $current_value = "''";
        }
    }
    // end else (column value in the form)
    return $current_value;
}
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:82,代码来源:insert_edit.lib.php

示例10: PMA_DBI_postConnect

/**
 * Function called just after a connection to the MySQL database server has
 * been established. It sets the connection collation, and determins the
 * version of MySQL which is running.
 *
 * @param mixed   $link           mysql link resource|object
 * @param boolean $is_controluser whether link is for control user
 *
 * @return void
 */
function PMA_DBI_postConnect($link, $is_controluser = false)
{
    if ($is_controluser) {
        return;
    }
    if (!defined('PMA_MYSQL_INT_VERSION')) {
        if (PMA_Util::cacheExists('PMA_MYSQL_INT_VERSION', true)) {
            define('PMA_MYSQL_INT_VERSION', PMA_Util::cacheGet('PMA_MYSQL_INT_VERSION', true));
            define('PMA_MYSQL_MAJOR_VERSION', PMA_Util::cacheGet('PMA_MYSQL_MAJOR_VERSION', true));
            define('PMA_MYSQL_STR_VERSION', PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION', true));
            define('PMA_MYSQL_VERSION_COMMENT', PMA_Util::cacheGet('PMA_MYSQL_VERSION_COMMENT', true));
            define('PMA_DRIZZLE', PMA_Util::cacheGet('PMA_DRIZZLE', true));
        } else {
            $version = PMA_DBI_fetch_single_row('SELECT @@version, @@version_comment', 'ASSOC', $link);
            if ($version) {
                $match = explode('.', $version['@@version']);
                define('PMA_MYSQL_MAJOR_VERSION', (int) $match[0]);
                define('PMA_MYSQL_INT_VERSION', (int) sprintf('%d%02d%02d', $match[0], $match[1], intval($match[2])));
                define('PMA_MYSQL_STR_VERSION', $version['@@version']);
                define('PMA_MYSQL_VERSION_COMMENT', $version['@@version_comment']);
            } else {
                define('PMA_MYSQL_INT_VERSION', 50015);
                define('PMA_MYSQL_MAJOR_VERSION', 5);
                define('PMA_MYSQL_STR_VERSION', '5.00.15');
                define('PMA_MYSQL_VERSION_COMMENT', '');
            }
            PMA_Util::cacheSet('PMA_MYSQL_INT_VERSION', PMA_MYSQL_INT_VERSION, true);
            PMA_Util::cacheSet('PMA_MYSQL_MAJOR_VERSION', PMA_MYSQL_MAJOR_VERSION, true);
            PMA_Util::cacheSet('PMA_MYSQL_STR_VERSION', PMA_MYSQL_STR_VERSION, true);
            PMA_Util::cacheSet('PMA_MYSQL_VERSION_COMMENT', PMA_MYSQL_VERSION_COMMENT, true);
            // Detect Drizzle - it does not support character sets
            $charset_result = PMA_DBI_get_variable('character_set_results', PMA_DBI_GETVAR_GLOBAL, $link);
            if ($charset_result) {
                define('PMA_DRIZZLE', false);
            } else {
                define('PMA_DRIZZLE', true);
            }
            PMA_Util::cacheSet('PMA_DRIZZLE', PMA_DRIZZLE, true);
        }
    }
    // Skip charsets for Drizzle
    if (!PMA_DRIZZLE) {
        if (!empty($GLOBALS['collation_connection'])) {
            PMA_DBI_query("SET CHARACTER SET 'utf8';", $link, PMA_DBI_QUERY_STORE);
            $set_collation_con_query = "SET collation_connection = '" . PMA_Util::sqlAddSlashes($GLOBALS['collation_connection']) . "';";
            PMA_DBI_query($set_collation_con_query, $link, PMA_DBI_QUERY_STORE);
        } else {
            PMA_DBI_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci';", $link, PMA_DBI_QUERY_STORE);
        }
    }
    // Cache plugin list for Drizzle
    if (PMA_DRIZZLE && !PMA_Util::cacheExists('drizzle_engines', true)) {
        $sql = "SELECT p.plugin_name, m.module_library\n            FROM data_dictionary.plugins p\n                JOIN data_dictionary.modules m USING (module_name)\n            WHERE p.plugin_type = 'StorageEngine'\n                AND p.plugin_name NOT IN ('FunctionEngine', 'schema')\n                AND p.is_active = 'YES'";
        $engines = PMA_DBI_fetch_result($sql, 'plugin_name', null, $link);
        PMA_Util::cacheSet('drizzle_engines', $engines, true);
    }
}
开发者ID:fanscky,项目名称:HTPMS,代码行数:67,代码来源:database_interface.lib.php

示例11: PMA_displayPrivTable

/**
 * Displays the privileges form table
 *
 * @param   string  $db     the database
 * @param   string  $table  the table
 * @param   boolean $submit wheather to display the submit button or not
 * @global  array      $cfg         the phpMyAdmin configuration
 * @global  ressource  $user_link   the database connection
 *
 * @return  void
 */
function PMA_displayPrivTable($db = '*', $table = '*', $submit = TRUE)
{
    if ($db == '*') {
        $table = '*';
    }
    if (isset($GLOBALS['username'])) {
        $username = $GLOBALS['username'];
        $hostname = $GLOBALS['hostname'];
        if ($db == '*') {
            $sql_query = "SELECT * FROM `mysql`.`user`" . " WHERE `User` = '" . PMA_sqlAddslashes($username) . "'" . " AND `Host` = '" . PMA_sqlAddslashes($hostname) . "';";
        } elseif ($table == '*') {
            $sql_query = "SELECT * FROM `mysql`.`db`" . " WHERE `User` = '" . PMA_sqlAddslashes($username) . "'" . " AND `Host` = '" . PMA_sqlAddslashes($hostname) . "'" . " AND '" . PMA_unescape_mysql_wildcards($db) . "'" . " LIKE `Db`;";
        } else {
            $sql_query = "SELECT `Table_priv`" . " FROM `mysql`.`tables_priv`" . " WHERE `User` = '" . PMA_sqlAddslashes($username) . "'" . " AND `Host` = '" . PMA_sqlAddslashes($hostname) . "'" . " AND `Db` = '" . PMA_unescape_mysql_wildcards($db) . "'" . " AND `Table_name` = '" . PMA_sqlAddslashes($table) . "';";
        }
        $row = PMA_DBI_fetch_single_row($sql_query);
    }
    if (empty($row)) {
        if ($table == '*') {
            if ($db == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`user`;';
            } elseif ($table == '*') {
                $sql_query = 'SHOW COLUMNS FROM `mysql`.`db`;';
            }
            $res = PMA_DBI_query($sql_query);
            while ($row1 = PMA_DBI_fetch_row($res)) {
                if (substr($row1[0], 0, 4) == 'max_') {
                    $row[$row1[0]] = 0;
                } else {
                    $row[$row1[0]] = 'N';
                }
            }
            PMA_DBI_free_result($res);
        } else {
            $row = array('Table_priv' => '');
        }
    }
    if (isset($row['Table_priv'])) {
        $row1 = PMA_DBI_fetch_single_row('SHOW COLUMNS FROM `mysql`.`tables_priv` LIKE \'Table_priv\';', 'ASSOC', $GLOBALS['userlink']);
        // note: in MySQL 5.0.3 we get "Create View', 'Show view';
        // the View for Create is spelled with uppercase V
        // the view for Show is spelled with lowercase v
        // and there is a space between the words
        $av_grants = explode('\',\'', substr($row1['Type'], strpos($row1['Type'], '(') + 2, strpos($row1['Type'], ')') - strpos($row1['Type'], '(') - 3));
        unset($row1);
        $users_grants = explode(',', $row['Table_priv']);
        foreach ($av_grants as $current_grant) {
            $row[$current_grant . '_priv'] = in_array($current_grant, $users_grants) ? 'Y' : 'N';
        }
        unset($row['Table_priv'], $current_grant, $av_grants, $users_grants);
        // get collumns
        $res = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote(PMA_unescape_mysql_wildcards($db)) . '.' . PMA_backquote($table) . ';');
        $columns = array();
        if ($res) {
            while ($row1 = PMA_DBI_fetch_row($res)) {
                $columns[$row1[0]] = array('Select' => FALSE, 'Insert' => FALSE, 'Update' => FALSE, 'References' => FALSE);
            }
            PMA_DBI_free_result($res);
        }
        unset($res, $row1);
    }
    // t a b l e - s p e c i f i c    p r i v i l e g e s
    if (!empty($columns)) {
        $res = PMA_DBI_query('SELECT `Column_name`, `Column_priv`' . ' FROM `mysql`.`columns_priv`' . ' WHERE `User`' . ' = \'' . PMA_sqlAddslashes($username) . "'" . ' AND `Host`' . ' = \'' . PMA_sqlAddslashes($hostname) . "'" . ' AND `Db`' . ' = \'' . PMA_sqlAddslashes(PMA_unescape_mysql_wildcards($db)) . "'" . ' AND `Table_name`' . ' = \'' . PMA_sqlAddslashes($table) . '\';');
        while ($row1 = PMA_DBI_fetch_row($res)) {
            $row1[1] = explode(',', $row1[1]);
            foreach ($row1[1] as $current) {
                $columns[$row1[0]][$current] = TRUE;
            }
        }
        PMA_DBI_free_result($res);
        unset($res, $row1, $current);
        echo '<input type="hidden" name="grant_count" value="' . count($row) . '" />' . "\n" . '<input type="hidden" name="column_count" value="' . count($columns) . '" />' . "\n" . '<fieldset id="fieldset_user_priv">' . "\n" . '    <legend>' . $GLOBALS['strTblPrivileges'] . PMA_showHint($GLOBALS['strEnglishPrivileges']) . '</legend>' . "\n";
        // privs that are attached to a specific column
        PMA_display_column_privs($columns, $row, 'Select_priv', 'SELECT', 'select', $GLOBALS['strPrivDescSelect'], 'Select');
        PMA_display_column_privs($columns, $row, 'Insert_priv', 'INSERT', 'insert', $GLOBALS['strPrivDescInsert'], 'Insert');
        PMA_display_column_privs($columns, $row, 'Update_priv', 'UPDATE', 'update', $GLOBALS['strPrivDescUpdate'], 'Update');
        PMA_display_column_privs($columns, $row, 'References_priv', 'REFERENCES', 'references', $GLOBALS['strPrivDescReferences'], 'References');
        // privs that are not attached to a specific column
        echo '    <div class="item">' . "\n";
        foreach ($row as $current_grant => $current_grant_value) {
            if (in_array(substr($current_grant, 0, strlen($current_grant) - 5), array('Select', 'Insert', 'Update', 'References'))) {
                continue;
            }
            // make a substitution to match the messages variables;
            // also we must substitute the grant we get, because we can't generate
            // a form variable containing blanks (those would get changed to
            // an underscore when receiving the POST)
            if ($current_grant == 'Create View_priv') {
//.........这里部分代码省略.........
开发者ID:nesthub,项目名称:php_jannus,代码行数:101,代码来源:server_privileges.php

示例12: __

    }
}
/**
 * Checks if the user is allowed to do what he tries to...
 */
if (!$is_superuser) {
    $response->addHTML('<h2>' . "\n" . PMA_Util::getIcon('b_usrlist.png') . __('Privileges') . "\n" . '</h2>' . "\n");
    $response->addHTML(PMA_Message::error(__('No Privileges'))->getDisplay());
    exit;
}
/**
 * Changes / copies a user, part I
 */
if (isset($_REQUEST['change_copy'])) {
    $user_host_condition = ' WHERE `User` = ' . "'" . PMA_Util::sqlAddSlashes($_REQUEST['old_username']) . "'" . ' AND `Host` = ' . "'" . PMA_Util::sqlAddSlashes($_REQUEST['old_hostname']) . "';";
    $row = PMA_DBI_fetch_single_row('SELECT * FROM `mysql`.`user` ' . $user_host_condition);
    if (!$row) {
        PMA_Message::notice(__('No user found.'))->display();
        unset($_REQUEST['change_copy']);
    } else {
        extract($row, EXTR_OVERWRITE);
        // Recent MySQL versions have the field "Password" in mysql.user,
        // so the previous extract creates $Password but this script
        // uses $password
        if (!isset($password) && isset($Password)) {
            $password = $Password;
        }
        $queries = array();
    }
}
/**
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:31,代码来源:server_privileges.php

示例13: getTableDef

 /**
  * Returns $table's CREATE definition
  *
  * @param string $db            the database name
  * @param string $table         the table name
  * @param string $crlf          the end of line sequence
  * @param string $error_url     the url to go back in case of error
  * @param bool   $show_dates    whether to include creation/update/check
  *                              dates
  * @param bool   $add_semicolon whether to add semicolon and end-of-line at
  *                              the end
  * @param bool   $view          whether we're handling a view
  *
  * @return string resulting schema
  */
 public function getTableDef($db, $table, $crlf, $error_url, $show_dates = false, $add_semicolon = true, $view = false)
 {
     global $sql_drop_table, $sql_backquotes, $sql_constraints, $sql_constraints_query, $sql_drop_foreign_keys;
     $schema_create = '';
     $auto_increment = '';
     $new_crlf = $crlf;
     if (isset($GLOBALS['sql_compatibility'])) {
         $compat = $GLOBALS['sql_compatibility'];
     } else {
         $compat = 'NONE';
     }
     // need to use PMA_DBI_QUERY_STORE with PMA_DBI_num_rows() in mysqli
     $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_Util::backquote($db) . ' LIKE \'' . PMA_Util::sqlAddSlashes($table, true) . '\'', null, PMA_DBI_QUERY_STORE);
     if ($result != false) {
         if (PMA_DBI_num_rows($result) > 0) {
             $tmpres = PMA_DBI_fetch_assoc($result);
             if (PMA_DRIZZLE && $show_dates) {
                 // Drizzle doesn't give Create_time and Update_time in
                 // SHOW TABLE STATUS, add it
                 $sql = "SELECT\n                            TABLE_CREATION_TIME AS Create_time,\n                            TABLE_UPDATE_TIME AS Update_time\n                        FROM data_dictionary.TABLES\n                        WHERE TABLE_SCHEMA = '" . PMA_Util::sqlAddSlashes($db) . "'\n                          AND TABLE_NAME = '" . PMA_Util::sqlAddSlashes($table) . "'";
                 $tmpres = array_merge(PMA_DBI_fetch_single_row($sql), $tmpres);
             }
             // Here we optionally add the AUTO_INCREMENT next value,
             // but starting with MySQL 5.0.24, the clause is already included
             // in SHOW CREATE TABLE so we'll remove it below
             // It's required for Drizzle because SHOW CREATE TABLE uses
             // the value from table's creation time
             if (isset($GLOBALS['sql_auto_increment']) && !empty($tmpres['Auto_increment'])) {
                 $auto_increment .= ' AUTO_INCREMENT=' . $tmpres['Auto_increment'] . ' ';
             }
             if ($show_dates && isset($tmpres['Create_time']) && !empty($tmpres['Create_time'])) {
                 $schema_create .= $this->_exportComment(__('Creation') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Create_time'])));
                 $new_crlf = $this->_exportComment() . $crlf;
             }
             if ($show_dates && isset($tmpres['Update_time']) && !empty($tmpres['Update_time'])) {
                 $schema_create .= $this->_exportComment(__('Last update') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Update_time'])));
                 $new_crlf = $this->_exportComment() . $crlf;
             }
             if ($show_dates && isset($tmpres['Check_time']) && !empty($tmpres['Check_time'])) {
                 $schema_create .= $this->_exportComment(__('Last check') . ': ' . PMA_Util::localisedDate(strtotime($tmpres['Check_time'])));
                 $new_crlf = $this->_exportComment() . $crlf;
             }
         }
         PMA_DBI_free_result($result);
     }
     $schema_create .= $new_crlf;
     // no need to generate a DROP VIEW here, it was done earlier
     if (!empty($sql_drop_table) && !PMA_Table::isView($db, $table)) {
         $schema_create .= 'DROP TABLE IF EXISTS ' . PMA_Util::backquote($table, $sql_backquotes) . ';' . $crlf;
     }
     // Complete table dump,
     // Whether to quote table and column names or not
     // Drizzle always quotes names
     if (!PMA_DRIZZLE) {
         if ($sql_backquotes) {
             PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 1');
         } else {
             PMA_DBI_query('SET SQL_QUOTE_SHOW_CREATE = 0');
         }
     }
     // I don't see the reason why this unbuffered query could cause problems,
     // because SHOW CREATE TABLE returns only one row, and we free the
     // results below. Nonetheless, we got 2 user reports about this
     // (see bug 1562533) so I removed the unbuffered mode.
     // $result = PMA_DBI_query('SHOW CREATE TABLE ' . backquote($db)
     // . '.' . backquote($table), null, PMA_DBI_QUERY_UNBUFFERED);
     //
     // Note: SHOW CREATE TABLE, at least in MySQL 5.1.23, does not
     // produce a displayable result for the default value of a BIT
     // column, nor does the mysqldump command. See MySQL bug 35796
     $result = PMA_DBI_try_query('SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table));
     // an error can happen, for example the table is crashed
     $tmp_error = PMA_DBI_getError();
     if ($tmp_error) {
         return $this->_exportComment(__('in use') . '(' . $tmp_error . ')');
     }
     if ($result != false && ($row = PMA_DBI_fetch_row($result))) {
         $create_query = $row[1];
         unset($row);
         // Convert end of line chars to one that we want (note that MySQL
         // doesn't return query it will accept in all cases)
         if (strpos($create_query, "(\r\n ")) {
             $create_query = str_replace("\r\n", $crlf, $create_query);
         } elseif (strpos($create_query, "(\n ")) {
             $create_query = str_replace("\n", $crlf, $create_query);
//.........这里部分代码省略.........
开发者ID:fanscky,项目名称:HTPMS,代码行数:101,代码来源:ExportSql.class.php

示例14: array

 }
 // Defines the SET part of the sql query
 $query_values = array();
 // Map multi-edit keys to single-level arrays, dependent on how we got the fields
 $me_fields = isset($_REQUEST['fields']['multi_edit'][$rownumber]) ? $_REQUEST['fields']['multi_edit'][$rownumber] : array();
 $me_fields_name = isset($_REQUEST['fields_name']['multi_edit'][$rownumber]) ? $_REQUEST['fields_name']['multi_edit'][$rownumber] : null;
 $me_fields_prev = isset($_REQUEST['fields_prev']['multi_edit'][$rownumber]) ? $_REQUEST['fields_prev']['multi_edit'][$rownumber] : null;
 $me_funcs = isset($_REQUEST['funcs']['multi_edit'][$rownumber]) ? $_REQUEST['funcs']['multi_edit'][$rownumber] : null;
 $me_fields_type = isset($_REQUEST['fields_type']['multi_edit'][$rownumber]) ? $_REQUEST['fields_type']['multi_edit'][$rownumber] : null;
 $me_fields_null = isset($_REQUEST['fields_null']['multi_edit'][$rownumber]) ? $_REQUEST['fields_null']['multi_edit'][$rownumber] : null;
 $me_fields_null_prev = isset($_REQUEST['fields_null_prev']['multi_edit'][$rownumber]) ? $_REQUEST['fields_null_prev']['multi_edit'][$rownumber] : null;
 $me_auto_increment = isset($_REQUEST['auto_increment']['multi_edit'][$rownumber]) ? $_REQUEST['auto_increment']['multi_edit'][$rownumber] : null;
 // Fetch the current values of a row to use in case we have a protected field
 // @todo possibly move to ./libraries/tbl_replace_fields.inc.php
 if ($is_insert && $using_key && isset($me_fields_type) && is_array($me_fields_type) && isset($where_clause)) {
     $prot_row = PMA_DBI_fetch_single_row('SELECT * FROM ' . PMA_backquote($table) . ' WHERE ' . $where_clause . ';');
 }
 // When a select field is nullified, it's not present in $_REQUEST
 // so initialize it; this way, the foreach($me_fields) will process it
 foreach ($me_fields_name as $key => $val) {
     if (!isset($me_fields[$key])) {
         $me_fields[$key] = '';
     }
 }
 // Iterate in the order of $me_fields_name, not $me_fields, to avoid problems
 // when inserting multiple entries
 foreach ($me_fields_name as $key => $field_name) {
     $val = $me_fields[$key];
     // Note: $key is an md5 of the fieldname. The actual fieldname is available in $me_fields_name[$key]
     include './libraries/tbl_replace_fields.inc.php';
     // for blobstreaming
开发者ID:ping199143,项目名称:1ydb,代码行数:31,代码来源:tbl_replace.php

示例15: countRecords

 /**
  * Counts and returns (or displays) the number of records in a table
  *
  * Revision 13 July 2001: Patch for limiting dump size from
  * vinay@sanisoft.com & girish@sanisoft.com
  *
  * @param   string   the current database name
  * @param   string   the current table name
  * @param   boolean  whether to force an exact count
  *
  * @return  mixed    the number of records if "retain" param is true,
  *                   otherwise true
  *
  * @access  public
  */
 public static function countRecords($db, $table, $force_exact = false, $is_view = null)
 {
     if (isset(PMA_Table::$cache[$db][$table]['ExactRows'])) {
         $row_count = PMA_Table::$cache[$db][$table]['ExactRows'];
     } else {
         $row_count = false;
         if (null === $is_view) {
             $is_view = PMA_Table::isView($db, $table);
         }
         if (!$force_exact) {
             if (!isset(PMA_Table::$cache[$db][$table]['Rows']) && !$is_view) {
                 PMA_Table::$cache[$db][$table] = PMA_DBI_fetch_single_row('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . PMA_sqlAddslashes($table, true) . '\'');
             }
             $row_count = PMA_Table::$cache[$db][$table]['Rows'];
         }
         // for a VIEW, $row_count is always false at this point
         if (false === $row_count || $row_count < $GLOBALS['cfg']['MaxExactCount']) {
             if (!$is_view) {
                 $row_count = PMA_DBI_fetch_value('SELECT COUNT(*) FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table));
             } else {
                 // For complex views, even trying to get a partial record
                 // count could bring down a server, so we offer an
                 // alternative: setting MaxExactCountViews to 0 will bypass
                 // completely the record counting for views
                 if ($GLOBALS['cfg']['MaxExactCountViews'] == 0) {
                     $row_count = 0;
                 } else {
                     // Counting all rows of a VIEW could be too long, so use
                     // a LIMIT clause.
                     // Use try_query because it can fail (when a VIEW is
                     // based on a table that no longer exists)
                     $result = PMA_DBI_try_query('SELECT 1 FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' LIMIT ' . $GLOBALS['cfg']['MaxExactCountViews'], null, PMA_DBI_QUERY_STORE);
                     if (!PMA_DBI_getError()) {
                         $row_count = PMA_DBI_num_rows($result);
                         PMA_DBI_free_result($result);
                     }
                 }
             }
             PMA_Table::$cache[$db][$table]['ExactRows'] = $row_count;
         }
     }
     return $row_count;
 }
开发者ID:kolbermoorer,项目名称:edugame,代码行数:58,代码来源:Table.class.php


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