function get_content($db, $table) { global $config, $nl, $dump, $buffer; $content = ''; $complete = Fieldlist($db, $table) . ' '; $table_ready = 0; $query = 'SELECT * FROM `' . $table . '` LIMIT ' . $dump['zeilen_offset'] . ',' . ($dump['restzeilen'] + 1); (bool) mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $db); $result = mysqli_query($config['dbconnection'], $query); $ergebnisse = @mysqli_num_rows($result); if ($ergebnisse !== false) { $num_felder = ($___mysqli_tmp = mysqli_num_fields($result)) ? $___mysqli_tmp : false; $first = 1; if ($ergebnisse > $dump['restzeilen']) { $dump['zeilen_offset'] += $dump['restzeilen']; $ergebnisse--; $dump['restzeilen'] = 0; } else { $dump['table_offset']++; $dump['zeilen_offset'] = 0; $dump['restzeilen'] = $dump['restzeilen'] - $ergebnisse; $table_ready = 1; } $ax = 0; for ($x = 0; $x < $ergebnisse; $x++) { $row = mysqli_fetch_row($result); $ax++; $insert = 'INSERT INTO `' . $table . '` ' . $complete . 'VALUES ('; for ($j = 0; $j < $num_felder; $j++) { if (!isset($row[$j])) { $insert .= 'NULL,'; } else { if ($row[$j] != '') { $insert .= '\'' . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $row[$j]) . '\','; } else { $insert .= '\'\','; } } } $insert = substr($insert, 0, -1) . ');' . $nl; $dump['data'] .= $insert; $dump['countdata']++; if (strlen($dump['data']) > $config['memory_limit'] || $config['multi_part'] == 1 && strlen($dump['data']) + $buffer > $config['multipart_groesse']) { WriteToDumpFile(); } } if ($table_ready == 1 && $dump['table_types'][getDBIndex($db, $table)] != 'VIEW') { $dump['data'] .= "/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;\n"; } } else { // table corrupt -> skip it $dump['table_offset']++; $dump['zeilen_offset'] = 0; $dump['restzeilen'] = $dump['restzeilen'] - $ergebnisse; $dump['data'] .= "/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;\n"; if (strlen($dump['data']) > $config['memory_limit'] || $config['multi_part'] == 1 && strlen($dump['data']) + $buffer > $config['multipart_groesse']) { WriteToDumpFile(); } } @(mysqli_free_result($result) || is_object($result) && get_class($result) == "mysqli_result" ? true : false); }
function get_content($db, $table) { global $config, $nl, $dump, $buffer; $content = ''; $delayed = isset($config['backup_delayed_inserts']) && $config['backup_delayed_inserts'] == 1 ? 'DELAYED ' : ''; $complete = isset($config['backup_complete_inserts']) && $config['backup_complete_inserts'] == 1 ? Fieldlist($db, $table) . ' ' : ''; $ignore = isset($config['backup_ignore_inserts']) && $config['backup_ignore_inserts'] == 1 ? 'IGNORE ' : ''; $table_ready = 0; $query = 'SELECT * FROM `' . $table . '` LIMIT ' . $dump['zeilen_offset'] . ',' . ($dump['restzeilen'] + 1); mysql_select_db($db); $result = mysql_query($query, $config['dbconnection']); $ergebnisse = mysql_num_rows($result); $num_felder = mysql_num_fields($result); $first = 1; if ($ergebnisse > $dump['restzeilen']) { $dump['zeilen_offset'] += $dump['restzeilen']; $ergebnisse--; $dump['restzeilen'] = 0; } else { $dump['table_offset']++; $dump['zeilen_offset'] = 0; $dump['restzeilen'] = $dump['restzeilen'] - $ergebnisse; $table_ready = 1; } $ax = 0; for ($x = 0; $x < $ergebnisse; $x++) { $row = mysql_fetch_row($result); $ax++; if ($config['backup_extended_inserts'] == 0 || $config['backup_extended_inserts'] == 1 && $first == 1 && $ax == 1) { $insert = 'INSERT ' . $delayed . $ignore . 'INTO `' . $table . '` ' . $complete . 'VALUES ('; $first = 0; } else { $insert = '('; } for ($j = 0; $j < $num_felder; $j++) { if (!isset($row[$j])) { $insert .= 'NULL,'; } else { if ($row[$j] != '') { $insert .= '\'' . mysql_escape_string($row[$j]) . '\','; } else { $insert .= '\'\','; } } } $insert = substr($insert, 0, -1); if (strlen($dump['data']) > 400000 || $x == $ergebnisse - 1) { $ax = 0; $first = 1; } $insert .= $config['backup_extended_inserts'] == 0 || $x == $ergebnisse - 1 || $ax == 0 ? ");\n" : '),'; $dump['data'] .= $insert; $dump['countdata']++; if (strlen($dump['data']) > $config['memory_limit'] || $config['multi_part'] == 1 && strlen($dump['data']) + $buffer > $config['multipart_groesse']) { WriteToDumpFile(); } } if ($table_ready == 1 && $config['backup_lock_tables'] == 1 && $config['backup_delayed_inserts'] == 0) { $dump['data'] .= "\nUNLOCK TABLES;"; } if ($table_ready == 1 && $config['backup_delayed_inserts'] == 0) { $dump['data'] .= "\n/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;\n\n"; } mysql_free_result($result); }