1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: Stop ignoring sql queries whose ending ';' starts a line
Author: Jean-Michel Nirgal Vourgère <jmv_deb@nirgal.com>
Bug: https://sourceforge.net/p/phppgadmin/bugs/448/
Bug-Debian: https://bugs.debian.org/762378
Forwarded: https://github.com/phppgadmin/phppgadmin/pull/27
Last-Update: 2015-03-24
Index: phppgadmin/classes/database/Postgres.php
===================================================================
--- phppgadmin.orig/classes/database/Postgres.php
+++ phppgadmin/classes/database/Postgres.php
@@ -7504,17 +7504,18 @@ class Postgres extends ADODB_base {
else if (substr($line, $i, 1) == ';' && !$bslash_count && !$paren_level)
{
$subline = substr(substr($line, 0, $i), $query_start);
- /* is there anything else on the line? */
- if (strspn($subline, " \t\n\r") != strlen($subline))
+ /*
+ * insert a cosmetic newline, if this is not the first
+ * line in the buffer
+ */
+ if (strlen($query_buf) > 0)
+ $query_buf .= "\n";
+ /* append the line to the query buffer */
+ $query_buf .= $subline;
+
+ /* is there anything in the query_buf? */
+ if (trim($query_buf))
{
- /*
- * insert a cosmetic newline, if this is not the first
- * line in the buffer
- */
- if (strlen($query_buf) > 0)
- $query_buf .= "\n";
- /* append the line to the query buffer */
- $query_buf .= $subline;
$query_buf .= ';';
// Execute the query. PHP cannot execute
|