Handle correctly dumps with commented out commands (eg. from mysqldump).
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-12-25 Michal Čihař <michal@cihar.com>
|
||||||
|
* libraries/import.lib.php, libraries/import/sql.php: Handle correctly
|
||||||
|
dumps with commented out commands (eg. from mysqldump).
|
||||||
|
|
||||||
2005-12-22 Marc Delisle <lem9@users.sourceforge.net>
|
2005-12-22 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* tbl_change.php, libraries/common.lib.php: bug #1381856,
|
* tbl_change.php, libraries/common.lib.php: bug #1381856,
|
||||||
Cannot edit a table having 40 columns
|
Cannot edit a table having 40 columns
|
||||||
|
@@ -168,7 +168,7 @@ function PMA_importRunQuery($sql = '', $full = '') {
|
|||||||
if (!empty($sql) || !empty($full)) {
|
if (!empty($sql) || !empty($full)) {
|
||||||
$import_run_buffer = array('sql' => $sql, 'full' => $full);
|
$import_run_buffer = array('sql' => $sql, 'full' => $full);
|
||||||
} else {
|
} else {
|
||||||
unset($import_run_buffer);
|
unset($GLOBALS['import_run_buffer']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -139,22 +139,31 @@ if (isset($plugin_list)) {
|
|||||||
|
|
||||||
// End of SQL
|
// End of SQL
|
||||||
if ($ch == ';' || ($finished && ($i == $len - 1))) {
|
if ($ch == ';' || ($finished && ($i == $len - 1))) {
|
||||||
|
$tmp_sql = $sql;
|
||||||
if ($start_pos < $len) {
|
if ($start_pos < $len) {
|
||||||
$sql .= substr($buffer, $start_pos, $i - $start_pos + 1);
|
$tmp_sql .= substr($buffer, $start_pos, $i - $start_pos + 1);
|
||||||
|
}
|
||||||
|
// Do not try to execute empty SQL
|
||||||
|
if (!preg_match('/^([\s]*;)*$/', trim($tmp_sql))) {
|
||||||
|
$sql = $tmp_sql;
|
||||||
|
PMA_importRunQuery($sql, substr($buffer, 0, $i + 1));
|
||||||
|
$buffer = substr($buffer, $i + 1);
|
||||||
|
// Reset parser:
|
||||||
|
$len = strlen($buffer);
|
||||||
|
$sql = '';
|
||||||
|
$i = 0;
|
||||||
|
$start_pos = 0;
|
||||||
|
// Any chance we will get a complete query?
|
||||||
|
if ((strpos($buffer, ';') === FALSE) && !$finished) break;
|
||||||
|
} else {
|
||||||
|
$i++;
|
||||||
|
$start_pos = $i;
|
||||||
}
|
}
|
||||||
PMA_importRunQuery($sql, substr($buffer, 0, $i + 1));
|
|
||||||
$buffer = substr($buffer, $i + 1);
|
|
||||||
// Reset parser:
|
|
||||||
$len = strlen($buffer);
|
|
||||||
$sql = '';
|
|
||||||
$i = 0;
|
|
||||||
$start_pos = 0;
|
|
||||||
// Any chance we will get a complete query?
|
|
||||||
if ((strpos($buffer, ';') === FALSE) && !$finished) break;
|
|
||||||
}
|
}
|
||||||
} // End of parser loop
|
} // End of parser loop
|
||||||
} // End of import loop
|
} // End of import loop
|
||||||
// Commit any possible data in buffers
|
// Commit any possible data in buffers
|
||||||
|
PMA_importRunQuery('', substr($buffer, 0, $len));
|
||||||
PMA_importRunQuery();
|
PMA_importRunQuery();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user