Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanaka Indrajith <pe.chanaka.ck@gmail.com>2013-05-26 14:37:00 +0400
committerChanaka Indrajith <pe.chanaka.ck@gmail.com>2013-05-26 14:37:00 +0400
commitdf37fd140f7d0efbcbf19af19380b3a453873d91 (patch)
tree04fa48f4c34c0ba94e81333b7bf062a4c9ab9d20 /tbl_export.php
parent914ab7104d1922c4e3da5cea303725298db568be (diff)
Fixed bug 3912
Diffstat (limited to 'tbl_export.php')
-rw-r--r--tbl_export.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/tbl_export.php b/tbl_export.php
index 557dcb352b..aa4880b9e0 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -37,14 +37,25 @@ if (! empty($sql_query)) {
// Need to generate WHERE clause?
if (isset($where_clause)) {
- $temp_sql_array = preg_split("/\bwhere\b/i", $sql_query);
+ // Regular expressions which can appear in sql query,
+ // before the sql segment which remains as it is.
+ $regex_array = array(
+ '/\bwhere\b/i', '/\bgroup by\b/i', '/\bhaving\b/i', '/\border by\b/i'
+ );
+
+ $first_occuring_regex = PMA_getFirstOccuringRegularExpression(
+ $regex_array, $sql_query
+ );
// The part "SELECT `id`, `name` FROM `customers`"
// is not modified by the next code segment, when exporting
// the result set from a query such as
// "SELECT `id`, `name` FROM `customers` WHERE id NOT IN
// ( SELECT id FROM companies WHERE name LIKE '%u%')"
- $sql_query = $temp_sql_array[0];
+ if (! is_null($first_occuring_regex)) {
+ $temp_sql_array = preg_split($first_occuring_regex, $sql_query);
+ $sql_query = $temp_sql_array[0];
+ }
// Append the where clause using the primary key of each row
if (is_array($where_clause) && (count($where_clause) > 0)) {