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


PHP Table::duplicateInfo方法代码示例

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


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

示例1: testDuplicateInfo

 /**
  * Test for duplicateInfo
  *
  * @return void
  */
 public function testDuplicateInfo()
 {
     $work = "PMA_work";
     $pma_table = "pma_table";
     $get_fields = array("filed0", "field6");
     $where_fields = array("field2", "filed5");
     $new_fields = array("field3", "filed4");
     $GLOBALS['cfgRelation'][$work] = true;
     $GLOBALS['cfgRelation']['db'] = "PMA_db";
     $GLOBALS['cfgRelation'][$pma_table] = "pma_table";
     $ret = Table::duplicateInfo($work, $pma_table, $get_fields, $where_fields, $new_fields);
     $this->assertEquals(true, $ret);
 }
开发者ID:pboutin44,项目名称:maintest,代码行数:18,代码来源:TableTest.php

示例2: PMA_duplicateBookmarks

/**
 * Duplicate the bookmarks for the db (done once for each db)
 *
 * @param boolean $_error whether table rename/copy or not
 * @param string  $db     database name
 *
 * @return void
 */
function PMA_duplicateBookmarks($_error, $db)
{
    if (!$_error && $db != $_REQUEST['newname']) {
        $get_fields = array('user', 'label', 'query');
        $where_fields = array('dbase' => $db);
        $new_fields = array('dbase' => $_REQUEST['newname']);
        Table::duplicateInfo('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields);
    }
}
开发者ID:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:17,代码来源:operations.lib.php

示例3: moveCopy


//.........这里部分代码省略.........
         $GLOBALS['dbi']->query($sql_set_mode);
         $GLOBALS['sql_query'] .= "\n\n" . $sql_set_mode . ';';
         $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
         $GLOBALS['dbi']->query($sql_insert_data);
         $GLOBALS['sql_query'] .= "\n\n" . $sql_insert_data . ';';
     }
     PMA_getRelationsParam();
     // Drops old table if the user has requested to move it
     if ($move) {
         // This could avoid some problems with replicated databases, when
         // moving table from replicated one to not replicated one
         $GLOBALS['dbi']->selectDb($source_db);
         $_source_table = new Table($source_table, $source_db);
         if ($_source_table->isView()) {
             $sql_drop_query = 'DROP VIEW';
         } else {
             $sql_drop_query = 'DROP TABLE';
         }
         $sql_drop_query .= ' ' . $source;
         $GLOBALS['dbi']->query($sql_drop_query);
         // Renable table in configuration storage
         PMA_REL_renameTable($source_db, $target_db, $source_table, $target_table);
         $GLOBALS['sql_query'] .= "\n\n" . $sql_drop_query . ';';
         // end if ($move)
         return true;
     }
     // we are copying
     // Create new entries as duplicates from old PMA DBs
     if ($what == 'dataonly' || isset($maintain_relations)) {
         return true;
     }
     if ($GLOBALS['cfgRelation']['commwork']) {
         // Get all comments and MIME-Types for current table
         $comments_copy_rs = PMA_queryAsControlUser('SELECT column_name, comment' . ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ' FROM ' . Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . Util::backquote($GLOBALS['cfgRelation']['column_info']) . ' WHERE ' . ' db_name = \'' . Util::sqlAddSlashes($source_db) . '\'' . ' AND ' . ' table_name = \'' . Util::sqlAddSlashes($source_table) . '\'');
         // Write every comment as new copied entry. [MIME]
         while ($comments_copy_row = $GLOBALS['dbi']->fetchAssoc($comments_copy_rs)) {
             $new_comment_query = 'REPLACE INTO ' . Util::backquote($GLOBALS['cfgRelation']['db']) . '.' . Util::backquote($GLOBALS['cfgRelation']['column_info']) . ' (db_name, table_name, column_name, comment' . ($GLOBALS['cfgRelation']['mimework'] ? ', mimetype, transformation, transformation_options' : '') . ') ' . ' VALUES(' . '\'' . Util::sqlAddSlashes($target_db) . '\',\'' . Util::sqlAddSlashes($target_table) . '\',\'' . Util::sqlAddSlashes($comments_copy_row['column_name']) . '\'' . ($GLOBALS['cfgRelation']['mimework'] ? ',\'' . Util::sqlAddSlashes($comments_copy_row['comment']) . '\',' . '\'' . Util::sqlAddSlashes($comments_copy_row['mimetype']) . '\',' . '\'' . Util::sqlAddSlashes($comments_copy_row['transformation']) . '\',' . '\'' . Util::sqlAddSlashes($comments_copy_row['transformation_options']) . '\'' : '') . ')';
             PMA_queryAsControlUser($new_comment_query);
         }
         // end while
         $GLOBALS['dbi']->freeResult($comments_copy_rs);
         unset($comments_copy_rs);
     }
     // duplicating the bookmarks must not be done here, but
     // just once per db
     $get_fields = array('display_field');
     $where_fields = array('db_name' => $source_db, 'table_name' => $source_table);
     $new_fields = array('db_name' => $target_db, 'table_name' => $target_table);
     Table::duplicateInfo('displaywork', 'table_info', $get_fields, $where_fields, $new_fields);
     /**
      * @todo revise this code when we support cross-db relations
      */
     $get_fields = array('master_field', 'foreign_table', 'foreign_field');
     $where_fields = array('master_db' => $source_db, 'master_table' => $source_table);
     $new_fields = array('master_db' => $target_db, 'foreign_db' => $target_db, 'master_table' => $target_table);
     Table::duplicateInfo('relwork', 'relation', $get_fields, $where_fields, $new_fields);
     $get_fields = array('foreign_field', 'master_table', 'master_field');
     $where_fields = array('foreign_db' => $source_db, 'foreign_table' => $source_table);
     $new_fields = array('master_db' => $target_db, 'foreign_db' => $target_db, 'foreign_table' => $target_table);
     Table::duplicateInfo('relwork', 'relation', $get_fields, $where_fields, $new_fields);
     /**
     * @todo Can't get duplicating PDFs the right way. The
     * page numbers always get screwed up independently from
     * duplication because the numbers do not seem to be stored on a
     * per-database basis. Would the author of pdf support please
     * have a look at it?
     *
             $get_fields = array('page_descr');
             $where_fields = array('db_name' => $source_db);
             $new_fields = array('db_name' => $target_db);
             $last_id = Table::duplicateInfo(
        'pdfwork',
        'pdf_pages',
        $get_fields,
        $where_fields,
        $new_fields
             );
     
             if (isset($last_id) && $last_id >= 0) {
        $get_fields = array('x', 'y');
        $where_fields = array(
            'db_name' => $source_db,
            'table_name' => $source_table
        );
        $new_fields = array(
            'db_name' => $target_db,
            'table_name' => $target_table,
            'pdf_page_number' => $last_id
        );
        Table::duplicateInfo(
            'pdfwork',
            'table_coords',
            $get_fields,
            $where_fields,
            $new_fields
        );
             }
     */
     return true;
 }
开发者ID:ryanfmurphy,项目名称:phpmyadmin,代码行数:101,代码来源:Table.php


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