Optimize $offset
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@998 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
c7bc1cd898
commit
81500c7260
|
@ -34,10 +34,11 @@ if (!$error && $_POST) {
|
||||||
$offset = $match[0][1] + strlen($found);
|
$offset = $match[0][1] + strlen($found);
|
||||||
if ($found && $found != $delimiter) {
|
if ($found && $found != $delimiter) {
|
||||||
// is not end of a query - find closing part
|
// is not end of a query - find closing part
|
||||||
if (ereg('-- |#', $found)) {
|
if (ereg('/\\*|-- |#', $found)) {
|
||||||
$offset = strpos($query, "\n", $offset);
|
$offset = strpos($query, ($found == "/*" ? "*/" : "\n"), $offset);
|
||||||
} elseif ($found == "/*") {
|
if (!$offset) {
|
||||||
$offset = strpos($query, "*/", $offset);
|
$offset = strlen($query);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// find matching quote
|
// find matching quote
|
||||||
while (preg_match("~$found|\\\\.|\$~s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
|
while (preg_match("~$found|\\\\.|\$~s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
|
||||||
|
@ -48,9 +49,6 @@ if (!$error && $_POST) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$offset) {
|
|
||||||
$offset = strlen($query);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$empty = false;
|
$empty = false;
|
||||||
echo "<pre class='jush-sql'>" . shorten_utf8(trim(substr($query, 0, $match[0][1]))) . "</pre>\n";
|
echo "<pre class='jush-sql'>" . shorten_utf8(trim(substr($query, 0, $match[0][1]))) . "</pre>\n";
|
||||||
|
|
Loading…
Reference in a new issue