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


PHP PMA_DBI_fetch_value函数代码示例

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


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

示例1: havePartitioning

 /**
  * checks if MySQL server supports partitioning
  *
  * @static
  * @staticvar boolean $have_partitioning
  * @staticvar boolean $already_checked
  * @access  public
  * @return boolean
  */
 public static function havePartitioning()
 {
     static $have_partitioning = false;
     static $already_checked = false;
     if (!$already_checked) {
         if (PMA_MYSQL_INT_VERSION >= 50100) {
             if (PMA_MYSQL_INT_VERSION < 50600) {
                 if (PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'have_partitioning';")) {
                     $have_partitioning = true;
                 }
             } else {
                 // see http://dev.mysql.com/doc/refman/5.6/en/partitioning.html
                 $plugins = PMA_DBI_fetch_result("SHOW PLUGINS");
                 foreach ($plugins as $value) {
                     if ($value['Name'] == 'partition') {
                         $have_partitioning = true;
                         break;
                     }
                 }
             }
             $already_checked = true;
         }
     }
     return $have_partitioning;
 }
开发者ID:yxwzaxns,项目名称:sakura,代码行数:34,代码来源:Partition.class.php

示例2: PMA_EVN_getFooterLinks

/**
 * Creates a fieldset for adding a new event, if the user has the privileges.
 *
 * @return   string    HTML code with containing the fotter fieldset
 */
function PMA_EVN_getFooterLinks()
{
    global $db, $url_query;
    /**
     * For events, we show the usual 'Add event' form and also
     * a form for toggling the state of the event scheduler
     */
    // Init options for the event scheduler toggle functionality
    $es_state = PMA_DBI_fetch_value("SHOW GLOBAL VARIABLES LIKE 'event_scheduler'", 0, 1);
    $es_state = strtolower($es_state);
    $options = array(0 => array('label' => __('OFF'), 'value' => "SET GLOBAL event_scheduler=\"OFF\"", 'selected' => $es_state != 'on'), 1 => array('label' => __('ON'), 'value' => "SET GLOBAL event_scheduler=\"ON\"", 'selected' => $es_state == 'on'));
    // Generate output
    $retval = "<!-- FOOTER LINKS START -->\n";
    $retval .= "<div class='doubleFieldset'>\n";
    // show the usual footer
    $retval .= PMA_RTE_getFooterLinks('CREATE_EVENT', 'EVENT', 'EVENT');
    $retval .= "    <fieldset class='right'>\n";
    $retval .= "        <legend>\n";
    $retval .= "            " . __('Event scheduler status') . "\n";
    $retval .= "        </legend>\n";
    $retval .= "        <div class='wrap'>\n";
    // show the toggle button
    $retval .= PMA_toggleButton("sql.php?{$url_query}&amp;goto=db_events.php" . urlencode("?db={$db}"), 'sql_query', $options, 'PMA_slidingMessage(data.sql_query);');
    $retval .= "        </div>\n";
    $retval .= "    </fieldset>\n";
    $retval .= "    <div style='clear: both;'></div>\n";
    $retval .= "</div>";
    $retval .= "<!-- FOOTER LINKS END -->\n";
    return $retval;
}
开发者ID:AmberWish,项目名称:laba_web,代码行数:35,代码来源:rte_footer.lib.php

示例3: havePartitioning

 /**
  * checks if MySQL server supports partitioning
  *
  * @static
  * @staticvar boolean $have_partitioning
  * @staticvar boolean $already_checked
  * @access  public
  * @uses    PMA_DBI_fetch_result()
  * @return  boolean
  */
 public static function havePartitioning()
 {
     static $have_partitioning = false;
     static $already_checked = false;
     if (!$already_checked) {
         $have_partitioning = PMA_MYSQL_INT_VERSION >= 50100 && PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'have_partitioning';");
         $already_checked = true;
     }
     return $have_partitioning;
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:20,代码来源:Partition.class.php

示例4: getComment

 /**
  * Returns the comment associated with node
  * This method should be overridden by specific type of nodes
  *
  * @return string
  */
 public function getComment()
 {
     $db = PMA_Util::sqlAddSlashes($this->realParent()->real_name);
     $event = PMA_Util::sqlAddSlashes($this->real_name);
     $query = "SELECT `EVENT_COMMENT` ";
     $query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
     $query .= "WHERE `EVENT_SCHEMA`='{$db}' ";
     $query .= "AND `EVENT_NAME`='{$event}' ";
     return PMA_DBI_fetch_value($query);
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:16,代码来源:Node_Event.class.php

示例5: getComment

 /**
  * Returns the comment associated with node
  * This method should be overridden by specific type of nodes
  *
  * @return string
  */
 public function getComment()
 {
     $db = PMA_Util::sqlAddSlashes($this->realParent()->real_name);
     $routine = PMA_Util::sqlAddSlashes($this->real_name);
     $query = "SELECT `ROUTINE_COMMENT` ";
     $query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
     $query .= "WHERE `ROUTINE_SCHEMA`='{$db}' ";
     $query .= "AND `ROUTINE_NAME`='{$routine}' ";
     $query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
     return PMA_DBI_fetch_value($query);
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:17,代码来源:Node_Function.class.php

示例6: getComment

 /**
  * Returns the comment associated with node
  * This method should be overridden by specific type of nodes
  *
  * @return string
  */
 public function getComment()
 {
     $db = PMA_Util::sqlAddSlashes($this->realParent()->realParent()->real_name);
     $table = PMA_Util::sqlAddSlashes($this->realParent()->real_name);
     $column = PMA_Util::sqlAddSlashes($this->real_name);
     $query = "SELECT `COLUMN_COMMENT` ";
     $query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
     $query .= "WHERE `TABLE_SCHEMA`='{$db}' ";
     $query .= "AND `TABLE_NAME`='{$table}' ";
     $query .= "AND `COLUMN_NAME`='{$column}' ";
     return PMA_DBI_fetch_value($query);
 }
开发者ID:mindfeederllc,项目名称:openemr,代码行数:18,代码来源:Node_Column.class.php

示例7: getPresence

 /**
  * Returns the number of children of type $type present inside this container
  * This method is overridden by the Node_Database and Node_Table classes
  *
  * @param string $type         The type of item we are looking for
  *                             ('columns' or 'indexes')
  * @param string $searchClause A string used to filter the results of the query
  *
  * @return int
  */
 public function getPresence($type = '', $searchClause = '')
 {
     $retval = 0;
     $db = $this->realParent()->real_name;
     $table = $this->real_name;
     switch ($type) {
         case 'columns':
             if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
                 $db = PMA_Util::sqlAddSlashes($db);
                 $table = PMA_Util::sqlAddSlashes($table);
                 $query = "SELECT COUNT(*) ";
                 $query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
                 $query .= "WHERE `TABLE_NAME`='{$table}' ";
                 $query .= "AND `TABLE_SCHEMA`='{$db}'";
                 $retval = (int) PMA_DBI_fetch_value($query);
             } else {
                 $db = PMA_Util::backquote($db);
                 $table = PMA_Util::backquote($table);
                 $query = "SHOW COLUMNS FROM {$table} FROM {$db}";
                 $retval = (int) PMA_DBI_num_rows(PMA_DBI_try_query($query));
             }
             break;
         case 'indexes':
             $db = PMA_Util::backquote($db);
             $table = PMA_Util::backquote($table);
             $query = "SHOW INDEXES FROM {$table} FROM {$db}";
             $retval = (int) PMA_DBI_num_rows(PMA_DBI_try_query($query));
             break;
         case 'triggers':
             if (!$GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) {
                 $db = PMA_Util::sqlAddSlashes($db);
                 $table = PMA_Util::sqlAddSlashes($table);
                 $query = "SELECT COUNT(*) ";
                 $query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
                 $query .= "WHERE `EVENT_OBJECT_SCHEMA`='{$db}' ";
                 $query .= "AND `EVENT_OBJECT_TABLE`='{$table}'";
                 $retval = (int) PMA_DBI_fetch_value($query);
             } else {
                 $db = PMA_Util::backquote($db);
                 $table = PMA_Util::sqlAddSlashes($table);
                 $query = "SHOW TRIGGERS FROM {$db} WHERE `Table` = '{$table}'";
                 $retval = (int) PMA_DBI_num_rows(PMA_DBI_try_query($query));
             }
             break;
         default:
             break;
     }
     return $retval;
 }
开发者ID:GDantas05,项目名称:WorkSeries,代码行数:59,代码来源:Node_Table.class.php

示例8: PMA_saveUserprefs

/**
 * Saves user preferences
 *
 * @param array $config_array configuration array
 *
 * @return true|PMA_Message
 */
function PMA_saveUserprefs(array $config_array)
{
    $cfgRelation = PMA_getRelationsParam();
    $server = isset($GLOBALS['server']) ? $GLOBALS['server'] : $GLOBALS['cfg']['ServerDefault'];
    $cache_key = 'server_' . $server;
    if (!$cfgRelation['userconfigwork']) {
        // no pmadb table, use session storage
        $_SESSION['userconfig'] = array('db' => $config_array, 'ts' => time());
        if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
            unset($_SESSION['cache'][$cache_key]['userprefs']);
        }
        return true;
    }
    // save configuration to pmadb
    $query_table = PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['userconfig']);
    $query = '
        SELECT `username`
        FROM ' . $query_table . '
          WHERE `username` = \'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\'';
    $has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']);
    $config_data = json_encode($config_array);
    if ($has_config) {
        $query = '
            UPDATE ' . $query_table . '
            SET `config_data` = \'' . PMA_Util::sqlAddSlashes($config_data) . '\'
            WHERE `username` = \'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\'';
    } else {
        $query = '
            INSERT INTO ' . $query_table . ' (`username`, `config_data`)
            VALUES (\'' . PMA_Util::sqlAddSlashes($cfgRelation['user']) . '\',
                \'' . PMA_Util::sqlAddSlashes($config_data) . '\')';
    }
    if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
        unset($_SESSION['cache'][$cache_key]['userprefs']);
    }
    if (!PMA_DBI_try_query($query, $GLOBALS['controllink'])) {
        $message = PMA_Message::error(__('Could not save configuration'));
        $message->addMessage('<br /><br />');
        $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink'])));
        return $message;
    }
    return true;
}
开发者ID:mindfeederllc,项目名称:openemr,代码行数:50,代码来源:user_preferences.lib.php

示例9: PMA_displayResultsOperations

/**
 * Displays operations that are available on results.
 *
 * @param   array   the display mode
 * @param   array   the analyzed query
 *
 * @uses    $_SESSION['tmp_user_values']['pos']
 * @uses    $_SESSION['tmp_user_values']['display_text']
 * @global  string   $db                the database name
 * @global  string   $table             the table name
 * @global  string   $sql_query         the current SQL query
 * @global  integer  $unlim_num_rows    the total number of rows returned by the
 *                                      SQL query without any programmatically
 *                                      appended "LIMIT" clause
 *
 * @access  private
 *
 * @see     PMA_showMessage(), PMA_setDisplayMode(),
 *          PMA_displayTableNavigation(), PMA_displayTableHeaders(),
 *          PMA_displayTableBody(), PMA_displayResultsOperations()
 */
function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
{
    global $db, $table, $sql_query, $unlim_num_rows;
    $header_shown = FALSE;
    $header = '<fieldset><legend>' . $GLOBALS['strQueryResultsOperations'] . '</legend>';
    if ($the_disp_mode[6] == '1' || $the_disp_mode[9] == '1') {
        // Displays "printable view" link if required
        if ($the_disp_mode[9] == '1') {
            if (!$header_shown) {
                echo $header;
                $header_shown = TRUE;
            }
            $_url_params = array('db' => $db, 'table' => $table, 'printview' => '1', 'sql_query' => $sql_query);
            $url_query = PMA_generate_common_url($_url_params);
            echo PMA_linkOrButton('sql.php' . $url_query, PMA_getIcon('b_print.png', $GLOBALS['strPrintView'], false, true), '', true, true, 'print_view') . "\n";
            if ($_SESSION['tmp_user_values']['display_text']) {
                $_url_params['display_text'] = 'F';
                echo PMA_linkOrButton('sql.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_print.png', $GLOBALS['strPrintViewFull'], false, true), '', true, true, 'print_view') . "\n";
                unset($_url_params['display_text']);
            }
        }
        // end displays "printable view"
    }
    // Export link
    // (the url_query has extra parameters that won't be used to export)
    // (the single_table parameter is used in display_export.lib.php
    //  to hide the SQL and the structure export dialogs)
    // If the parser found a PROCEDURE clause
    // (most probably PROCEDURE ANALYSE()) it makes no sense to
    // display the Export link).
    if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == 'SELECT' && !isset($printview) && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
        if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name']) && !isset($analyzed_sql[0]['table_ref'][1]['table_true_name'])) {
            $_url_params['single_table'] = 'true';
        }
        if (!$header_shown) {
            echo $header;
            $header_shown = TRUE;
        }
        $_url_params['unlim_num_rows'] = $unlim_num_rows;
        /**
         * At this point we don't know the table name; this can happen
         * for example with a query like
         * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp
         * As a workaround we set in the table parameter the name of the
         * first table of this database, so that tbl_export.php and
         * the script it calls do not fail
         */
        if (empty($_url_params['table'])) {
            $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES");
        }
        echo PMA_linkOrButton('tbl_export.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_tblexport.png', $GLOBALS['strExport'], false, true), '', true, true, '') . "\n";
    }
    // CREATE VIEW
    /**
     *
     * @todo detect privileges to create a view
     *       (but see 2006-01-19 note in display_create_table.lib.php,
     *        I think we cannot detect db-specific privileges reliably)
     * Note: we don't display a Create view link if we found a PROCEDURE clause
     */
    if (!$header_shown) {
        echo $header;
        $header_shown = TRUE;
    }
    if (!isset($analyzed_sql[0]['queryflags']['procedure'])) {
        echo PMA_linkOrButton('view_create.php' . $url_query, PMA_getIcon('b_views.png', 'CREATE VIEW', false, true), '', true, true, '') . "\n";
    }
    if ($header_shown) {
        echo '</fieldset><br />';
    }
}
开发者ID:kolbermoorer,项目名称:edugame,代码行数:92,代码来源:display_tbl.lib.php

示例10: PMA_DBI_fetch_value

 */
if (strlen($db) && (!empty($db_rename) || !empty($db_copy))) {
    if (!empty($db_rename)) {
        $move = true;
    } else {
        $move = false;
    }
    if (!isset($newname) || !strlen($newname)) {
        $message = PMA_Message::error('strDatabaseEmpty');
    } else {
        $sql_query = '';
        // in case target db exists
        $_error = false;
        if ($move || isset($create_database_before_copying) && $create_database_before_copying) {
            // lower_case_table_names=1 `DB` becomes `db`
            $lower_case_table_names = PMA_DBI_fetch_value('SHOW VARIABLES LIKE "lower_case_table_names"', 0, 1);
            if ($lower_case_table_names === '1') {
                $newname = strtolower($newname);
            }
            $local_query = 'CREATE DATABASE ' . PMA_backquote($newname);
            if (isset($db_collation)) {
                $local_query .= ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
            }
            $local_query .= ';';
            $sql_query = $local_query;
            PMA_DBI_query($local_query);
            // rebuild the database list because PMA_Table::moveCopy
            // checks in this list if the target db exists
            $GLOBALS['pma']->databases->build();
        }
        if (isset($GLOBALS['add_constraints'])) {
开发者ID:lavsurgut,项目名称:autoauc2,代码行数:31,代码来源:db_operations.php

示例11: exportHeader

 /**
  * Outputs export header. It is the first method to be called, so all
  * the required variables are initialized here.
  *
  * @return bool Whether it succeeded
  */
 public function exportHeader()
 {
     global $crlf, $cfg;
     global $mysql_charset_map;
     if (isset($GLOBALS['sql_compatibility'])) {
         $tmp_compat = $GLOBALS['sql_compatibility'];
         if ($tmp_compat == 'NONE') {
             $tmp_compat = '';
         }
         PMA_DBI_try_query('SET SQL_MODE="' . $tmp_compat . '"');
         unset($tmp_compat);
     }
     $head = $this->_exportComment('phpMyAdmin SQL Dump') . $this->_exportComment('version ' . PMA_VERSION) . $this->_exportComment('http://www.phpmyadmin.net') . $this->_exportComment();
     $host_string = __('Host') . ': ' . $cfg['Server']['host'];
     if (!empty($cfg['Server']['port'])) {
         $host_string .= ':' . $cfg['Server']['port'];
     }
     $head .= $this->_exportComment($host_string);
     $head .= $this->_exportComment(__('Generation Time') . ': ' . PMA_Util::localisedDate()) . $this->_exportComment(__('Server version') . ': ' . PMA_MYSQL_STR_VERSION) . $this->_exportComment(__('PHP Version') . ': ' . phpversion()) . $this->_possibleCRLF();
     if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) {
         // '\n' is not a newline (like "\n" would be), it's the characters
         // backslash and n, as explained on the export interface
         $lines = explode('\\n', $GLOBALS['sql_header_comment']);
         $head .= $this->_exportComment();
         foreach ($lines as $one_line) {
             $head .= $this->_exportComment($one_line);
         }
         $head .= $this->_exportComment();
     }
     if (isset($GLOBALS['sql_disable_fk'])) {
         $head .= 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;
     }
     // We want exported AUTO_INCREMENT columns to have still same value,
     // do this only for recent MySQL exports
     if ((!isset($GLOBALS['sql_compatibility']) || $GLOBALS['sql_compatibility'] == 'NONE') && !PMA_DRIZZLE) {
         $head .= 'SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";' . $crlf;
     }
     if (isset($GLOBALS['sql_use_transaction'])) {
         $head .= 'SET AUTOCOMMIT = 0;' . $crlf . 'START TRANSACTION;' . $crlf;
     }
     /* Change timezone if we should export timestamps in UTC */
     if (isset($GLOBALS['sql_utc_time']) && $GLOBALS['sql_utc_time']) {
         $head .= 'SET time_zone = "+00:00";' . $crlf;
         $GLOBALS['old_tz'] = PMA_DBI_fetch_value('SELECT @@session.time_zone');
         PMA_DBI_query('SET time_zone = "+00:00"');
     }
     $head .= $this->_possibleCRLF();
     if (!empty($GLOBALS['asfile']) && !PMA_DRIZZLE) {
         // we are saving as file, therefore we provide charset information
         // so that a utility like the mysql client can interpret
         // the file correctly
         if (isset($GLOBALS['charset_of_file']) && isset($mysql_charset_map[$GLOBALS['charset_of_file']])) {
             // we got a charset from the export dialog
             $set_names = $mysql_charset_map[$GLOBALS['charset_of_file']];
         } else {
             // by default we use the connection charset
             $set_names = $mysql_charset_map['utf-8'];
         }
         $head .= $crlf . '/*!40101 SET @OLD_CHARACTER_SET_CLIENT=' . '@@CHARACTER_SET_CLIENT */;' . $crlf . '/*!40101 SET @OLD_CHARACTER_SET_RESULTS=' . '@@CHARACTER_SET_RESULTS */;' . $crlf . '/*!40101 SET @OLD_COLLATION_CONNECTION=' . '@@COLLATION_CONNECTION */;' . $crlf . '/*!40101 SET NAMES ' . $set_names . ' */;' . $crlf . $crlf;
     }
     return PMA_exportOutputHandler($head);
 }
开发者ID:fanscky,项目名称:HTPMS,代码行数:68,代码来源:ExportSql.class.php

示例12: getPageStatus

 /**
  * returns InnoDB status
  *
  * @uses    htmlspecialchars()
  * @uses    PMA_DBI_fetch_value()
  * @return  string  result of SHOW INNODB STATUS inside pre tags
  */
 function getPageStatus()
 {
     return '<pre id="pre_innodb_status">' . "\n"
         . htmlspecialchars(PMA_DBI_fetch_value('SHOW INNODB STATUS;')) . "\n"
         . '</pre>' . "\n";
 }
开发者ID:blumenbach,项目名称:blumenbach-online.de,代码行数:13,代码来源:innodb.lib.php

示例13: PMA_Bookmark_get

/**
 * Gets the sql command from a bookmark
 *
 * @uses    PMA_backquote()
 * @uses    PMA_sqlAddslashes()
 * @uses    PMA_DBI_fetch_value()
 * @uses    PMA_Bookmark_getParams()
 * @global  resource  the controluser db connection handle
 *
 * @param   string    the current database name
 * @param   mixed     the id of the bookmark to get
 * @param   string    which field to look up the $id
 * @param   boolean  TRUE: get all bookmarks regardless of the owning user
 * @param   boolean   whether to ignore bookmarks with no user
 *
 * @return  string    the sql query
 *
 * @access  public
 */
function PMA_Bookmark_get($db, $id, $id_field = 'id', $action_bookmark_all = FALSE, $exact_user_match = FALSE)
{
    global $controllink;
    $cfgBookmark = PMA_Bookmark_getParams();
    if (empty($cfgBookmark)) {
        return '';
    }
    $query = 'SELECT query FROM ' . PMA_backquote($cfgBookmark['db']) . '.' . PMA_backquote($cfgBookmark['table']) . ' WHERE dbase = \'' . PMA_sqlAddslashes($db) . '\'';
    if (!$action_bookmark_all) {
        $query .= ' AND (user = \'' . PMA_sqlAddslashes($cfgBookmark['user']) . '\'';
        if (!$exact_user_match) {
            $query .= ' OR user = \'\'';
        }
        $query .= ')';
    }
    $query .= ' AND ' . PMA_backquote($id_field) . ' = ' . $id;
    return PMA_DBI_fetch_value($query, 0, 0, $controllink);
}
开发者ID:BGCX262,项目名称:zuozhenshi-prego-svn-to-git,代码行数:37,代码来源:bookmark.lib.php

示例14: moveCopy

 /**
  * Copies or renames table
  * @todo use RENAME for move operations
  *        - would work only if the databases are on the same filesystem,
  *          how can we check that? try the operation and
  *          catch an error?
  *        - for views, only if MYSQL > 50013
  *        - still have to handle pmadb synch.
  *
  * @author          Michal Cihar <michal@cihar.com>
  */
 function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
 {
     global $err_url;
     // set export settings we need
     $GLOBALS['sql_backquotes'] = 1;
     $GLOBALS['asfile'] = 1;
     // Ensure the target is valid
     if (!$GLOBALS['PMA_List_Database']->exists($source_db, $target_db)) {
         /**
          * @todo exit really needed here? or just a return?
          */
         exit;
     }
     $source = PMA_backquote($source_db) . '.' . PMA_backquote($source_table);
     if (!isset($target_db) || !strlen($target_db)) {
         $target_db = $source_db;
     }
     // Doing a select_db could avoid some problems with replicated databases,
     // when moving table from replicated one to not replicated one
     PMA_DBI_select_db($target_db);
     $target = PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
     // do not create the table if dataonly
     if ($what != 'dataonly') {
         require_once './libraries/export/sql.php';
         $no_constraints_comments = true;
         $GLOBALS['sql_constraints_query'] = '';
         $sql_structure = PMA_getTableDef($source_db, $source_table, "\n", $err_url);
         unset($no_constraints_comments);
         $parsed_sql = PMA_SQP_parse($sql_structure);
         $analyzed_sql = PMA_SQP_analyze($parsed_sql);
         $i = 0;
         if (empty($analyzed_sql[0]['create_table_fields'])) {
             // this is not a CREATE TABLE, so find the first VIEW
             $target_for_view = PMA_backquote($target_db);
             while (true) {
                 if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW') {
                     break;
                 }
                 $i++;
             }
         }
         unset($analyzed_sql);
         $server_sql_mode = PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'sql_mode'", 0, 1);
         if ('ANSI_QUOTES' == $server_sql_mode) {
             $table_delimiter = 'quote_double';
         } else {
             $table_delimiter = 'quote_backtick';
         }
         unset($server_sql_mode);
         /* nijel: Find table name in query and replace it */
         while ($parsed_sql[$i]['type'] != $table_delimiter) {
             $i++;
         }
         /* no need to PMA_backquote() */
         if (isset($target_for_view)) {
             // this a view definition; we just found the first db name
             // that follows DEFINER VIEW
             // so change it for the new db name
             $parsed_sql[$i]['data'] = $target_for_view;
             // then we have to find all references to the source db
             // and change them to the target db, ensuring we stay into
             // the $parsed_sql limits
             $last = $parsed_sql['len'] - 1;
             $backquoted_source_db = PMA_backquote($source_db);
             for (++$i; $i <= $last; $i++) {
                 if ($parsed_sql[$i]['type'] == $table_delimiter && $parsed_sql[$i]['data'] == $backquoted_source_db) {
                     $parsed_sql[$i]['data'] = $target_for_view;
                 }
             }
             unset($last, $backquoted_source_db);
         } else {
             $parsed_sql[$i]['data'] = $target;
         }
         /* Generate query back */
         $sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
         // If table exists, and 'add drop table' is selected: Drop it!
         $drop_query = '';
         if (isset($GLOBALS['drop_if_exists']) && $GLOBALS['drop_if_exists'] == 'true') {
             if (PMA_Table::_isView($target_db, $target_table)) {
                 $drop_query = 'DROP VIEW';
             } else {
                 $drop_query = 'DROP TABLE';
             }
             $drop_query .= ' IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
             PMA_DBI_query($drop_query);
             $GLOBALS['sql_query'] .= "\n" . $drop_query . ';';
             // garvin: If an existing table gets deleted, maintain any
             // entries for the PMA_* tables
             $maintain_relations = true;
//.........这里部分代码省略.........
开发者ID:jmathai,项目名称:photos,代码行数:101,代码来源:Table.class.php

示例15: PMA_showMessage

 */
if (!empty($disp_message)) {
    if (!isset($disp_query)) {
        $disp_query = null;
    }
    PMA_showMessage($disp_message, $disp_query);
}
/**
 * Displays top menu links
 */
require_once './libraries/tbl_links.inc.php';
/**
 * Get the analysis of SHOW CREATE TABLE for this table
 * @todo should be handled by class Table
 */
$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));
unset($show_create_table);
/**
 * Get the list of the fields of the current table
 */
PMA_DBI_select_db($db);
$table_fields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', null, null, null, PMA_DBI_QUERY_STORE);
$rows = array();
if (isset($where_clause)) {
    // when in edit mode load all selected rows from table
    $insert_mode = false;
    if (is_array($where_clause)) {
        $where_clause_array = $where_clause;
    } else {
        $where_clause_array = array(0 => $where_clause);
开发者ID:fathitarek,项目名称:cop5725-dbms-project,代码行数:31,代码来源:tbl_change.php


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