$offset = $match[0][1] + strlen($found);
if ($found && $found != $delimiter) {
// is not end of a query - find closing part
- if (ereg('-- |#', $found)) {
- $offset = strpos($query, "\n", $offset);
- } elseif ($found == "/*") {
- $offset = strpos($query, "*/", $offset);
+ if (ereg('/\\*|-- |#', $found)) {
+ $offset = strpos($query, ($found == "/*" ? "*/" : "\n"), $offset);
+ if (!$offset) {
+ $offset = strlen($query);
+ }
} else {
// find matching quote
while (preg_match("~$found|\\\\.|\$~s", $query, $match, PREG_OFFSET_CAPTURE, $offset)) {
}
}
}
- if (!$offset) {
- $offset = strlen($query);
- }
} else {
$empty = false;
echo "<pre class='jush-sql'>" . shorten_utf8(trim(substr($query, 0, $match[0][1]))) . "</pre>\n";