where_clause_identifiers
This commit is contained in:
@@ -647,6 +647,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
'order_by_clause'=> '',
|
'order_by_clause'=> '',
|
||||||
'having_clause' => '',
|
'having_clause' => '',
|
||||||
'where_clause' => '',
|
'where_clause' => '',
|
||||||
|
'where_clause_identifiers' => array(),
|
||||||
'queryflags' => array(),
|
'queryflags' => array(),
|
||||||
'select_expr' => array(),
|
'select_expr' => array(),
|
||||||
'table_ref' => array()
|
'table_ref' => array()
|
||||||
@@ -707,7 +708,11 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
* ['order_by_clause']
|
* ['order_by_clause']
|
||||||
* ['having_clause']
|
* ['having_clause']
|
||||||
* ['where_clause']
|
* ['where_clause']
|
||||||
|
*
|
||||||
|
* and the identifiers of the where clause are put into the array
|
||||||
|
* ['where_clause_identifier']
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// must be sorted
|
// must be sorted
|
||||||
// TODO: current logic checks for only one word, so I put only the
|
// TODO: current logic checks for only one word, so I put only the
|
||||||
// first word of the reserved expressions that end a table ref;
|
// first word of the reserved expressions that end a table ref;
|
||||||
@@ -1234,6 +1239,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
if ($upper_data == 'WHERE') {
|
if ($upper_data == 'WHERE') {
|
||||||
$in_where = TRUE;
|
$in_where = TRUE;
|
||||||
$where_clause = '';
|
$where_clause = '';
|
||||||
|
$where_clause_identifiers = array();
|
||||||
$seen_group = FALSE;
|
$seen_group = FALSE;
|
||||||
$seen_order = FALSE;
|
$seen_order = FALSE;
|
||||||
$in_group_by = FALSE;
|
$in_group_by = FALSE;
|
||||||
@@ -1292,6 +1298,13 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
}
|
}
|
||||||
if ($in_where && $upper_data != 'WHERE') {
|
if ($in_where && $upper_data != 'WHERE') {
|
||||||
$where_clause .= $arr[$i]['data'] . $sep;
|
$where_clause .= $arr[$i]['data'] . $sep;
|
||||||
|
|
||||||
|
if (($arr[$i]['type'] == 'quote_backtick')
|
||||||
|
|| ($arr[$i]['type'] == 'quote_double')
|
||||||
|
|| ($arr[$i]['type'] == 'quote_single')
|
||||||
|
|| ($arr[$i]['type'] == 'alpha_identifier')) {
|
||||||
|
$where_clause_identifiers[] = $arr[$i]['data'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear $upper_data for next iteration
|
// clear $upper_data for next iteration
|
||||||
@@ -1317,6 +1330,9 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
if (isset($where_clause)) {
|
if (isset($where_clause)) {
|
||||||
$subresult['where_clause'] = $where_clause;
|
$subresult['where_clause'] = $where_clause;
|
||||||
}
|
}
|
||||||
|
if (isset($where_clause_identifiers)) {
|
||||||
|
$subresult['where_clause_identifiers'] = $where_clause_identifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// They are naughty and didn't have a trailing semi-colon,
|
// They are naughty and didn't have a trailing semi-colon,
|
||||||
@@ -1444,7 +1460,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $arraysize; $i++) {
|
for ($i = 0; $i < $arraysize; $i++) {
|
||||||
//DEBUG echo "<b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
// DEBUG echo "<b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
||||||
$before = '';
|
$before = '';
|
||||||
$after = '';
|
$after = '';
|
||||||
$indent = 0;
|
$indent = 0;
|
||||||
|
Reference in New Issue
Block a user