diff --git a/Documentation.html b/Documentation.html
index 8a15f8c96..1db3cb58e 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -1292,8 +1292,8 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE
$cfg['ExecTimeLimit'] integer [number of seconds]
Set the number of seconds a script is allowed to run. If seconds is set
to zero, no time limit is imposed.
- This setting is used while importing/exporting dump files but has no
- effect when PHP is running in safe mode.
+ 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.
$cfg['MemoryLimit'] integer [number of bytes]
Set the number of bytes a script is allowed to allocate. If number set
diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php
index dfddffb4b..f042df84e 100644
--- a/libraries/server_synchronize.lib.php
+++ b/libraries/server_synchronize.lib.php
@@ -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);
-
- if (sizeof($table_data) != 0 )
- {
- for ($row = 0; $row < sizeof($table_data); $row++)
- {
+ $display = false; // todo: maybe display some of the queries if they are not too numerous
+
+ $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 .= ');';
diff --git a/server_synchronize.php b/server_synchronize.php
index 514966b0d..824d38f29 100644
--- a/server_synchronize.php
+++ b/server_synchronize.php
@@ -23,6 +23,11 @@ require_once './libraries/server_common.inc.php';
* Contains all the functions specific to synchronization
*/
require './libraries/server_synchronize.lib.php';
+
+/**
+ * Increases the time limit up to the configured maximum
+ */
+@set_time_limit($cfg['ExecTimeLimit']);
/**
* Displays the links