예제 #1
0
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;
}
예제 #2
0
         $sql_query = $sql_structure . ';';
     }
 }
 // Copy the data
 if ($result != FALSE && $what == 'data') {
     // speedup copy table - staybyte - 22. Juni 2001
     if (PMA_MYSQL_INT_VERSION >= 32300) {
         $sql_insert_data = 'INSERT INTO ' . $target . ' SELECT * FROM ' . $source;
         $result = @mysql_query($sql_insert_data);
         if (mysql_error()) {
             include './header.inc.php';
             PMA_mysqlDie('', $sql_insert_data, '', $err_url);
         }
     } else {
         $sql_insert_data = '';
         PMA_getTableContent($db, $table, 0, 0, 'PMA_myHandler', $err_url);
     }
     // end MySQL < 3.23
     $sql_query .= "\n\n" . $sql_insert_data;
 }
 // Drops old table if the user has requested to move it
 if (isset($submit_move)) {
     $sql_drop_table = 'DROP TABLE ' . $source;
     $result = @mysql_query($sql_drop_table);
     if (mysql_error()) {
         include './header.inc.php';
         PMA_mysqlDie('', $sql_drop_table, '', $err_url);
     }
     $sql_query .= "\n\n" . $sql_drop_table . ';';
     $db = $target_db;
     $table = $new_name;
예제 #3
0
             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;
             }
             // end if
             $i++;
         }
         // end if-else
     }
     // end while
     // staybyte: don't remove, it makes easier to select & copy from
     // browser
     $dump_buffer .= $crlf;
 } else {
     // Handles the EOL character
     if ($GLOBALS['what'] == 'excel') {
         $add_character = "\r\n";