@@ 1271-1275 (lines=5) @@ | ||
1268 | $currentPosition = $orderByPos; |
|
1269 | ||
1270 | while ($parenCount >= 0 && $currentPosition < $qLen) { |
|
1271 | if ($query[$currentPosition] === '(') { |
|
1272 | $parenCount++; |
|
1273 | } elseif ($query[$currentPosition] === ')') { |
|
1274 | $parenCount--; |
|
1275 | } |
|
1276 | ||
1277 | $currentPosition++; |
|
1278 | } |
|
@@ 1311-1315 (lines=5) @@ | ||
1308 | // If $parenCount goes negative, we've exited the subquery we're examining. |
|
1309 | // If $currentPosition goes negative, we've reached the beginning of the query. |
|
1310 | while ($parenCount >= 0 && $currentPosition >= 0) { |
|
1311 | if ($query[$currentPosition] === '(') { |
|
1312 | $parenCount--; |
|
1313 | } elseif ($query[$currentPosition] === ')') { |
|
1314 | $parenCount++; |
|
1315 | } |
|
1316 | ||
1317 | // Only yank query text on the same nesting level as the ORDER BY clause. |
|
1318 | $subQueryBuffer = ($parenCount === 0 ? $query[$currentPosition] : ' ') . $subQueryBuffer; |