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


PHP PMA_Table::getLastMessage方法代码示例

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


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

示例1: array

 * Gets tables informations
 */

require './libraries/tbl_info.inc.php';
$reread_info = false;

/**
 * Updates if required
 */
if (isset($_REQUEST['submitoptions'])) {
    $_message = '';
    $warning_messages = array();

    if (isset($_REQUEST['new_name'])) {
        if ($pma_table->rename($_REQUEST['new_name'], null, $is_view = true)) {
            $_message .= $pma_table->getLastMessage();
            $result = true;
            $GLOBALS['table'] = $pma_table->getName();
            $reread_info = true;
            $reload = true;
        } else {
            $_message .= $pma_table->getLastError();
            $result = false;
        }
    }
}

if (isset($result)) {
    // set to success by default, because result set could be empty
    // (for example, a table rename)
    $_type = 'success';
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:view_operations.php

示例2: moveCopy

 /**
  * Copies or renames table
  *
  * @param string $source_db    source database
  * @param string $source_table source table
  * @param string $target_db    target database
  * @param string $target_table target table
  * @param string $what         what to be moved or copied (data, dataonly)
  * @param bool   $move         whether to move
  * @param string $mode         mode
  *
  * @return bool true if success, false otherwise
  */
 public static function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
 {
     global $err_url;
     // Try moving the tables directly, using native `RENAME` statement.
     if ($move && $what == 'data') {
         $tbl = new PMA_Table($source_table, $source_db);
         if ($tbl->rename($target_table, $target_db)) {
             $GLOBALS['message'] = $tbl->getLastMessage();
             return true;
         }
     }
     // Setting required export settings.
     $GLOBALS['sql_backquotes'] = 1;
     $GLOBALS['asfile'] = 1;
     // Ensuring the target database is valid.
     if (!$GLOBALS['pma']->databases->exists($source_db, $target_db)) {
         if (!$GLOBALS['pma']->databases->exists($source_db)) {
             $GLOBALS['message'] = PMA_Message::rawError(sprintf(__('Source database `%s` was not found!'), htmlspecialchars($source_db)));
         }
         if (!$GLOBALS['pma']->databases->exists($target_db)) {
             $GLOBALS['message'] = PMA_Message::rawError(sprintf(__('Target database `%s` was not found!'), htmlspecialchars($target_db)));
         }
         return false;
     }
     /**
      * The full name of source table, quoted.
      * @var string $source
      */
     $source = PMA_Util::backquote($source_db) . '.' . PMA_Util::backquote($source_table);
     // If the target database is not specified, the operation is taking
     // place in the same database.
     if (!isset($target_db) || !mb_strlen($target_db)) {
         $target_db = $source_db;
     }
     // Selecting the database could avoid some problems with replicated
     // databases, when moving table from replicated one to not replicated one.
     $GLOBALS['dbi']->selectDb($target_db);
     /**
      * The full name of target table, quoted.
      * @var string $target
      */
     $target = PMA_Util::backquote($target_db) . '.' . PMA_Util::backquote($target_table);
     // No table is created when this is a data-only operation.
     if ($what != 'dataonly') {
         include_once "libraries/plugin_interface.lib.php";
         /**
          * Instance used for exporting the current structure of the table.
          *
          * @var ExportSql
          */
         $export_sql_plugin = PMA_getPlugin("export", "sql", 'libraries/plugins/export/', array('export_type' => 'table', 'single_table' => false));
         $no_constraints_comments = true;
         $GLOBALS['sql_constraints_query'] = '';
         // set the value of global sql_auto_increment variable
         if (isset($_POST['sql_auto_increment'])) {
             $GLOBALS['sql_auto_increment'] = $_POST['sql_auto_increment'];
         }
         /**
          * The old structure of the table..
          * @var string $sql_structure
          */
         $sql_structure = $export_sql_plugin->getTableDef($source_db, $source_table, "\n", $err_url, false, false);
         unset($no_constraints_comments);
         // -----------------------------------------------------------------
         // Phase 0: Preparing structures used.
         /**
          * The destination where the table is moved or copied to.
          * @var SqlParser\Components\Expression
          */
         $destination = new SqlParser\Components\Expression($target_db, $target_table, '');
         // Find server's SQL mode so the builder can generate correct
         // queries.
         // One of the options that alters the behaviour is `ANSI_QUOTES`.
         // This is not availabile for Drizzle.
         if (!PMA_DRIZZLE) {
             SqlParser\Context::setMode($GLOBALS['dbi']->fetchValue("SELECT @@sql_mode"));
         }
         // -----------------------------------------------------------------
         // Phase 1: Dropping existent element of the same name (if exists
         // and required).
         if (isset($_REQUEST['drop_if_exists']) && $_REQUEST['drop_if_exists'] == 'true') {
             /**
              * Drop statement used for building the query.
              * @var SqlParser\Statements\DropStatement $statement
              */
             $statement = new SqlParser\Statements\DropStatement();
             $tbl = new PMA_Table($target_db, $target_table);
//.........这里部分代码省略.........
开发者ID:TheBlackBloodyUnicorn,项目名称:pico_wanderblog,代码行数:101,代码来源:Table.class.php

示例3: testRename

 /**
  * Test for rename
  *
  * @return void
  */
 public function testRename()
 {
     $table = 'PMA_BookMark';
     $db = 'PMA';
     PMA_Util::cacheSet('lower_case_table_names', false);
     $table = new PMA_Table($table, $db);
     //rename to same name
     $table_new = 'PMA_BookMark';
     $result = $table->rename($table_new);
     $this->assertEquals(true, $result);
     //isValidName
     //space in table name
     $table_new = 'PMA_BookMark ';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     //empty name
     $table_new = '';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     //dot in table name
     $table_new = 'PMA_.BookMark';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     $table_new = 'PMA_BookMark_new';
     $db_new = 'PMA_new';
     $result = $table->rename($table_new, $db_new);
     $this->assertEquals(true, $result);
     //message
     $this->assertEquals("Table PMA_BookMark has been renamed to PMA_BookMark_new.", $table->getLastMessage());
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:35,代码来源:PMA_Table_test.php

示例4: moveCopy

 /**
  * Copies or renames table
  *
  * @param string $source_db    source database
  * @param string $source_table source table
  * @param string $target_db    target database
  * @param string $target_table target table
  * @param string $what         what to be moved or copied (data, dataonly)
  * @param bool   $move         whether to move
  * @param string $mode         mode
  *
  * @return bool true if success, false otherwise
  */
 public static function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
 {
     global $err_url;
     /* Try moving table directly */
     if ($move && $what == 'data') {
         $tbl = new PMA_Table($source_table, $source_db);
         $result = $tbl->rename($target_table, $target_db);
         if ($result) {
             $GLOBALS['message'] = $tbl->getLastMessage();
             return true;
         }
     }
     // set export settings we need
     $GLOBALS['sql_backquotes'] = 1;
     $GLOBALS['asfile'] = 1;
     // Ensure the target is valid
     if (!$GLOBALS['pma']->databases->exists($source_db, $target_db)) {
         if (!$GLOBALS['pma']->databases->exists($source_db)) {
             $GLOBALS['message'] = PMA_Message::rawError(sprintf(__('Source database `%s` was not found!'), htmlspecialchars($source_db)));
         }
         if (!$GLOBALS['pma']->databases->exists($target_db)) {
             $GLOBALS['message'] = PMA_Message::rawError(sprintf(__('Target database `%s` was not found!'), htmlspecialchars($target_db)));
         }
         return false;
     }
     $source = PMA_Util::backquote($source_db) . '.' . PMA_Util::backquote($source_table);
     if (!isset($target_db) || !mb_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
     $GLOBALS['dbi']->selectDb($target_db);
     $target = PMA_Util::backquote($target_db) . '.' . PMA_Util::backquote($target_table);
     // do not create the table if dataonly
     if ($what != 'dataonly') {
         include_once "libraries/plugin_interface.lib.php";
         // get Export SQL instance
         $export_sql_plugin = PMA_getPlugin("export", "sql", 'libraries/plugins/export/', array('export_type' => 'table', 'single_table' => false));
         $no_constraints_comments = true;
         $GLOBALS['sql_constraints_query'] = '';
         // set the value of global sql_auto_increment variable
         if (isset($_POST['sql_auto_increment'])) {
             $GLOBALS['sql_auto_increment'] = $_POST['sql_auto_increment'];
         }
         $sql_structure = $export_sql_plugin->getTableDef($source_db, $source_table, "\n", $err_url, false, false);
         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_Util::backquote($target_db);
             while (true) {
                 if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW') {
                     break;
                 }
                 $i++;
             }
         }
         unset($analyzed_sql);
         if (PMA_DRIZZLE) {
             $table_delimiter = 'quote_backtick';
         } else {
             $server_sql_mode = $GLOBALS['dbi']->fetchValue("SHOW VARIABLES LIKE 'sql_mode'", 0, 1);
             // ANSI_QUOTES might be a subset of sql_mode, for example
             // REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
             if (false !== mb_strpos($server_sql_mode, 'ANSI_QUOTES')) {
                 $table_delimiter = 'quote_double';
             } else {
                 $table_delimiter = 'quote_backtick';
             }
             unset($server_sql_mode);
         }
         /* Find table name in query and replace it */
         while ($parsed_sql[$i]['type'] != $table_delimiter) {
             $i++;
         }
         /* no need to 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;
//.........这里部分代码省略.........
开发者ID:1290800466,项目名称:yiyuanduobao,代码行数:101,代码来源:Table.class.php


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