diff options
author | Stanislau <stanislau.wolski@gmail.com> | 2011-10-31 12:45:07 +0200 |
---|---|---|
committer | Stanislau <stanislau.wolski@gmail.com> | 2011-10-31 12:45:07 +0200 |
commit | 8683dc68b9c2b4309bf455dbdd388ab34c67c843 (patch) | |
tree | ec1cb7f41e6ce15dfa82efb991fe2c7362bb2939 | |
parent | 81ee5bbb46b7ff7f8ba422b226c5270ee3522831 (diff) | |
download | connector-php-8683dc68b9c2b4309bf455dbdd388ab34c67c843.zip connector-php-8683dc68b9c2b4309bf455dbdd388ab34c67c843.tar.gz connector-php-8683dc68b9c2b4309bf455dbdd388ab34c67c843.tar.bz2 |
[fix] sql error for UNION selects
-rw-r--r-- | codebase/db_common.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/codebase/db_common.php b/codebase/db_common.php index ebada70..816f332 100644 --- a/codebase/db_common.php +++ b/codebase/db_common.php @@ -222,7 +222,16 @@ class DataRequestConfig{ if (count($data)!=2) $data = preg_split("/[ \n\t]+from/i",$sql,2); $this->fieldset = preg_replace("/^[\s]*select/i","",$data[0],1); - if (count($data) == 1) return; + + //Ignore next type of calls + //direct call to stored procedure without FROM + if ((count($data) == 1) || + //UNION select + preg_match("#[ \n\r\t]union[ \n\t\r]#i", $sql)){ + $this->fieldset = $sql; + return; + } + $table_data = preg_split("/[ \n\t]+where/i",$data[1],2); /* if sql code contains group_by we will place all sql query in the FROM |