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


PHP PMA_getTableDef函数代码示例

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


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

示例1: makedump

function makedump($table_select, $what, $db, $crlf = "\n")
{
    global $dump_buffer, $tmp_buffer;
    $tables = mysql_list_tables($db);
    $num_tables = mysql_numrows($tables);
    $dump_buffer = '';
    $tmp_buffer = '';
    $i = 0;
    while ($i < $num_tables) {
        $table = mysql_tablename($tables, $i);
        if (!isset($table_select[$table])) {
            $i++;
            continue;
        }
        if ($what != 'dataonly') {
            $dump_buffer .= PMA_getTableDef($db, $table, $crlf) . ';' . $crlf . $crlf;
        }
        if ($what == 'data' || $what == 'dataonly') {
            $tmp_buffer = '';
            PMA_getTableContent($db, $table, 0, 0, 'PMA_myHandler', $crlf);
            $dump_buffer .= $tmp_buffer . $crlf;
        }
        $i++;
    }
    return $dump_buffer;
}
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:26,代码来源:dump_functions.php

示例2: backup_mysql_fn

function backup_mysql_fn($shost, $suser, $spass, $sdb, $sdbfile)
{
    //echo $shost.' == '. $suser.' == '. $spass.' == '. $sdb.' == '. $sdbfile;
    $link = mysql_connect($shost, $suser, $spass);
    mysql_query('SET CHARACTER SET utf8');
    // Open and create a file handle for sql.
    $handle = fopen($sdbfile, 'w');
    $s_def = $alter_queries = $sresponse = '';
    $sql_alter = $tables = array();
    $ser_ver = PMA_sversion();
    $s_def = PMA_exportHeader($sdb, $ser_ver);
    fwrite($handle, $s_def);
    // List the tables
    $squery = mysql_query('SHOW TABLES FROM `' . $sdb . '`');
    while ($row = mysql_fetch_row($squery)) {
        $tables[] = $row[0];
    }
    // Sort the tables
    usort($tables, 'strnatcasecmp');
    foreach ($tables as $table => $v) {
        // Get the table structure(table definition)
        $stable_defn = PMA_getTableDef($sdb, $v, "\n");
        $s_def = $stable_defn['structure'] . "\n";
        fwrite($handle, $s_def);
        // Get the table data(table contents)
        // We have added $handle so that we can write the INSERT queries directly when we get it.
        // Basically To avoid MEMORY EXHAUST FOR  BIG INSERTS
        PMA_exportData($sdb, $v, "\n", $handle);
        // List of alter queries
        // We have changed this because the OLD method was putting the ALTER queries after CREATE table query which was causing issues.
        if (!empty($stable_defn['alter'])) {
            $alter_queries .= $stable_defn['alter'];
        }
    }
    fwrite($handle, $alter_queries);
    $sresponse = PMA_exportFooter();
    // Just to add the finishing lines
    fwrite($handle, $sresponse);
    fclose($handle);
    // Just check that file is created or not ??
    if (file_exists($sdbfile)) {
        return true;
    }
    return false;
}
开发者ID:Hezkibel,项目名称:soft,代码行数:45,代码来源:myback.php

示例3: moveCopy

 /**
  * Copies or renames table
  * @todo use RENAME for move operations
  *        - would work only if the databases are on the same filesystem,
  *          how can we check that? try the operation and
  *          catch an error?
  *        - for views, only if MYSQL > 50013
  *        - still have to handle pmadb synch.
  *
  * @author          Michal Cihar <michal@cihar.com>
  */
 function moveCopy($source_db, $source_table, $target_db, $target_table, $what, $move, $mode)
 {
     global $err_url;
     // set export settings we need
     $GLOBALS['sql_backquotes'] = 1;
     $GLOBALS['asfile'] = 1;
     // Ensure the target is valid
     if (!$GLOBALS['PMA_List_Database']->exists($source_db, $target_db)) {
         /**
          * @todo exit really needed here? or just a return?
          */
         exit;
     }
     $source = PMA_backquote($source_db) . '.' . PMA_backquote($source_table);
     if (!isset($target_db) || !strlen($target_db)) {
         $target_db = $source_db;
     }
     // Doing a select_db could avoid some problems with replicated databases,
     // when moving table from replicated one to not replicated one
     PMA_DBI_select_db($target_db);
     $target = PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
     // do not create the table if dataonly
     if ($what != 'dataonly') {
         require_once './libraries/export/sql.php';
         $no_constraints_comments = true;
         $GLOBALS['sql_constraints_query'] = '';
         $sql_structure = PMA_getTableDef($source_db, $source_table, "\n", $err_url);
         unset($no_constraints_comments);
         $parsed_sql = PMA_SQP_parse($sql_structure);
         $analyzed_sql = PMA_SQP_analyze($parsed_sql);
         $i = 0;
         if (empty($analyzed_sql[0]['create_table_fields'])) {
             // this is not a CREATE TABLE, so find the first VIEW
             $target_for_view = PMA_backquote($target_db);
             while (true) {
                 if ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'VIEW') {
                     break;
                 }
                 $i++;
             }
         }
         unset($analyzed_sql);
         $server_sql_mode = PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'sql_mode'", 0, 1);
         if ('ANSI_QUOTES' == $server_sql_mode) {
             $table_delimiter = 'quote_double';
         } else {
             $table_delimiter = 'quote_backtick';
         }
         unset($server_sql_mode);
         /* nijel: Find table name in query and replace it */
         while ($parsed_sql[$i]['type'] != $table_delimiter) {
             $i++;
         }
         /* no need to PMA_backquote() */
         if (isset($target_for_view)) {
             // this a view definition; we just found the first db name
             // that follows DEFINER VIEW
             // so change it for the new db name
             $parsed_sql[$i]['data'] = $target_for_view;
             // then we have to find all references to the source db
             // and change them to the target db, ensuring we stay into
             // the $parsed_sql limits
             $last = $parsed_sql['len'] - 1;
             $backquoted_source_db = PMA_backquote($source_db);
             for (++$i; $i <= $last; $i++) {
                 if ($parsed_sql[$i]['type'] == $table_delimiter && $parsed_sql[$i]['data'] == $backquoted_source_db) {
                     $parsed_sql[$i]['data'] = $target_for_view;
                 }
             }
             unset($last, $backquoted_source_db);
         } else {
             $parsed_sql[$i]['data'] = $target;
         }
         /* Generate query back */
         $sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
         // If table exists, and 'add drop table' is selected: Drop it!
         $drop_query = '';
         if (isset($GLOBALS['drop_if_exists']) && $GLOBALS['drop_if_exists'] == 'true') {
             if (PMA_Table::_isView($target_db, $target_table)) {
                 $drop_query = 'DROP VIEW';
             } else {
                 $drop_query = 'DROP TABLE';
             }
             $drop_query .= ' IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
             PMA_DBI_query($drop_query);
             $GLOBALS['sql_query'] .= "\n" . $drop_query . ';';
             // garvin: If an existing table gets deleted, maintain any
             // entries for the PMA_* tables
             $maintain_relations = true;
//.........这里部分代码省略.........
开发者ID:jmathai,项目名称:photos,代码行数:101,代码来源:Table.class.php

示例4: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string  $db           database name
  * @param string  $table        table name
  * @param string  $crlf         the end of line sequence
  * @param string  $error_url    the url to go back in case of error
  * @param bool    $relation     whether to include relation comments
  * @param bool    $comments     whether to include the pmadb-style column comments
  *                                as comments in the structure; this is deprecated
  *                                but the parameter is left here because export.php
  *                                calls PMA_exportStructure() also for other export
  *                                types which use this parameter
  * @param bool    $mime         whether to include mime comments
  * @param bool    $dates        whether to include creation/update/check dates
  * @param string  $export_mode  'create_table', 'triggers', 'create_view', 'stand_in'
  * @param string  $export_type  'server', 'database', 'table'
  * @return  bool      Whether it succeeded
  *
  * @access  public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = false, $comments = false, $mime = false, $dates = false, $export_mode, $export_type)
 {
     $formatted_table_name = isset($GLOBALS['sql_backquotes']) ? PMA_backquote($table) : '\'' . $table . '\'';
     $dump = PMA_possibleCRLF() . PMA_exportComment(str_repeat('-', 56)) . PMA_possibleCRLF() . PMA_exportComment();
     switch ($export_mode) {
         case 'create_table':
             $dump .= PMA_exportComment(__('Table structure for table') . ' ' . $formatted_table_name);
             $dump .= PMA_exportComment();
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates);
             $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $mime);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= PMA_possibleCRLF() . PMA_exportComment() . PMA_exportComment(__('Triggers') . ' ' . $formatted_table_name) . PMA_exportComment();
                 $delimiter = '//';
                 foreach ($triggers as $trigger) {
                     $dump .= $trigger['drop'] . ';' . $crlf;
                     $dump .= 'DELIMITER ' . $delimiter . $crlf;
                     $dump .= $trigger['create'];
                     $dump .= 'DELIMITER ;' . $crlf;
                 }
             }
             break;
         case 'create_view':
             $dump .= PMA_exportComment(__('Structure for view') . ' ' . $formatted_table_name) . PMA_exportComment();
             // delete the stand-in table previously created (if any)
             if ($export_type != 'table') {
                 $dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
             }
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= PMA_exportComment(__('Stand-in structure for view') . ' ' . $formatted_table_name) . PMA_exportComment();
             // export a stand-in definition to resolve view dependencies
             $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     // this one is built by PMA_getTableDef() to use in table copy/move
     // but not in the case of export
     unset($GLOBALS['sql_constraints_query']);
     return PMA_exportOutputHandler($dump);
 }
开发者ID:kirhgoph,项目名称:VMWare-Workstation-web-interface,代码行数:65,代码来源:sql.php

示例5: unset

     unset($original_db);
     // rebuild the database list because PMA_Table::moveCopy
     // checks in this list if the target db exists
     $GLOBALS['pma']->databases->build();
 }
 if (isset($GLOBALS['add_constraints']) || $move) {
     $GLOBALS['sql_constraints_query_full_db'] = array();
 }
 $tables_full = PMA_DBI_get_tables_full($db);
 $views = array();
 // remove all foreign key constraints, otherwise we can get errors
 require_once './libraries/export/sql.php';
 foreach ($tables_full as $each_table => $tmp) {
     $sql_constraints = '';
     $sql_drop_foreign_keys = '';
     $sql_structure = PMA_getTableDef($db, $each_table, "\n", '', false, false);
     if ($move && !empty($sql_drop_foreign_keys)) {
         PMA_DBI_query($sql_drop_foreign_keys);
     }
     // keep the constraint we just dropped
     if (!empty($sql_constraints)) {
         $GLOBALS['sql_constraints_query_full_db'][] = $sql_constraints;
     }
 }
 unset($sql_constraints, $sql_drop_foreign_keys, $sql_structure);
 foreach ($tables_full as $each_table => $tmp) {
     // to be able to rename a db containing views, we
     // first collect in $views all the views we find and we
     // will handle them after the tables
     /**
      * @todo support a view of a view
开发者ID:kolbermoorer,项目名称:edugame,代码行数:31,代码来源:db_operations.php

示例6: isset

 if ($db == $target_db && $new_name == $table) {
     $message = isset($submit_move) ? $strMoveTableSameNames : $strCopyTableSameNames;
 } else {
     $source = PMA_backquote($db) . '.' . PMA_backquote($table);
     if (empty($target_db)) {
         $target_db = $db;
     }
     // This could avoid some problems with replicated databases, when
     // moving table from replicated one to not replicated one
     PMA_mysql_select_db($target_db);
     $target = PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
     // do not create the table if dataonly
     if ($what != 'dataonly') {
         require './libraries/export/sql.php';
         $no_constraints_comments = true;
         $sql_structure = PMA_getTableDef($db, $table, "\n", $err_url);
         unset($no_constraints_comments);
         $parsed_sql = PMA_SQP_parse($sql_structure);
         /* nijel: Find table name in query and replace it */
         $i = 0;
         while ($parsed_sql[$i]['type'] != 'quote_backtick') {
             $i++;
         }
         /* no need to PMA_backquote() */
         $parsed_sql[$i]['data'] = $target;
         /* Generate query back */
         $sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
         // If table exists, and 'add drop table' is selected: Drop it!
         $drop_query = '';
         if (isset($drop_if_exists) && $drop_if_exists == 'true') {
             $drop_query = 'DROP TABLE IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($new_name);
开发者ID:quartemer,项目名称:xoopserver,代码行数:31,代码来源:tbl_move_copy.php

示例7: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param   string   the database name
  * @param   string   the table name
  * @param   string   the end of line sequence
  * @param   string   the url to go back in case of error
  * @param   boolean  whether to include relation comments
  * @param   boolean  whether to include column comments
  * @param   boolean  whether to include mime comments
  * @param   string   'stand_in', 'create_table', 'create_view' 
  * @param   string   'server', 'database', 'table' 
  *
  * @return  bool     Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE, $export_mode, $export_type)
 {
     $formatted_table_name = isset($GLOBALS['sql_backquotes']) ? PMA_backquote($table) : '\'' . $table . '\'';
     $dump = $crlf . $GLOBALS['comment_marker'] . '--------------------------------------------------------' . $crlf . $crlf . $GLOBALS['comment_marker'] . $crlf;
     switch ($export_mode) {
         case 'create_table':
             $dump .= $GLOBALS['comment_marker'] . $GLOBALS['strTableStructure'] . ' ' . $formatted_table_name . $crlf . $GLOBALS['comment_marker'] . $crlf;
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf;
             break;
         case 'create_view':
             $dump .= $GLOBALS['comment_marker'] . $GLOBALS['strStructureForView'] . ' ' . $formatted_table_name . $crlf . $GLOBALS['comment_marker'] . $crlf;
             // delete the stand-in table previously created (if any)
             if ($export_type != 'table') {
                 $dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
             }
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf;
             break;
         case 'stand_in':
             $dump .= $GLOBALS['comment_marker'] . $GLOBALS['strStandInStructureForView'] . ' ' . $formatted_table_name . $crlf . $GLOBALS['comment_marker'] . $crlf;
             // export a stand-in definition to resolve view dependencies
             $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     $dump .= PMA_getTableComments($db, $table, $crlf, $relation, $comments, $mime);
     // this one is built by PMA_getTableDef() to use in table copy/move
     // but not in the case of export
     unset($GLOBALS['sql_constraints_query']);
     return PMA_exportOutputHandler($dump);
 }
开发者ID:jyyy410team,项目名称:hts,代码行数:46,代码来源:sql.php

示例8: PMA_exportStructure

/**
 * Outputs table's structure
 *
 * @param   string   the database name
 * @param   string   the table name
 * @param   string   the end of line sequence
 * @param   string   the url to go back in case of error
 * @param   boolean  whether to include relation comments
 * @param   boolean  whether to include column comments
 * @param   boolean  whether to include mime comments
 *
 * @return  bool     Whether it suceeded
 *
 * @access  public
 */
function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE)
{
    $formatted_table_name = isset($GLOBALS['use_backquotes']) ? PMA_backquote($table) : '\'' . $table . '\'';
    $dump = $crlf . $GLOBALS['comment_marker'] . '--------------------------------------------------------' . $crlf . $crlf . $GLOBALS['comment_marker'] . $crlf . $GLOBALS['comment_marker'] . $GLOBALS['strTableStructure'] . ' ' . $formatted_table_name . $crlf . $GLOBALS['comment_marker'] . $crlf . PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf . PMA_getTableComments($db, $table, $crlf, $relation, $comments, $mime);
    return PMA_exportOutputHandler($dump);
}
开发者ID:lifecom,项目名称:test,代码行数:21,代码来源:sql.php

示例9: PMA_table_move_copy

/**
 * Copies or renames table
 * FIXME: use RENAME
 *
 * @author          Michal Čihař <michal@cihar.com>
 */
function PMA_table_move_copy($source_db, $source_table, $target_db, $target_table, $what, $move)
{
    global $cfgRelation, $dblist, $err_url, $sql_query;
    // set export settings we need
    $GLOBALS['use_backquotes'] = 1;
    $GLOBALS['asfile'] = 1;
    // Ensure the target is valid
    if (count($dblist) > 0 && (PMA_isInto($source_db, $dblist) == -1 || PMA_isInto($target_db, $dblist) == -1)) {
        exit;
    }
    $source = PMA_backquote($source_db) . '.' . PMA_backquote($source_table);
    if (empty($target_db)) {
        $target_db = $source_db;
    }
    // This could avoid some problems with replicated databases, when
    // moving table from replicated one to not replicated one
    PMA_DBI_select_db($target_db);
    $target = PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
    // do not create the table if dataonly
    if ($what != 'dataonly') {
        require_once './libraries/export/sql.php';
        $no_constraints_comments = true;
        $sql_structure = PMA_getTableDef($source_db, $source_table, "\n", $err_url);
        unset($no_constraints_comments);
        $parsed_sql = PMA_SQP_parse($sql_structure);
        /* nijel: Find table name in query and replace it */
        $i = 0;
        while ($parsed_sql[$i]['type'] != 'quote_backtick') {
            $i++;
        }
        /* no need to PMA_backquote() */
        $parsed_sql[$i]['data'] = $target;
        /* Generate query back */
        $sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only');
        // If table exists, and 'add drop table' is selected: Drop it!
        $drop_query = '';
        if (isset($GLOBALS['drop_if_exists']) && $GLOBALS['drop_if_exists'] == 'true') {
            $drop_query = 'DROP TABLE IF EXISTS ' . PMA_backquote($target_db) . '.' . PMA_backquote($target_table);
            $result = PMA_DBI_query($drop_query);
            if (isset($sql_query)) {
                $sql_query .= "\n" . $drop_query . ';';
            } else {
                $sql_query = $drop_query . ';';
            }
            // garvin: If an existing table gets deleted, maintain any entries
            // for the PMA_* tables
            $maintain_relations = TRUE;
        }
        $result = @PMA_DBI_query($sql_structure);
        if (isset($sql_query)) {
            $sql_query .= "\n" . $sql_structure . ';';
        } else {
            $sql_query = $sql_structure . ';';
        }
        if (($move || isset($GLOBALS['constraints'])) && isset($GLOBALS['sql_constraints'])) {
            $parsed_sql = PMA_SQP_parse($GLOBALS['sql_constraints']);
            $i = 0;
            while ($parsed_sql[$i]['type'] != 'quote_backtick') {
                $i++;
            }
            /* no need to PMA_backquote() */
            $parsed_sql[$i]['data'] = $target;
            /* Generate query back */
            $GLOBALS['sql_constraints'] = PMA_SQP_formatHtml($parsed_sql, 'query_only');
            $result = PMA_DBI_query($GLOBALS['sql_constraints']);
            if (isset($sql_query)) {
                $sql_query .= "\n" . $GLOBALS['sql_constraints'];
            } else {
                $sql_query = $GLOBALS['sql_constraints'];
            }
            unset($GLOBALS['sql_constraints']);
        }
    } else {
        $sql_query = '';
    }
    // Copy the data
    //if ($result != FALSE && ($what == 'data' || $what == 'dataonly')) {
    if ($what == 'data' || $what == 'dataonly') {
        $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
        PMA_DBI_query($sql_insert_data);
        $sql_query .= "\n\n" . $sql_insert_data . ';';
    }
    require_once './libraries/relation.lib.php';
    $cfgRelation = 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
        PMA_DBI_select_db($source_db);
        $sql_drop_table = 'DROP TABLE ' . $source;
        PMA_DBI_query($sql_drop_table);
        // garvin: Move old entries from PMA-DBs to new table
        if ($cfgRelation['commwork']) {
            $remove_query = 'UPDATE ' . PMA_backquote($cfgRelation['column_info']) . ' SET     table_name = \'' . PMA_sqlAddslashes($target_table) . '\', ' . '        db_name    = \'' . PMA_sqlAddslashes($target_db) . '\'' . ' WHERE db_name  = \'' . PMA_sqlAddslashes($source_db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($source_table) . '\'';
//.........这里部分代码省略.........
开发者ID:dapfru,项目名称:gladiators,代码行数:101,代码来源:tbl_move_copy.php

示例10: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param   string   the database name
  * @param   string   the table name
  * @param   string   the end of line sequence
  * @param   string   the url to go back in case of error
  * @param   boolean  whether to include relation comments
  * @param   boolean  whether to include column comments
  * @param   boolean  whether to include mime comments
  *
  * @return  bool     Whether it suceeded
  *
  * @access  public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE)
 {
     $formatted_table_name = isset($GLOBALS['sql_backquotes']) ? PMA_backquote($table) : '\'' . $table . '\'';
     $dump = $crlf . $GLOBALS['comment_marker'] . '--------------------------------------------------------' . $crlf . $crlf . $GLOBALS['comment_marker'] . $crlf . $GLOBALS['comment_marker'] . $GLOBALS['strTableStructure'] . ' ' . $formatted_table_name . $crlf . $GLOBALS['comment_marker'] . $crlf . PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf . PMA_getTableComments($db, $table, $crlf, $relation, $comments, $mime);
     // this one is built by PMA_getTableDef() to use in table copy/move
     // but not in the case of export
     unset($GLOBALS['sql_constraints_query']);
     return PMA_exportOutputHandler($dump);
 }
开发者ID:Vinhbaba,项目名称:871128qlchbs,代码行数:24,代码来源:sql.php

示例11: implode

 $i = 0;
 if (isset($table_select)) {
     $tmp_select = implode($table_select, '|');
     $tmp_select = '|' . $tmp_select . '|';
 }
 while ($i < $num_tables) {
     if (!isset($single)) {
         $table = mysql_tablename($tables, $i);
     }
     if (isset($tmp_select) && is_int(strpos($tmp_select, '|' . $table . '|')) == FALSE) {
         $i++;
     } else {
         $formatted_table_name = isset($use_backquotes) ? PMA_backquote($table) : '\'' . $table . '\'';
         // If only datas, no need to displays table name
         if ($what != 'dataonly') {
             $dump_buffer .= '# --------------------------------------------------------' . $crlf . $crlf . '#' . $crlf . '# ' . $strTableStructure . ' ' . $formatted_table_name . $crlf . '#' . $crlf . $crlf . PMA_getTableDef($db, $table, $crlf, $err_url) . ';' . $crlf;
         }
         // At least data
         if ($what == 'data' || $what == 'dataonly') {
             $dump_buffer .= $crlf . '#' . $crlf . '# ' . $strDumpingData . ' ' . $formatted_table_name . $crlf . '#' . $crlf . $crlf;
             $tmp_buffer = '';
             if (!isset($limit_from) || !isset($limit_to)) {
                 $limit_from = $limit_to = 0;
             }
             // loic1: display data if they aren't bufferized
             if (!isset($zip) && !isset($bzip) && !isset($gzip)) {
                 echo $dump_buffer;
                 $dump_buffer = '';
             }
             PMA_getTableContent($db, $table, $limit_from, $limit_to, 'PMA_myHandler', $err_url);
             $dump_buffer .= $tmp_buffer;
开发者ID:jgatica,项目名称:Netoffice,代码行数:31,代码来源:tbl_dump.php

示例12: createVersion

 /**
  * Creates tracking version of a table / view
  * (in other words: create a job to track future changes on the table).
  *
  * @static
  *
  * @param  string $dbname       name of database
  * @param  string $tablename    name of table
  * @param  string $version      version
  * @param  string $tracking_set set of tracking statements
  * @param  string $is_view      if table is a view
  *
  * @return int result of version insertion
  */
 public static function createVersion($dbname, $tablename, $version, $tracking_set = '', $is_view = false)
 {
     global $sql_backquotes;
     if ($tracking_set == '') {
         $tracking_set = self::$default_tracking_set;
     }
     require_once './libraries/export/sql.php';
     $sql_backquotes = true;
     $date = date('Y-m-d H:i:s');
     // Get data definition snapshot of table
     $sql_query = '
     SHOW FULL COLUMNS FROM ' . PMA_backquote($dbname) . '.' . PMA_backquote($tablename);
     $sql_result = PMA_DBI_query($sql_query);
     while ($row = PMA_DBI_fetch_array($sql_result)) {
         $columns[] = $row;
     }
     $sql_query = '
     SHOW INDEX FROM ' . PMA_backquote($dbname) . '.' . PMA_backquote($tablename);
     $sql_result = PMA_DBI_query($sql_query);
     $indexes = array();
     while ($row = PMA_DBI_fetch_array($sql_result)) {
         $indexes[] = $row;
     }
     $snapshot = array('COLUMNS' => $columns, 'INDEXES' => $indexes);
     $snapshot = serialize($snapshot);
     // Get DROP TABLE / DROP VIEW and CREATE TABLE SQL statements
     $sql_backquotes = true;
     $create_sql = "";
     if (self::$add_drop_table == true && $is_view == false) {
         $create_sql .= self::getLogComment() . self::getStatementDropTable(PMA_backquote($tablename)) . ";\n";
     }
     if (self::$add_drop_view == true && $is_view == true) {
         $create_sql .= self::getLogComment() . self::getStatementDropView(PMA_backquote($tablename)) . ";\n";
     }
     $create_sql .= self::getLogComment() . PMA_getTableDef($dbname, $tablename, "\n", "");
     // Save version
     $sql_query = "/*NOTRACK*/\n" . "INSERT INTO" . self::$pma_table . " (" . "db_name, " . "table_name, " . "version, " . "date_created, " . "date_updated, " . "schema_snapshot, " . "schema_sql, " . "data_sql, " . "tracking " . ") " . "values (\n        '" . PMA_sqlAddslashes($dbname) . "',\n        '" . PMA_sqlAddslashes($tablename) . "',\n        '" . PMA_sqlAddslashes($version) . "',\n        '" . PMA_sqlAddslashes($date) . "',\n        '" . PMA_sqlAddslashes($date) . "',\n        '" . PMA_sqlAddslashes($snapshot) . "',\n        '" . PMA_sqlAddslashes($create_sql) . "',\n        '" . PMA_sqlAddslashes("\n") . "',\n        '" . PMA_sqlAddslashes($tracking_set) . "' )";
     $result = PMA_query_as_controluser($sql_query);
     if ($result) {
         // Deactivate previous version
         self::deactivateTracking($dbname, $tablename, $version - 1);
     }
     return $result;
 }
开发者ID:kolbermoorer,项目名称:edugame,代码行数:58,代码来源:Tracker.class.php

示例13: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  *                                export types which use this parameter
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     $dump = '';
     switch ($export_mode) {
         case 'create_table':
             $dump .= '<h2>' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $dump = '';
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $dump .= '<h2>' . __('Triggers') . ' ' . htmlspecialchars($table) . '</h2>';
                 $dump .= PMA_getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $dump .= '<h2>' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             $dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $dump .= '<h2>' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</h2>';
             // export a stand-in definition to resolve view dependencies
             $dump .= PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return PMA_exportOutputHandler($dump);
 }
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:52,代码来源:htmlword.php

示例14: implode

     $tmp_select = implode($table_select, "|");
     $tmp_select = "|" . $tmp_select . "|";
 }
 while ($i < $num_tables) {
     if (!isset($single)) {
         $table = mysql_tablename($tables, $i);
     } else {
         $table = $tables[$i];
     }
     if (isset($tmp_select) && is_int(strpos($tmp_select, "|" . $table . "|")) == FALSE) {
         $i++;
     } else {
         $formatted_table_name = isset($GLOBALS["_POST"]["use_backquotes"]) ? PMA_backquote($table) : "'" . $table . "'";
         // If only datas, no need to displays table name
         if ($GLOBALS["_POST"]["what"] != "dataonly") {
             $dump_buffer .= "# --------------------------------------------------------" . $crlf . $crlf . "#" . $crlf . "# " . $strTableStructure . " " . $formatted_table_name . $crlf . "#" . $crlf . $crlf . PMA_getTableDef($db, $table, $crlf) . ";" . $crlf;
         }
         // At least data
         if ($GLOBALS["_POST"]["what"] == "data" || $GLOBALS["_POST"]["what"] == "dataonly") {
             $tcmt = $crlf . "#" . $crlf . "# " . $strDumpingData . " " . $formatted_table_name . $crlf . "#" . $crlf . $crlf;
             $dump_buffer .= $tcmt;
             $tmp_buffer = "";
             /* swapfile */
             swapfile_putdata($dump_buffer);
             /* swapfile */
             PMA_getTableContentFast($db, $table, $add_query, "PMA_myHandler", $exptype);
             $dump_buffer .= $tmp_buffer;
         }
         // end if
         $i++;
     }
开发者ID:romlg,项目名称:cms36,代码行数:31,代码来源:tbl_dump.php

示例15: PMA_exportStructure

 /**
  * Outputs table's structure
  *
  * @param string $db          database name
  * @param string $table       table name
  * @param string $crlf        the end of line sequence
  * @param string $error_url   the url to go back in case of error
  * @param string $export_mode 'create_table', 'triggers', 'create_view',
  *                            'stand_in'
  * @param string $export_type 'server', 'database', 'table'
  * @param bool   $do_relation whether to include relation comments
  * @param bool   $do_comments whether to include the pmadb-style column
  *                                comments as comments in the structure;
  *                                this is deprecated but the parameter is
  *                                left here because export.php calls
  *                                PMA_exportStructure() also for other
  * @param bool   $do_mime     whether to include mime comments
  * @param bool   $dates       whether to include creation/update/check dates
  *
  * @return bool Whether it succeeded
  *
  * @access public
  */
 function PMA_exportStructure($db, $table, $crlf, $error_url, $export_mode, $export_type, $do_relation = false, $do_comments = false, $do_mime = false, $dates = false)
 {
     switch ($export_mode) {
         case 'create_table':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Table structure for table') . ' ' . htmlspecialchars($table) . '</text:h>';
             PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates);
             break;
         case 'triggers':
             $triggers = PMA_DBI_get_triggers($db, $table);
             if ($triggers) {
                 $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Triggers') . ' ' . htmlspecialchars($table) . '</text:h>';
                 PMA_getTriggers($db, $table);
             }
             break;
         case 'create_view':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation, $do_comments, $do_mime, $dates, true, true);
             break;
         case 'stand_in':
             $GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2"' . ' text:is-list-header="true">' . __('Stand-in structure for view') . ' ' . htmlspecialchars($table) . '</text:h>';
             // export a stand-in definition to resolve view dependencies
             PMA_getTableDefStandIn($db, $table, $crlf);
     }
     // end switch
     return true;
 }
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:49,代码来源:odt.php


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