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


PHP PMA_relationsCleanupColumn函数代码示例

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


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

示例3: PMA_backquote

         break;
     case 'repair_tbl':
         $sql_query .= (empty($sql_query) ? 'REPAIR TABLE ' : ', ') . PMA_backquote(urldecode($selected[$i]));
         $use_sql = TRUE;
         break;
     case 'empty_tbl':
         if (PMA_MYSQL_INT_VERSION >= 40000) {
             $a_query = 'TRUNCATE ';
         } else {
             $a_query = 'DELETE FROM ';
         }
         $a_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])));
         $run_parts = TRUE;
         break;
     case 'drop_fld':
         PMA_relationsCleanupColumn($db, $table, $selected[$i]);
         $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) : ',') . ' DROP ' . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ';' : '');
         break;
     case 'primary_fld':
         $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ') . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ');' : '');
         break;
     case 'index_fld':
         $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX( ' : ', ') . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ');' : '');
         break;
     case 'unique_fld':
         $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE( ' : ', ') . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ');' : '');
         break;
     case 'fulltext_fld':
         $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT( ' : ', ') . PMA_backquote(urldecode($selected[$i])) . ($i == $selected_cnt - 1 ? ');' : '');
         break;
 }
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:31,代码来源:mult_submits.inc.php

示例4: PMA_relationsCleanupTable

     if (isset($purge) && $purge == '1') {
         require_once './libraries/relation_cleanup.lib.php';
         if (isset($table) && isset($db) && strlen($table) && strlen($db)) {
             PMA_relationsCleanupTable($db, $table);
         } elseif (isset($db) && strlen($db)) {
             PMA_relationsCleanupDatabase($db);
         } else {
             // garvin: VOID. No DB/Table gets deleted.
         }
         // end if relation-stuff
     }
     // end if ($purge)
     // garvin: If a column gets dropped, do relation magic.
     if (isset($cpurge) && $cpurge == '1' && isset($purgekey) && isset($db) && isset($table) && strlen($db) && strlen($table) && !empty($purgekey)) {
         require_once './libraries/relation_cleanup.lib.php';
         PMA_relationsCleanupColumn($db, $table, $purgekey);
     }
     // end if column PMA_* purge
 }
 // end else "didn't ask to see php code"
 // No rows returned -> move back to the calling page
 if ($num_rows < 1 || $is_affected) {
     if ($is_delete) {
         $message = $strDeletedRows . '&nbsp;' . $num_rows;
     } elseif ($is_insert) {
         if ($is_replace) {
             /* For replace we get DELETED + INSERTED row count, so we have to call it affected */
             $message = $strAffectedRows . '&nbsp;' . $num_rows;
         } else {
             $message = $strInsertedRows . '&nbsp;' . $num_rows;
         }
开发者ID:robmat,项目名称:samplebator,代码行数:31,代码来源:sql.php

示例5: testPMARelationsCleanupColumn

 /**
  * Test for PMA_relationsCleanupColumn
  *
  * @return void
  * @group medium
  */
 public function testPMARelationsCleanupColumn()
 {
     $db = "PMA";
     $table = "PMA_bookmark";
     $column = "name";
     $this->redefineRelation();
     //the $cfgRelation value before cleanup column
     $cfgRelation = PMA_checkRelationsParam();
     $this->assertEquals(true, $cfgRelation['commwork']);
     //validate PMA_getDbComments when commwork = true
     $db_comments = PMA_getDbComments();
     $this->assertEquals(array('db_name0' => 'comment0', 'db_name1' => 'comment1'), $db_comments);
     $this->assertEquals(true, $cfgRelation['displaywork']);
     //validate PMA_getDisplayField when displaywork = true
     $display_field = PMA_getDisplayField($db, $table);
     $this->assertEquals('PMA_display_field', $display_field);
     $this->assertEquals(true, $cfgRelation['relwork']);
     $this->assertEquals('column_info', $cfgRelation['column_info']);
     $this->assertEquals('table_info', $cfgRelation['table_info']);
     $this->assertEquals('relation', $cfgRelation['relation']);
     //cleanup
     PMA_relationsCleanupColumn($db, $table, $column);
     //the $cfgRelation 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;
     $this->assertEquals(null, $is_defined_column_info);
     $this->assertEquals(null, $is_defined_table_info);
     $this->assertEquals(null, $is_defined_relation);
 }
开发者ID:flash1452,项目名称:phpmyadmin,代码行数:37,代码来源:PMA_relation_cleanup_test.php

示例6: 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

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