Parse PostgreSQL multiline strings
This commit is contained in:
parent
7e5bf6e383
commit
aa1bed7249
|
@ -46,7 +46,7 @@ if (!$error && $_POST) {
|
||||||
$delimiter = $match[1];
|
$delimiter = $match[1];
|
||||||
$query = substr($query, strlen($match[0]));
|
$query = substr($query, strlen($match[0]));
|
||||||
} else {
|
} else {
|
||||||
preg_match('(' . preg_quote($delimiter) . '|[\'`"]|/\\*|-- |#|$)', $query, $match, PREG_OFFSET_CAPTURE, $offset); // should always match
|
preg_match('(' . preg_quote($delimiter) . '|[\'`"]' . ($jush == "pgsql" ? '|\\$.*\\$' : '') . '|/\\*|-- |#|$)', $query, $match, PREG_OFFSET_CAPTURE, $offset); // should always match
|
||||||
$found = $match[0][0];
|
$found = $match[0][0];
|
||||||
$offset = $match[0][1] + strlen($found);
|
$offset = $match[0][1] + strlen($found);
|
||||||
if (!$found && $fp && !feof($fp)) {
|
if (!$found && $fp && !feof($fp)) {
|
||||||
|
@ -56,7 +56,7 @@ if (!$error && $_POST) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($found && $found != $delimiter) { // find matching quote or comment end
|
if ($found && $found != $delimiter) { // find matching quote or comment end
|
||||||
while (preg_match('~' . ($found == '/*' ? '\\*/' : (ereg('-- |#', $found) ? "\n" : "$found|\\\\.")) . '|$~s', $query, $match, PREG_OFFSET_CAPTURE, $offset)) { //! respect sql_mode NO_BACKSLASH_ESCAPES
|
while (preg_match('(' . ($found == '/*' ? '\\*/' : (ereg('-- |#', $found) ? "\n" : preg_quote($found) . "|\\\\.")) . '|$)s', $query, $match, PREG_OFFSET_CAPTURE, $offset)) { //! respect sql_mode NO_BACKSLASH_ESCAPES
|
||||||
$s = $match[0][0];
|
$s = $match[0][0];
|
||||||
$offset = $match[0][1] + strlen($s);
|
$offset = $match[0][1] + strlen($s);
|
||||||
if (!$s && $fp && !feof($fp)) {
|
if (!$s && $fp && !feof($fp)) {
|
||||||
|
|
Loading…
Reference in a new issue