Lets handle better comments, current detection still doesn't work with comments inside checked SQL commands, but I thing checking these would be overhead (bug #978114).
This commit is contained in:
@@ -15,6 +15,9 @@ $Source$
|
|||||||
* libraries/display_export.lib.php: Add back key checking disabling.
|
* libraries/display_export.lib.php: Add back key checking disabling.
|
||||||
* libraries/export/sql.php: Brand new CREATE query rewriter from LinuxTag,
|
* libraries/export/sql.php: Brand new CREATE query rewriter from LinuxTag,
|
||||||
fixes bug #979635.
|
fixes bug #979635.
|
||||||
|
* read_dump.php: Lets handle better comments, current detection still
|
||||||
|
doesn't work with comments inside checked SQL commands, but I thing
|
||||||
|
checking these would be overhead (bug #978114).
|
||||||
|
|
||||||
2004-06-25 Alexander M. Turek <rabus@users.sourceforge.net>
|
2004-06-25 Alexander M. Turek <rabus@users.sourceforge.net>
|
||||||
* queryframe.php: Undefined index errors.
|
* queryframe.php: Undefined index errors.
|
||||||
|
@@ -240,7 +240,8 @@ if ($sql_query != '') {
|
|||||||
// Only one query to run
|
// Only one query to run
|
||||||
if ($pieces_count == 1 && !empty($pieces[0]['query'])) {
|
if ($pieces_count == 1 && !empty($pieces[0]['query'])) {
|
||||||
$sql_query = $pieces[0]['query'];
|
$sql_query = $pieces[0]['query'];
|
||||||
if (preg_match('@^(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $sql_query)) {
|
// .*? bellow is non greedy expansion, just in case somebody wants to understand it...
|
||||||
|
if (preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $sql_query)) {
|
||||||
$reload = 1;
|
$reload = 1;
|
||||||
}
|
}
|
||||||
require('./sql.php');
|
require('./sql.php');
|
||||||
@@ -259,7 +260,8 @@ if ($sql_query != '') {
|
|||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$a_sql_query = $pieces[$i]['query'];
|
$a_sql_query = $pieces[$i]['query'];
|
||||||
|
|
||||||
if ($i == $count - 1 && preg_match('@^(SELECT|SHOW)@i', $a_sql_query)) {
|
// .*? bellow is non greedy expansion, just in case somebody wants to understand it...
|
||||||
|
if ($i == $count - 1 && preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*(SELECT|SHOW)@i', $a_sql_query)) {
|
||||||
$complete_query = $sql_query;
|
$complete_query = $sql_query;
|
||||||
$display_query = $sql_query;
|
$display_query = $sql_query;
|
||||||
$sql_query = $a_sql_query;
|
$sql_query = $a_sql_query;
|
||||||
@@ -304,11 +306,13 @@ if ($sql_query != '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a 'USE <db>' SQL-clause was found and the query succeeded, set our current $db to the new one
|
// If a 'USE <db>' SQL-clause was found and the query succeeded, set our current $db to the new one
|
||||||
if ($result != FALSE && preg_match('@^USE[[:space:]]*([^[:space]+)@i', $a_sql_query, $match)) {
|
// .*? bellow is non greedy expansion, just in case somebody wants to understand it...
|
||||||
|
if ($result != FALSE && preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*USE[[:space:]]*([^[:space]+)@i', $a_sql_query, $match)) {
|
||||||
$db = trim($match[0]);
|
$db = trim($match[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($reload) && preg_match('@^(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $a_sql_query)) {
|
// .*? bellow is non greedy expansion, just in case somebody wants to understand it...
|
||||||
|
if (!isset($reload) && preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $a_sql_query)) {
|
||||||
$reload = 1;
|
$reload = 1;
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
|
Reference in New Issue
Block a user