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


PHP PMA_clearTransformations函数代码示例

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


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

示例1: PMA_deleteTransformationInfo

/**
 * Delete related tranformatioinformationn information
 *
 * @param String $db           current database
 * @param String $table        current table
 * @param array  $analyzed_sql analyzed sql query
 *
 * @return void
 */
function PMA_deleteTransformationInfo($db, $table, $analyzed_sql)
{
    include_once 'libraries/transformations.lib.php';
    if ($analyzed_sql[0]['querytype'] == 'ALTER') {
        $posDrop = mb_stripos($analyzed_sql[0]['unsorted_query'], 'DROP');
        if ($posDrop !== false) {
            $drop_column = PMA_getColumnNameInColumnDropSql($analyzed_sql[0]['unsorted_query']);
            if ($drop_column != '') {
                PMA_clearTransformations($db, $table, $drop_column);
            }
        }
    } else {
        if ($analyzed_sql[0]['querytype'] == 'DROP' && $table != '') {
            PMA_clearTransformations($db, $table);
        }
    }
}
开发者ID:harryboulderdash,项目名称:PlayGFC,代码行数:26,代码来源:sql.lib.php

示例2: testClearTransformations

 /**
  * Test for PMA_clearTransformations
  *
  * @return void
  */
 public function testClearTransformations()
 {
     // Mock dbi
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->any())->method('tryQuery')->will($this->returnValue(true));
     $GLOBALS['dbi'] = $dbi;
     // Case 1 : no configuration storage
     $actual = PMA_clearTransformations('db');
     $this->assertEquals(false, $actual);
     $_SESSION['relation'][$GLOBALS['server']]['PMA_VERSION'] = PMA_VERSION;
     $_SESSION['relation'][$GLOBALS['server']]['column_info'] = "column_info";
     $_SESSION['relation'][$GLOBALS['server']]['db'] = "pmadb";
     // Case 2 : database delete
     $actual = PMA_clearTransformations('db');
     $this->assertEquals(true, $actual);
     // Case 3 : table delete
     $actual = PMA_clearTransformations('db', 'table');
     $this->assertEquals(true, $actual);
     // Case 4 : column delete
     $actual = PMA_clearTransformations('db', 'table', 'col');
     $this->assertEquals(true, $actual);
 }
开发者ID:szepeviktor,项目名称:phpmyadmin,代码行数:27,代码来源:PMA_transformation_test.php

示例3: PMA_deleteTransformationInfo

/**
 * Delete related tranformation information
 *
 * @param String $db                   current database
 * @param String $table                current table
 * @param array  $analyzed_sql_results analyzed sql results
 *
 * @return void
 */
function PMA_deleteTransformationInfo($db, $table, $analyzed_sql_results)
{
    include_once 'libraries/transformations.lib.php';
    $statement = $analyzed_sql_results['statement'];
    if ($statement instanceof SqlParser\Statements\AlterStatement) {
        if (!empty($statement->altered[0]) && $statement->altered[0]->options->has('DROP')) {
            if (!empty($statement->altered[0]->field->column)) {
                PMA_clearTransformations($db, $table, $statement->altered[0]->field->column);
            }
        }
    } elseif ($statement instanceof SqlParser\Statements\DropStatement) {
        PMA_clearTransformations($db, $table);
    }
}
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:23,代码来源:sql.lib.php

示例4: PMA_DBI_select_db

     // end switch
     // All "DROP TABLE", "DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
     // statements will be run at once below
     if ($run_parts) {
         $sql_query .= $a_query . ';' . "\n";
         if ($query_type != 'drop_db') {
             PMA_DBI_select_db($db);
         }
         $result = PMA_DBI_query($a_query);
         if ($query_type == 'drop_db') {
             PMA_clearTransformations($selected[$i]);
         } elseif ($query_type == 'drop_tbl') {
             PMA_clearTransformations($db, $selected[$i]);
         } else {
             if ($query_type == 'drop_fld') {
                 PMA_clearTransformations($db, $table, $selected[$i]);
             }
         }
     }
     // end if
 }
 // end for
 if ($query_type == 'drop_tbl') {
     $default_fk_check_value = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'foreign_key_checks\';', 0, 1) == 'ON' ? 1 : 0;
     if (!empty($sql_query)) {
         $sql_query .= ';';
     } elseif (!empty($sql_query_views)) {
         $sql_query = $sql_query_views . ';';
         unset($sql_query_views);
     }
 }
开发者ID:yxwzaxns,项目名称:sakura,代码行数:31,代码来源:mult_submits.inc.php

示例5: PMA_getColumnNameInColumnDropSql

// end else "didn't ask to see php code"
// No rows returned -> move back to the calling page
if (0 == $num_rows && 0 == $unlim_num_rows || $is_affected) {
    // Delete related tranformation information
    if (!empty($analyzed_sql[0]['querytype']) && ($analyzed_sql[0]['querytype'] == 'ALTER' || $analyzed_sql[0]['querytype'] == 'DROP')) {
        include_once 'libraries/transformations.lib.php';
        if ($analyzed_sql[0]['querytype'] == 'ALTER') {
            if (stripos($analyzed_sql[0]['unsorted_query'], 'DROP') !== false) {
                $drop_column = PMA_getColumnNameInColumnDropSql($analyzed_sql[0]['unsorted_query']);
                if ($drop_column != '') {
                    PMA_clearTransformations($db, $table, $drop_column);
                }
            }
        } else {
            if ($analyzed_sql[0]['querytype'] == 'DROP' && $table != '') {
                PMA_clearTransformations($db, $table);
            }
        }
    }
    if ($is_delete) {
        $message = PMA_Message::getMessageForDeletedRows($num_rows);
    } elseif ($is_insert) {
        if ($is_replace) {
            // For replace we get DELETED + INSERTED row count,
            // so we have to call it affected
            $message = PMA_Message::getMessageForAffectedRows($num_rows);
        } else {
            $message = PMA_Message::getMessageForInsertedRows($num_rows);
        }
        $insert_id = PMA_DBI_insert_id();
        if ($insert_id != 0) {
开发者ID:SashiAsakura,项目名称:AWS_QuikID_website,代码行数:31,代码来源:sql.php

示例6: PMA_getQueryStrFromSelected


//.........这里部分代码省略.........
                $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);
                $run_parts = true;
                break;
            case 'replace_prefix_tbl':
                $current = $selected[$i];
                if (substr($current, 0, strlen($from_prefix)) == $from_prefix) {
                    $newtablename = $to_prefix . substr($current, strlen($from_prefix));
                } else {
                    $newtablename = $current;
                }
                // CHANGE PREFIX PATTERN
                $a_query = 'ALTER TABLE ' . PMA_Util::backquote($selected[$i]) . ' RENAME ' . PMA_Util::backquote($newtablename);
                $run_parts = true;
                break;
            case 'copy_tbl_change_prefix':
                $current = $selected[$i];
                if (substr($current, 0, strlen($from_prefix)) == $from_prefix) {
                    $newtablename = $to_prefix . substr($current, strlen($from_prefix));
                } else {
                    $newtablename = $current;
                }
                $newtablename = $to_prefix . substr($current, strlen($from_prefix));
                // COPY TABLE AND CHANGE PREFIX PATTERN
                $a_query = 'CREATE TABLE ' . PMA_Util::backquote($newtablename) . ' SELECT * FROM ' . PMA_Util::backquote($selected[$i]);
                $run_parts = true;
                break;
        }
        // end switch
        // All "DROP TABLE", "DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
        // statements will be run at once below
        if ($run_parts) {
            $sql_query .= $a_query . ';' . "\n";
            if ($query_type != 'drop_db') {
                $GLOBALS['dbi']->selectDb($db);
            }
            $result = $GLOBALS['dbi']->query($a_query);
            if ($query_type == 'drop_db') {
                PMA_clearTransformations($selected[$i]);
            } elseif ($query_type == 'drop_tbl') {
                PMA_clearTransformations($db, $selected[$i]);
            } else {
                if ($query_type == 'drop_fld') {
                    PMA_clearTransformations($db, $table, $selected[$i]);
                }
            }
        }
        // end if
    }
    // end for
    if ($deletes) {
        $_REQUEST['pos'] = PMA_calculatePosForLastPage($db, $table, $_REQUEST['pos']);
    }
    return array($result, $rebuild_database_list, $reload, $run_parts, $use_sql, $sql_query, $sql_query_views);
}
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:101,代码来源:mult_submits.lib.php

示例7: PMA_buildOrExecuteQueryForMulti


//.........这里部分代码省略.........
            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 ? ');' : '');
                break;
            case 'add_prefix_tbl':
                $newtablename = $_POST['add_prefix'] . $selected[$i];
                // ADD PREFIX TO TABLE NAME
                $a_query = 'ALTER TABLE ' . PMA\libraries\Util::backquote($selected[$i]) . ' RENAME ' . PMA\libraries\Util::backquote($newtablename);
                $run_parts = true;
                break;
            case 'replace_prefix_tbl':
                $current = $selected[$i];
                $subFromPrefix = mb_substr($current, 0, mb_strlen($from_prefix));
                if ($subFromPrefix == $from_prefix) {
                    $newtablename = $to_prefix . mb_substr($current, mb_strlen($from_prefix));
                } else {
                    $newtablename = $current;
                }
                // CHANGE PREFIX PATTERN
                $a_query = 'ALTER TABLE ' . PMA\libraries\Util::backquote($selected[$i]) . ' RENAME ' . PMA\libraries\Util::backquote($newtablename);
                $run_parts = true;
                break;
            case 'copy_tbl_change_prefix':
                $run_parts = true;
                $copy_tbl = true;
                $current = $selected[$i];
                $newtablename = $to_prefix . mb_substr($current, mb_strlen($from_prefix));
                // COPY TABLE AND CHANGE PREFIX PATTERN
                Table::moveCopy($db, $current, $db, $newtablename, 'data', false, 'one_table');
                break;
            case 'copy_tbl':
                $run_parts = true;
                $copy_tbl = true;
                Table::moveCopy($db, $selected[$i], $_POST['target_db'], $selected[$i], $_POST['what'], false, 'one_table');
                if (isset($_POST['adjust_privileges']) && !empty($_POST['adjust_privileges'])) {
                    include_once 'operations.lib.php';
                    PMA_AdjustPrivileges_copyTable($db, $selected[$i], $_POST['target_db'], $selected[$i]);
                }
                break;
        }
        // end switch
        // All "DROP TABLE", "DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
        // statements will be run at once below
        if ($run_parts && !$copy_tbl) {
            $sql_query .= $a_query . ';' . "\n";
            if ($query_type != 'drop_db') {
                $GLOBALS['dbi']->selectDb($db);
            }
            $result = $GLOBALS['dbi']->query($a_query);
            if ($query_type == 'drop_db') {
                PMA_clearTransformations($selected[$i]);
            } elseif ($query_type == 'drop_tbl') {
                PMA_clearTransformations($db, $selected[$i]);
            } else {
                if ($query_type == 'drop_fld') {
                    PMA_clearTransformations($db, $table, $selected[$i]);
                }
            }
        }
        // end if
    }
    // end for
    if ($deletes && !empty($_REQUEST['pos'])) {
        $_REQUEST['pos'] = PMA_calculatePosForLastPage($db, $table, isset($_REQUEST['pos']) ? $_REQUEST['pos'] : null);
    }
    return array($result, $rebuild_database_list, $reload, $run_parts, $execute_query_later, $sql_query, $sql_query_views);
}
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:101,代码来源:mult_submits.lib.php


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