@@ -190,6 +190,11 @@ public function process($tokens) {
190190 if ($ token_category === 'LEFT ' || $ token_category === 'RIGHT ' || $ token_category === 'NATURAL ' ) {
191191 $ token_category = '' ;
192192 $ parseInfo ['next_join_type ' ] = strtoupper (trim ($ prevToken )); // it seems to be a join
193+ } elseif ($ token_category === 'IDX_HINT ' ) {
194+ $ parseInfo ['expression ' ] .= $ token ;
195+ if ($ parseInfo ['ref_type ' ] !== false ) { // all after ON / USING
196+ $ parseInfo ['ref_expr ' ] .= $ token ;
197+ }
193198 }
194199 break ;
195200
@@ -276,6 +281,12 @@ public function process($tokens) {
276281 break ;
277282
278283 case 'FOR ' :
284+ if ($ token_category === 'IDX_HINT ' ) {
285+ $ cur_hint = (count ($ parseInfo ['hints ' ]) - 1 );
286+ $ parseInfo ['hints ' ][$ cur_hint ]['hint_type ' ] .= " " . $ upper ;
287+ continue 2 ;
288+ }
289+
279290 $ parseInfo ['token_count ' ]++;
280291 $ skip_next = true ;
281292 break ;
@@ -295,6 +306,12 @@ public function process($tokens) {
295306 $ parseInfo ['next_join_type ' ] = 'CROSS ' ;
296307
297308 case 'JOIN ' :
309+ if ($ token_category === 'IDX_HINT ' ) {
310+ $ cur_hint = (count ($ parseInfo ['hints ' ]) - 1 );
311+ $ parseInfo ['hints ' ][$ cur_hint ]['hint_type ' ] .= " " . $ upper ;
312+ continue 2 ;
313+ }
314+
298315 if ($ parseInfo ['subquery ' ]) {
299316 $ parseInfo ['sub_tree ' ] = $ this ->parse ($ this ->removeParenthesisFromStart ($ parseInfo ['subquery ' ]));
300317 $ parseInfo ['expression ' ] = $ parseInfo ['subquery ' ];
@@ -304,6 +321,13 @@ public function process($tokens) {
304321 $ parseInfo = $ this ->initParseInfo ($ parseInfo );
305322 break ;
306323
324+ case 'GROUP BY ' :
325+ if ($ token_category === 'IDX_HINT ' ) {
326+ $ cur_hint = (count ($ parseInfo ['hints ' ]) - 1 );
327+ $ parseInfo ['hints ' ][$ cur_hint ]['hint_type ' ] .= " " . $ upper ;
328+ continue 2 ;
329+ }
330+
307331 default :
308332 // TODO: enhance it, so we can have base_expr to calculate the position of the keywords
309333 // build a subtree under "hints"
0 commit comments