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


PHP PMA_relationsCleanupDatabase函数代码示例

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


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

示例1: PMA_cleanupRelations

/**
 * If a table, database or column gets dropped, clean comments.
 *
 * @param String $db             current database
 * @param String $table          current table
 * @param String $dropped_column dropped column if any
 * @param bool   $purge          whether purge set or not
 * @param array  $extra_data     extra data
 *
 * @return array $extra_data
 */
function PMA_cleanupRelations($db, $table, $dropped_column, $purge, $extra_data)
{
    include_once 'libraries/relation_cleanup.lib.php';
    if (isset($purge) && $purge == 1) {
        if (mb_strlen($table) && mb_strlen($db)) {
            PMA_relationsCleanupTable($db, $table);
        } elseif (mb_strlen($db)) {
            PMA_relationsCleanupDatabase($db);
        }
    }
    if (isset($dropped_column) && !empty($dropped_column) && mb_strlen($db) && mb_strlen($table)) {
        PMA_relationsCleanupColumn($db, $table, $dropped_column);
        // to refresh the list of indexes (Ajax mode)
        $extra_data['indexes_list'] = PMA_Index::getView($table, $db);
    }
    return $extra_data;
}
开发者ID:harryboulderdash,项目名称:PlayGFC,代码行数:28,代码来源:sql.lib.php

示例2: PMA_DBI_free_result

         if ($row['Key_name'] == 'PRIMARY') {
             $primary .= $row['Column_name'] . ', ';
         }
     }
     // end while
     PMA_DBI_free_result($result);
 }
 $rebuild_database_list = false;
 for ($i = 0; $i < $selected_cnt; $i++) {
     switch ($query_type) {
         case 'row_delete':
             $a_query = urldecode($selected[$i]);
             $run_parts = TRUE;
             break;
         case 'drop_db':
             PMA_relationsCleanupDatabase($selected[$i]);
             $a_query = 'DROP DATABASE ' . PMA_backquote(urldecode($selected[$i]));
             $reload = 1;
             $run_parts = TRUE;
             $rebuild_database_list = true;
             break;
         case 'drop_tbl':
             PMA_relationsCleanupTable($db, $selected[$i]);
             $current = urldecode($selected[$i]);
             if (!empty($views) && in_array($current, $views)) {
                 $sql_query_views .= (empty($sql_query_views) ? 'DROP VIEW ' : ', ') . PMA_backquote($current);
             } else {
                 $sql_query .= (empty($sql_query) ? 'DROP TABLE ' : ', ') . PMA_backquote($current);
             }
             $reload = 1;
             break;
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:31,代码来源:mult_submits.inc.php

示例3: PMA_DBI_select_db

 }
 // go back to current db, just in case
 PMA_DBI_select_db($db);
 // Duplicate the bookmarks for this db (done once for each db)
 if (!$_error && $db != $newname) {
     $get_fields = array('user', 'label', 'query');
     $where_fields = array('dbase' => $db);
     $new_fields = array('dbase' => $newname);
     PMA_Table::duplicateInfo('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields);
 }
 if (!$_error && $move) {
     /**
      * cleanup pmadb stuff for this db
      */
     require_once './libraries/relation_cleanup.lib.php';
     PMA_relationsCleanupDatabase($db);
     // if someday the RENAME DATABASE reappears, do not DROP
     $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';';
     $sql_query .= "\n" . $local_query;
     PMA_DBI_query($local_query);
     $message = PMA_Message::success('strRenameDatabaseOK');
     $message->addParam($db);
     $message->addParam($newname);
 } elseif (!$_error) {
     $message = PMA_Message::success('strCopyDatabaseOK');
     $message->addParam($db);
     $message->addParam($newname);
 }
 $reload = true;
 /* Change database to be used */
 if (!$_error && $move) {
开发者ID:lavsurgut,项目名称:autoauc2,代码行数:31,代码来源:db_operations.php

示例4: PMA_cleanupRelations

/**
 * If a table, database or column gets dropped, clean comments.
 *
 * @param String $db     current database
 * @param String $table  current table
 * @param String $column current column
 * @param bool   $purge  whether purge set or not
 *
 * @return array $extra_data
 */
function PMA_cleanupRelations($db, $table, $column, $purge)
{
    include_once 'libraries/relation_cleanup.lib.php';
    if (!empty($purge) && mb_strlen($db)) {
        if (mb_strlen($table)) {
            if (isset($column) && mb_strlen($column)) {
                PMA_relationsCleanupColumn($db, $table, $column);
            } else {
                PMA_relationsCleanupTable($db, $table);
            }
        } else {
            PMA_relationsCleanupDatabase($db);
        }
    }
}
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:25,代码来源:sql.lib.php

示例5: PMA_runEventDefinitionsForDb

     // language; each statement is sent one by one
     PMA_runEventDefinitionsForDb($GLOBALS['db']);
 }
 // go back to current db, just in case
 $GLOBALS['dbi']->selectDb($GLOBALS['db']);
 // Duplicate the bookmarks for this db (done once for each db)
 PMA_duplicateBookmarks($_error, $GLOBALS['db']);
 if (!$_error && $move) {
     if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) {
         PMA_AdjustPrivileges_moveDB($GLOBALS['db'], $_REQUEST['newname']);
     }
     /**
      * cleanup pmadb stuff for this db
      */
     include_once 'libraries/relation_cleanup.lib.php';
     PMA_relationsCleanupDatabase($GLOBALS['db']);
     // if someday the RENAME DATABASE reappears, do not DROP
     $local_query = 'DROP DATABASE ' . PMA\libraries\Util::backquote($GLOBALS['db']) . ';';
     $sql_query .= "\n" . $local_query;
     $GLOBALS['dbi']->query($local_query);
     $message = PMA\libraries\Message::success(__('Database %1$s has been renamed to %2$s.'));
     $message->addParam($GLOBALS['db']);
     $message->addParam($_REQUEST['newname']);
 } elseif (!$_error) {
     if (isset($_REQUEST['adjust_privileges']) && !empty($_REQUEST['adjust_privileges'])) {
         PMA_AdjustPrivileges_copyDB($GLOBALS['db'], $_REQUEST['newname']);
     }
     $message = PMA\libraries\Message::success(__('Database %1$s has been copied to %2$s.'));
     $message->addParam($GLOBALS['db']);
     $message->addParam($_REQUEST['newname']);
 } else {
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:31,代码来源:db_operations.php

示例6: testPMARelationsCleanupDatabase

 /**
  * Test for PMA_relationsCleanupDatabase
  *
  * @return void
  */
 public function testPMARelationsCleanupDatabase()
 {
     $db = "PMA";
     $this->redefineRelation();
     //the $cfgRelation value before cleanup column
     $cfgRelation = PMA_checkRelationsParam();
     $this->assertEquals('column_info', $cfgRelation['column_info']);
     $this->assertEquals('bookmark', $cfgRelation['bookmark']);
     $this->assertEquals('table_info', $cfgRelation['table_info']);
     $this->assertEquals('pdf_pages', $cfgRelation['pdf_pages']);
     $this->assertEquals('table_coords', $cfgRelation['table_coords']);
     $this->assertEquals('relation', $cfgRelation['relation']);
     //cleanup
     PMA_relationsCleanupDatabase($db);
     //the value after cleanup column
     $cfgRelation = PMA_checkRelationsParam();
     $is_defined_column_info = isset($cfgRelation['column_info']) ? $cfgRelation['column_info'] : null;
     $is_defined_table_info = isset($cfgRelation['table_info']) ? $cfgRelation['table_info'] : null;
     $is_defined_relation = isset($cfgRelation['relation']) ? $cfgRelation['relation'] : null;
     $is_defined_table_coords = isset($cfgRelation['table_coords']) ? $cfgRelation['table_coords'] : null;
     $this->assertEquals(null, $is_defined_column_info);
     $this->assertEquals(null, $is_defined_table_info);
     $this->assertEquals(null, $is_defined_relation);
     $this->assertEquals(null, $is_defined_table_coords);
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:30,代码来源:PMA_relation_cleanup_test.php

示例7: PMA_getQueryStrFromSelected

/**
 * Gets query results from
 *
 * @param string $query_type  query type
 * @param array  $selected    selected tables
 * @param string $db          db name
 * @param string $table       table name
 * @param string $views       table views
 * @param string $primary     table primary
 * @param string $from_prefix from prefix original
 * @param string $to_prefix   to prefix original
 *
 * @return array
 */
function PMA_getQueryStrFromSelected($query_type, $selected, $db, $table, $views, $primary, $from_prefix, $to_prefix)
{
    $rebuild_database_list = false;
    $reload = null;
    $a_query = null;
    $sql_query = '';
    $sql_query_views = null;
    // whether to run query after each pass
    $run_parts = false;
    // whether to execute the query at the end (to display results)
    $use_sql = false;
    $result = null;
    if ($query_type == 'drop_tbl') {
        $sql_query_views = '';
    }
    $selected_cnt = count($selected);
    $deletes = false;
    for ($i = 0; $i < $selected_cnt; $i++) {
        switch ($query_type) {
            case 'row_delete':
                $deletes = true;
                $a_query = $selected[$i];
                $run_parts = true;
                break;
            case 'drop_db':
                PMA_relationsCleanupDatabase($selected[$i]);
                $a_query = 'DROP DATABASE ' . PMA_Util::backquote($selected[$i]);
                $reload = 1;
                $run_parts = true;
                $rebuild_database_list = true;
                break;
            case 'drop_tbl':
                PMA_relationsCleanupTable($db, $selected[$i]);
                $current = $selected[$i];
                if (!empty($views) && in_array($current, $views)) {
                    $sql_query_views .= (empty($sql_query_views) ? 'DROP VIEW ' : ', ') . PMA_Util::backquote($current);
                } else {
                    $sql_query .= (empty($sql_query) ? 'DROP TABLE ' : ', ') . PMA_Util::backquote($current);
                }
                $reload = 1;
                break;
            case 'check_tbl':
                $sql_query .= (empty($sql_query) ? 'CHECK TABLE ' : ', ') . PMA_Util::backquote($selected[$i]);
                $use_sql = true;
                break;
            case 'optimize_tbl':
                $sql_query .= (empty($sql_query) ? 'OPTIMIZE TABLE ' : ', ') . PMA_Util::backquote($selected[$i]);
                $use_sql = true;
                break;
            case 'analyze_tbl':
                $sql_query .= (empty($sql_query) ? 'ANALYZE TABLE ' : ', ') . PMA_Util::backquote($selected[$i]);
                $use_sql = true;
                break;
            case 'repair_tbl':
                $sql_query .= (empty($sql_query) ? 'REPAIR TABLE ' : ', ') . PMA_Util::backquote($selected[$i]);
                $use_sql = true;
                break;
            case 'empty_tbl':
                $deletes = true;
                $a_query = 'TRUNCATE ';
                $a_query .= PMA_Util::backquote($selected[$i]);
                $run_parts = true;
                break;
            case 'drop_fld':
                PMA_relationsCleanupColumn($db, $table, $selected[$i]);
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) : ',') . ' DROP ' . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ';' : '');
                break;
            case 'primary_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'index_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD INDEX( ' : ', ') . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'unique_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD UNIQUE( ' : ', ') . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'spatial_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD SPATIAL( ' : ', ') . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'fulltext_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD FULLTEXT( ' : ', ') . PMA_Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'add_prefix_tbl':
                $newtablename = $_POST['add_prefix'] . $selected[$i];
                // ADD PREFIX TO TABLE NAME
                $a_query = 'ALTER TABLE ' . PMA_Util::backquote($selected[$i]) . ' RENAME ' . PMA_Util::backquote($newtablename);
//.........这里部分代码省略.........
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:101,代码来源:mult_submits.lib.php

示例8: PMA_buildOrExecuteQueryForMulti

/**
 * Builds or execute queries for multiple elements, depending on $query_type
 *
 * @param string $query_type  query type
 * @param array  $selected    selected tables
 * @param string $db          db name
 * @param string $table       table name
 * @param array  $views       table views
 * @param string $primary     table primary
 * @param string $from_prefix from prefix original
 * @param string $to_prefix   to prefix original
 *
 * @return array
 */
function PMA_buildOrExecuteQueryForMulti($query_type, $selected, $db, $table, $views, $primary, $from_prefix, $to_prefix)
{
    $rebuild_database_list = false;
    $reload = null;
    $a_query = null;
    $sql_query = '';
    $sql_query_views = null;
    // whether to run query after each pass
    $run_parts = false;
    // whether to execute the query at the end (to display results)
    $execute_query_later = false;
    $result = null;
    if ($query_type == 'drop_tbl') {
        $sql_query_views = '';
    }
    $selected_cnt = count($selected);
    $deletes = false;
    $copy_tbl = false;
    for ($i = 0; $i < $selected_cnt; $i++) {
        switch ($query_type) {
            case 'row_delete':
                $deletes = true;
                $a_query = $selected[$i];
                $run_parts = true;
                break;
            case 'drop_db':
                PMA_relationsCleanupDatabase($selected[$i]);
                $a_query = 'DROP DATABASE ' . PMA\libraries\Util::backquote($selected[$i]);
                $reload = 1;
                $run_parts = true;
                $rebuild_database_list = true;
                break;
            case 'drop_tbl':
                PMA_relationsCleanupTable($db, $selected[$i]);
                $current = $selected[$i];
                if (!empty($views) && in_array($current, $views)) {
                    $sql_query_views .= (empty($sql_query_views) ? 'DROP VIEW ' : ', ') . PMA\libraries\Util::backquote($current);
                } else {
                    $sql_query .= (empty($sql_query) ? 'DROP TABLE ' : ', ') . PMA\libraries\Util::backquote($current);
                }
                $reload = 1;
                break;
            case 'check_tbl':
                $sql_query .= (empty($sql_query) ? 'CHECK TABLE ' : ', ') . PMA\libraries\Util::backquote($selected[$i]);
                $execute_query_later = true;
                break;
            case 'optimize_tbl':
                $sql_query .= (empty($sql_query) ? 'OPTIMIZE TABLE ' : ', ') . PMA\libraries\Util::backquote($selected[$i]);
                $execute_query_later = true;
                break;
            case 'analyze_tbl':
                $sql_query .= (empty($sql_query) ? 'ANALYZE TABLE ' : ', ') . PMA\libraries\Util::backquote($selected[$i]);
                $execute_query_later = true;
                break;
            case 'checksum_tbl':
                $sql_query .= (empty($sql_query) ? 'CHECKSUM TABLE ' : ', ') . PMA\libraries\Util::backquote($selected[$i]);
                $execute_query_later = true;
                break;
            case 'repair_tbl':
                $sql_query .= (empty($sql_query) ? 'REPAIR TABLE ' : ', ') . PMA\libraries\Util::backquote($selected[$i]);
                $execute_query_later = true;
                break;
            case 'empty_tbl':
                $deletes = true;
                $a_query = 'TRUNCATE ';
                $a_query .= PMA\libraries\Util::backquote($selected[$i]);
                $run_parts = true;
                break;
            case 'drop_fld':
                PMA_relationsCleanupColumn($db, $table, $selected[$i]);
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) : ',') . ' DROP ' . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ';' : '');
                break;
            case 'primary_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'index_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) . ' ADD INDEX( ' : ', ') . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'unique_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) . ' ADD UNIQUE( ' : ', ') . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'spatial_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) . ' ADD SPATIAL( ' : ', ') . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
                break;
            case 'fulltext_fld':
                $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA\libraries\Util::backquote($table) . ' ADD FULLTEXT( ' : ', ') . PMA\libraries\Util::backquote($selected[$i]) . ($i == $selected_cnt - 1 ? ');' : '');
//.........这里部分代码省略.........
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:101,代码来源:mult_submits.lib.php


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