⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sql.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/* $Id: sql.php 9518 2006-10-09 12:35:10Z lem9 $ */// vim: expandtab sw=4 ts=4 sts=4:/** * Set of functions used to build SQL dumps of tables */if (isset($plugin_list)) {    $hide_sql       = false;    $hide_structure = false;    if ($plugin_param['export_type'] == 'table' && !$plugin_param['single_table']) {        $hide_structure = true;        $hide_sql       = true;    }    if (!$hide_sql) {        $plugin_list['sql'] = array(            'text' => 'strSQL',            'extension' => 'sql',            'mime_type' => 'text/x-sql',            'options' => array(                array('type' => 'text', 'name' => 'header_comment', 'text' => 'strAddHeaderComment'),                array('type' => 'bool', 'name' => 'use_transaction', 'text' => 'strEncloseInTransaction'),                array('type' => 'bool', 'name' => 'disable_fk', 'text' => 'strDisableForeignChecks'),                ),            'options_text' => 'strSQLOptions',            );        $compats = PMA_DBI_getCompatibilities();        if (count($compats) > 0) {            $values = array();            foreach($compats as $val) {                $values[$val] = $val;            }            $plugin_list['sql']['options'][] =                array('type' => 'select', 'name' => 'compatibility', 'text' => 'strSQLCompatibility', 'values' => $values, 'doc' => array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));            unset($values);        }        /* Server export options */        if ($plugin_param['export_type'] == 'server') {            $plugin_list['sql']['options'][] =                array('type' => 'bgroup', 'text' => 'strDatabaseExportOptions');            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'drop_database', 'text' => sprintf($GLOBALS['strAddClause'], 'DROP DATABASE'));            $plugin_list['sql']['options'][] =                array('type' => 'egroup');        }        /* Structure options */        if (!$hide_structure) {            $plugin_list['sql']['options'][] =                array('type' => 'bgroup', 'name' => 'structure', 'text' => 'strStructure', 'force' => 'data');            if ($plugin_param['export_type'] == 'table') {                if (PMA_Table::_isView($GLOBALS['db'], $GLOBALS['table'])) {                    $drop_clause = 'DROP VIEW';                } else {                    $drop_clause = 'DROP TABLE';                }            } elseif (PMA_MYSQL_INT_VERSION >= 50000) {                $drop_clause = 'DROP TABLE / DROP VIEW';            } else {                $drop_clause = 'DROP TABLE';            }            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'drop', 'text' => sprintf($GLOBALS['strAddClause'], $drop_clause));            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'if_not_exists', 'text' => sprintf($GLOBALS['strAddClause'], 'IF NOT EXISTS'));            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'auto_increment', 'text' => 'strAddAutoIncrement');            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'backquotes', 'text' => 'strUseBackquotes');            /* MIME stuff etc. */            $plugin_list['sql']['options'][] =                array('type' => 'bgroup', 'text' => 'strAddIntoComments');            $plugin_list['sql']['options'][] =                array('type' => 'bool', 'name' => 'dates', 'text' => 'strCreationDates');            if (!empty($GLOBALS['cfgRelation']['relation'])) {                $plugin_list['sql']['options'][] =                    array('type' => 'bool', 'name' => 'relation', 'text' => 'strRelations');            }            if (!empty($GLOBALS['cfgRelation']['commwork']) && PMA_MYSQL_INT_VERSION < 40100) {                $plugin_list['sql']['options'][] =                    array('type' => 'bool', 'name' => 'comments', 'text' => 'strComments');            }            if (!empty($GLOBALS['cfgRelation']['mimework'])) {                $plugin_list['sql']['options'][] =                    array('type' => 'bool', 'name' => 'mime', 'text' => 'strMIME_MIMEtype');            }            $plugin_list['sql']['options'][] =                array('type' => 'egroup');            $plugin_list['sql']['options'][] =                array('type' => 'egroup');        }        /* Data */        $plugin_list['sql']['options'][] =            array('type' => 'bgroup', 'name' => 'data', 'text' => 'strData', 'force' => 'structure');        $plugin_list['sql']['options'][] =            array('type' => 'bool', 'name' => 'columns', 'text' => 'strCompleteInserts');        $plugin_list['sql']['options'][] =            array('type' => 'bool', 'name' => 'extended', 'text' => 'strExtendedInserts');        $plugin_list['sql']['options'][] =            array('type' => 'text', 'name' => 'max_query_size', 'text' => 'strMaximalQueryLength');        $plugin_list['sql']['options'][] =            array('type' => 'bool', 'name' => 'delayed', 'text' => 'strDelayedInserts');        $plugin_list['sql']['options'][] =            array('type' => 'bool', 'name' => 'ignore', 'text' => 'strIgnoreInserts');        $plugin_list['sql']['options'][] =            array('type' => 'bool', 'name' => 'hex_for_binary', 'text' => 'strHexForBinary');        $plugin_list['sql']['options'][] =            array('type' => 'select', 'name' => 'type', 'text' => 'strSQLExportType', 'values' => array('INSERT', 'UPDATE', 'REPLACE'));        $plugin_list['sql']['options'][] =            array('type' => 'egroup');    }} else {/** * Marker for comments, -- is needed for ANSI SQL. */$GLOBALS['comment_marker'] = '-- ';/** * Avoids undefined variables, use NULL so isset() returns false */if ( ! isset( $sql_backquotes ) ) {    $sql_backquotes = null;}/** * Outputs comment * * @param   string      Text of comment * * @return  bool        Whether it suceeded */function PMA_exportComment($text){    return PMA_exportOutputHandler($GLOBALS['comment_marker'] . $text . $GLOBALS['crlf']);}/** * Outputs export footer * * @return  bool        Whether it suceeded * * @access  public */function PMA_exportFooter(){    global $crlf;    $foot = '';    if (isset($GLOBALS['sql_disable_fk'])) {        $foot .=  $crlf . 'SET FOREIGN_KEY_CHECKS=1;' . $crlf;    }    if (isset($GLOBALS['sql_use_transaction'])) {        $foot .=  $crlf . 'COMMIT;' . $crlf;    }    return PMA_exportOutputHandler($foot);}/** * Outputs export header * * @return  bool        Whether it suceeded * * @access  public */function PMA_exportHeader(){    global $crlf;    global $cfg;    if (PMA_MYSQL_INT_VERSION >= 40100 && isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] != 'NONE') {        PMA_DBI_try_query('SET SQL_MODE="' . $GLOBALS['sql_compatibility'] . '"');    }    $head  =  $GLOBALS['comment_marker'] . 'phpMyAdmin SQL Dump' . $crlf           .  $GLOBALS['comment_marker'] . 'version ' . PMA_VERSION . $crlf           .  $GLOBALS['comment_marker'] . 'http://www.phpmyadmin.net' . $crlf           .  $GLOBALS['comment_marker'] . $crlf           .  $GLOBALS['comment_marker'] . $GLOBALS['strHost'] . ': ' . $cfg['Server']['host'];    if (!empty($cfg['Server']['port'])) {         $head .= ':' . $cfg['Server']['port'];    }    $head .= $crlf           .  $GLOBALS['comment_marker'] . $GLOBALS['strGenTime'] . ': ' . PMA_localisedDate() . $crlf           .  $GLOBALS['comment_marker'] . $GLOBALS['strServerVersion'] . ': ' . substr(PMA_MYSQL_INT_VERSION, 0, 1) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 1, 2) . '.' . (int) substr(PMA_MYSQL_INT_VERSION, 3) . $crlf           .  $GLOBALS['comment_marker'] . $GLOBALS['strPHPVersion'] . ': ' . phpversion() . $crlf;    if (isset($GLOBALS['sql_header_comment']) && !empty($GLOBALS['sql_header_comment'])) {        $lines = explode('\n', $GLOBALS['sql_header_comment']);        $head .= $GLOBALS['comment_marker'] . $crlf               . $GLOBALS['comment_marker'] . implode($crlf . $GLOBALS['comment_marker'], $lines) . $crlf               . $GLOBALS['comment_marker'] . $crlf;    }    if (isset($GLOBALS['sql_disable_fk'])) {        $head .=  $crlf . 'SET FOREIGN_KEY_CHECKS=0;' . $crlf;    }    if (isset($GLOBALS['sql_use_transaction'])) {        $head .=  $crlf .'SET AUTOCOMMIT=0;' . $crlf                . 'START TRANSACTION;' . $crlf . $crlf;    }    return PMA_exportOutputHandler($head);}/** * Outputs create database database * * @param   string      Database name * * @return  bool        Whether it suceeded * * @access  public */function PMA_exportDBCreate($db){    global $crlf;    if (isset($GLOBALS['sql_drop_database'])) {        if (!PMA_exportOutputHandler('DROP DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db) . ';' . $crlf)) {            return FALSE;        }    }    $create_query = 'CREATE DATABASE ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : $db);    if (PMA_MYSQL_INT_VERSION >= 40101) {        $collation = PMA_getDbCollation($db);        if (strpos($collation, '_')) {            $create_query .= ' DEFAULT CHARACTER SET ' . substr($collation, 0, strpos($collation, '_')) . ' COLLATE ' . $collation;        } else {            $create_query .= ' DEFAULT CHARACTER SET ' . $collation;        }    }    $create_query .= ';' . $crlf;    if (!PMA_exportOutputHandler($create_query)) {        return FALSE;    }    if (isset($GLOBALS['sql_backquotes']) && PMA_MYSQL_INT_VERSION >= 40100 && isset($GLOBALS['sql_compatibility']) && $GLOBALS['sql_compatibility'] == 'NONE') {        return PMA_exportOutputHandler('USE ' . PMA_backquote($db) . ';' . $crlf);    }    return PMA_exportOutputHandler('USE ' . $db . ';' . $crlf);}/** * Outputs database header * * @param   string      Database name * * @return  bool        Whether it suceeded * * @access  public */function PMA_exportDBHeader($db){    global $crlf;    $head = $GLOBALS['comment_marker'] . $crlf          . $GLOBALS['comment_marker'] . $GLOBALS['strDatabase'] . ': ' . (isset($GLOBALS['sql_backquotes']) ? PMA_backquote($db) : '\'' . $db . '\''). $crlf          . $GLOBALS['comment_marker'] . $crlf;    return PMA_exportOutputHandler($head);}/** * Outputs database footer * * @param   string      Database name * * @return  bool        Whether it suceeded * * @access  public */function PMA_exportDBFooter($db){    global $crlf, $comment_marker;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -