when clicking Synchronize Databases, do not load all source data in memory; todo: handle correctly BLOBs

This commit is contained in:
Marc Delisle
2009-10-04 12:34:29 +00:00
parent 4af9cd152b
commit d11b9cf240
3 changed files with 17 additions and 13 deletions

View File

@@ -1292,8 +1292,8 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
<dt id="cfg_ExecTimeLimit">$cfg['ExecTimeLimit'] integer [number of seconds]</dt>
<dd>Set the number of seconds a script is allowed to run. If seconds is set
to zero, no time limit is imposed.<br />
This setting is used while importing/exporting dump files but has no
effect when PHP is running in safe mode.</dd>
This setting is used while importing/exporting dump files and in the
Synchronize feature but has no effect when PHP is running in safe mode.</dd>
<dt id="cfg_MemoryLimit">$cfg['MemoryLimit'] integer [number of bytes]</dt>
<dd>Set the number of bytes a script is allowed to allocate. If number set

View File

@@ -695,18 +695,17 @@ function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, &$uncomm
*/
function PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link, $uncommon_tables, $table_index, $uncommon_tables_fields, $display)
{
$table_data = PMA_DBI_fetch_result('SELECT * FROM ' . PMA_backquote($src_db) . '.' . PMA_backquote($uncommon_tables[$table_index]), null, null, $src_link);
$display = false; // todo: maybe display some of the queries if they are not too numerous
if (sizeof($table_data) != 0 )
{
for ($row = 0; $row < sizeof($table_data); $row++)
{
$unbuffered_result = PMA_DBI_try_query('SELECT * FROM ' . PMA_backquote($src_db) . '.' . PMA_backquote($uncommon_tables[$table_index]), $src_link, PMA_DBI_QUERY_UNBUFFERED);
if (false !== $unbuffered_result) {
while ($one_row = PMA_DBI_fetch_row($unbuffered_result)) {
$insert_query = 'INSERT INTO '. PMA_backquote($trg_db) . '.' .PMA_backquote($uncommon_tables[$table_index]) . ' VALUES(';
for ($y = 0; $y < sizeof($uncommon_tables_fields[$table_index]); $y++)
{
$insert_query .= "'" . $table_data[$row][$uncommon_tables_fields[$table_index][$y]] . "'";
if ($y < (sizeof($uncommon_tables_fields[$table_index]) - 1)) {
$insert_query .= ',';
$key_of_last_value = count($one_row) - 1;
foreach($one_row as $key => $value) {
$insert_query .= "'" . PMA_sqlAddslashes($value) . "'";
if ($key < $key_of_last_value) {
$insert_query .= ",";
}
}
$insert_query .= ');';

View File

@@ -24,6 +24,11 @@ require_once './libraries/server_common.inc.php';
*/
require './libraries/server_synchronize.lib.php';
/**
* Increases the time limit up to the configured maximum
*/
@set_time_limit($cfg['ExecTimeLimit']);
/**
* Displays the links
*/