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


PHP PMA_Table::moveCopy方法代码示例

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


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

示例1: PMA_generate_common_url

/**
 * Defines the url to return to in case of error in a sql statement
 */
$err_url = 'tbl_sql.php?' . PMA_generate_common_url($db, $table);
/**
 * Selects the database to work with
 */
PMA_DBI_select_db($db);
/**
 * A target table name has been sent to this script -> do the work
 */
if (isset($new_name) && trim($new_name) != '') {
    if ($db == $target_db && $table == $new_name) {
        $message = isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames;
    } else {
        PMA_Table::moveCopy($db, $table, $target_db, $new_name, $what, isset($submit_move), 'one_table');
        $js_to_run = 'functions.js';
        $message = isset($submit_move) ? $strMoveTableOK : $strCopyTableOK;
        $message = sprintf($message, htmlspecialchars($table), htmlspecialchars($new_name));
        $reload = 1;
        /* Check: Work on new table or on old table? */
        if (isset($submit_move)) {
            $db = $target_db;
            $table = $new_name;
        } else {
            $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
            if (isset($switch_to_new) && $switch_to_new == 'true') {
                PMA_setCookie('pma_switch_to_new', 'true');
                $db = $target_db;
                $table = $new_name;
            } else {
开发者ID:BGCX261,项目名称:zhe-project-agri-hg-to-git,代码行数:31,代码来源:tbl_move_copy.php

示例2: PMA_moveOrCopyTable

/**
 * Move or copy a table
 *
 * @param string $db    current database name
 * @param string $table current table name
 *
 * @return void
 */
function PMA_moveOrCopyTable($db, $table)
{
    /**
     * Selects the database to work with
     */
    $GLOBALS['dbi']->selectDb($db);
    /**
     * $_REQUEST['target_db'] could be empty in case we came from an input field
     * (when there are many databases, no drop-down)
     */
    if (empty($_REQUEST['target_db'])) {
        $_REQUEST['target_db'] = $db;
    }
    /**
     * A target table name has been sent to this script -> do the work
     */
    if (PMA_isValid($_REQUEST['new_name'])) {
        if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
            if (isset($_REQUEST['submit_move'])) {
                $message = PMA_Message::error(__('Can\'t move table to same one!'));
            } else {
                $message = PMA_Message::error(__('Can\'t copy table to same one!'));
            }
        } else {
            PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'], $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
            if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) {
                if (isset($_REQUEST['submit_move'])) {
                    PMA_AdjustPrivileges_renameOrMoveTable($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name']);
                } else {
                    PMA_AdjustPrivileges_copyTable($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name']);
                }
                if (isset($_REQUEST['submit_move'])) {
                    $message = PMA_Message::success(__('Table %s has been moved to %s. Privileges have been ' . 'adjusted.'));
                } else {
                    $message = PMA_Message::success(__('Table %s has been copied to %s. Privileges have been ' . 'adjusted.'));
                }
            } else {
                if (isset($_REQUEST['submit_move'])) {
                    $message = PMA_Message::success(__('Table %s has been moved to %s.'));
                } else {
                    $message = PMA_Message::success(__('Table %s has been copied to %s.'));
                }
            }
            $old = PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table);
            $message->addParam($old);
            $new = PMA_Util::backquote($_REQUEST['target_db']) . '.' . PMA_Util::backquote($_REQUEST['new_name']);
            $message->addParam($new);
            /* Check: Work on new table or on old table? */
            if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
            }
        }
    } else {
        /**
         * No new name for the table!
         */
        $message = PMA_Message::error(__('The table name is empty!'));
    }
    if ($GLOBALS['is_ajax_request'] == true) {
        $response = PMA_Response::getInstance();
        $response->addJSON('message', $message);
        if ($message->isSuccess()) {
            $response->addJSON('db', $GLOBALS['db']);
        } else {
            $response->isSuccess(false);
        }
        exit;
    }
}
开发者ID:mi-squared,项目名称:openemr,代码行数:76,代码来源:operations.lib.php

示例3: unset

             break;
         }
         if (isset($GLOBALS['add_constraints'])) {
             $GLOBALS['sql_constraints_query_full_db'] .= $GLOBALS['sql_constraints_query'];
             unset($GLOBALS['sql_constraints_query']);
         }
     }
     // $sql_query is filled by PMA_Table::moveCopy()
     $sql_query = $back . $sql_query;
 }
 // end (foreach)
 unset($each_table);
 // handle the views
 if (!$_error) {
     foreach ($views as $view) {
         if (!PMA_Table::moveCopy($db, $view, $newname, $view, 'structure', $move, 'db_copy')) {
             $_error = true;
             break;
         }
     }
 }
 unset($view, $views);
 // now that all tables exist, create all the accumulated constraints
 if (!$_error && isset($GLOBALS['add_constraints'])) {
     /**
      * @todo this works with mysqli but not with mysql, because
      * mysql extension does not accept more than one statement; maybe
      * interface with the sql import plugin that handles statement delimiter
      */
     PMA_DBI_query($GLOBALS['sql_constraints_query_full_db']);
     // and prepare to display them
开发者ID:lavsurgut,项目名称:autoauc2,代码行数:31,代码来源:db_operations.php

示例4: testMoveCopy

 /**
  * Test for moveCopy
  *
  * @return void
  */
 public function testMoveCopy()
 {
     $source_table = 'PMA_BookMark';
     $source_db = 'PMA';
     $target_table = 'PMA_BookMark_new';
     $target_db = 'PMA_new';
     $what = "dataonly";
     $move = true;
     $mode = "one_table";
     $GLOBALS['dbi']->expects($this->any())->method('getTable')->will($this->returnValue(new PMA_Table($target_table, $target_db)));
     $_REQUEST['drop_if_exists'] = true;
     $return = PMA_Table::moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode);
     //successfully
     $expect = true;
     $this->assertEquals($expect, $return);
     $sql_query = "INSERT INTO `PMA_new`.`PMA_BookMark_new` SELECT * FROM " . "`PMA`.`PMA_BookMark`";
     $this->assertContains($sql_query, $GLOBALS['sql_query']);
     $sql_query = "DROP VIEW `PMA`.`PMA_BookMark`";
     $this->assertContains($sql_query, $GLOBALS['sql_query']);
     $return = PMA_Table::moveCopy($source_db, $source_table, $target_db, $target_table, $what, false, $mode);
     //successfully
     $expect = true;
     $this->assertEquals($expect, $return);
     $sql_query = "INSERT INTO `PMA_new`.`PMA_BookMark_new` SELECT * FROM " . "`PMA`.`PMA_BookMark`;";
     $this->assertContains($sql_query, $GLOBALS['sql_query']);
     $sql_query = "DROP VIEW `PMA`.`PMA_BookMark`";
     $this->assertNotContains($sql_query, $GLOBALS['sql_query']);
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:33,代码来源:PMA_Table_test.php

示例5: isset

if (empty($_REQUEST['target_db'])) {
    $_REQUEST['target_db'] = $db;
}
/**
 * A target table name has been sent to this script -> do the work
 */
if (PMA_isValid($_REQUEST['new_name'])) {
    if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) {
        if (isset($_REQUEST['submit_move'])) {
            $message = PMA_Message::error(__('Can\'t move table to same one!'));
        } else {
            $message = PMA_Message::error(__('Can\'t copy table to same one!'));
        }
        $result = false;
    } else {
        $result = PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'], $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
        if (isset($_REQUEST['submit_move'])) {
            $message = PMA_Message::success(__('Table %s has been moved to %s.'));
        } else {
            $message = PMA_Message::success(__('Table %s has been copied to %s.'));
        }
        $old = PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table);
        $message->addParam($old);
        $new = PMA_Util::backquote($_REQUEST['target_db']) . '.' . PMA_Util::backquote($_REQUEST['new_name']);
        $message->addParam($new);
        /* Check: Work on new table or on old table? */
        if (isset($_REQUEST['submit_move']) || PMA_isValid($_REQUEST['switch_to_new'])) {
            $db = $_REQUEST['target_db'];
            $table = $_REQUEST['new_name'];
        }
        $reload = 1;
开发者ID:yxwzaxns,项目名称:sakura,代码行数:31,代码来源:tbl_move_copy.php

示例6: PMA_handleTheViews

/**
 * Handle the views, return the boolean value whether table rename/copy or not
 *
 * @param array   $views views as an array
 * @param boolean $move  whether databse name is empty or not
 * @param string  $db    database name
 *
 * @return boolean $_error whether table rename/copy or not
 */
function PMA_handleTheViews($views, $move, $db)
{
    $_error = false;
    // temporarily force to add DROP IF EXIST to CREATE VIEW query,
    // to remove stand-in VIEW that was created earlier
    // ( $_REQUEST['drop_if_exists'] is used in moveCopy() )
    if (isset($_REQUEST['drop_if_exists'])) {
        $temp_drop_if_exists = $_REQUEST['drop_if_exists'];
    }
    $_REQUEST['drop_if_exists'] = 'true';
    foreach ($views as $view) {
        $copying_succeeded = PMA_Table::moveCopy($db, $view, $_REQUEST['newname'], $view, 'structure', $move, 'db_copy');
        if (!$copying_succeeded) {
            $_error = true;
            break;
        }
    }
    unset($_REQUEST['drop_if_exists']);
    if (isset($temp_drop_if_exists)) {
        // restore previous value
        $_REQUEST['drop_if_exists'] = $temp_drop_if_exists;
    }
    return $_error;
}
开发者ID:fanscky,项目名称:HTPMS,代码行数:33,代码来源:operations.lib.php

示例7: isset

     $this_what = $what;
     if (!isset($tables_full[$table]['Engine'])) {
         $tables_full[$table]['Engine'] = $tables_full[$table]['Type'];
     }
     // do not copy the data from a Merge table
     // note: on the calling FORM, 'data' means 'structure and data'
     if ($tables_full[$table]['Engine'] == 'MRG_MyISAM') {
         if ($this_what == 'data') {
             $this_what = 'structure';
         }
         if ($this_what == 'dataonly') {
             $this_what = 'nocopy';
         }
     }
     if ($this_what != 'nocopy') {
         PMA_Table::moveCopy($db, $table, $newname, $table, isset($this_what) ? $this_what : 'data', $move, 'db_copy');
         if (isset($GLOBALS['add_constraints'])) {
             $GLOBALS['sql_constraints_query_full_db'] .= $GLOBALS['sql_constraints_query'];
             unset($GLOBALS['sql_constraints_query']);
         }
     }
     $sql_query = $back . $sql_query;
 }
 unset($table);
 // now that all tables exist, create all the accumulated constraints
 if (isset($GLOBALS['add_constraints'])) {
     // FIXME: this works with mysqli but not with mysql,
     // because mysql extension does not accept more than one
     // statement; maybe interface with the sql import plugin
     // that handles statement delimiter
     PMA_DBI_query($GLOBALS['sql_constraints_query_full_db']);
开发者ID:shinichi85,项目名称:voiperopen,代码行数:31,代码来源:db_operations.php


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