Fixed bug 3912
This commit is contained in:
parent
914ab7104d
commit
df37fd140f
@ -5,7 +5,8 @@ phpMyAdmin - ChangeLog
|
||||
- bug #3941 Recent tables list always empty
|
||||
- bug #3933 Do not translate "Open Document" in export settings
|
||||
- bug #3927 List of tables is missing after expanding in the navigation frame
|
||||
- bug #3942 Warnings about reserved word for many non reserved words
|
||||
- bug #3942 Warnings about reserved word for many non reserved words
|
||||
- bug #3912 Exporting row selection, resulted by ORDER BY query
|
||||
|
||||
4.0.2.0 (2013-05-24)
|
||||
- bug #3902 Cannot browse when table name contains keyword "call"
|
||||
|
||||
@ -2099,4 +2099,36 @@ function PMA_is_system_schema($schema_name, $test_for_mysql_schema = false)
|
||||
|| (PMA_DRIZZLE && strtolower($schema_name) == 'data_dictionary')
|
||||
|| ($test_for_mysql_schema && !PMA_DRIZZLE && $schema_name == 'mysql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get regular expression which occur first inside the given sql query.
|
||||
*
|
||||
* @param Array $regex_array Comparing regular expressions.
|
||||
* @param String $query SQL query to be checked.
|
||||
*
|
||||
* @return String Matching regular expression.
|
||||
*/
|
||||
function PMA_getFirstOccuringRegularExpression($regex_array, $query)
|
||||
{
|
||||
|
||||
$minimum_first_occurance_index = null;
|
||||
$regex = null;
|
||||
|
||||
for ($i=0; $i<count($regex_array); $i++) {
|
||||
if (preg_match($regex_array[$i], $query, $matches, PREG_OFFSET_CAPTURE)) {
|
||||
|
||||
if (is_null($minimum_first_occurance_index)
|
||||
|| ($matches[0][1] < $minimum_first_occurance_index)
|
||||
) {
|
||||
$regex = $regex_array[$i];
|
||||
$minimum_first_occurance_index = $matches[0][1];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $regex;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -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)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user