|
@@ 1278-1282 (lines=5) @@
|
| 1275 |
|
$currentPosition = $orderByPos; |
| 1276 |
|
|
| 1277 |
|
while ($parenCount >= 0 && $currentPosition < $qLen) { |
| 1278 |
|
if ($query[$currentPosition] === '(') { |
| 1279 |
|
$parenCount++; |
| 1280 |
|
} elseif ($query[$currentPosition] === ')') { |
| 1281 |
|
$parenCount--; |
| 1282 |
|
} |
| 1283 |
|
|
| 1284 |
|
$currentPosition++; |
| 1285 |
|
} |
|
@@ 1318-1322 (lines=5) @@
|
| 1315 |
|
// If $parenCount goes negative, we've exited the subquery we're examining. |
| 1316 |
|
// If $currentPosition goes negative, we've reached the beginning of the query. |
| 1317 |
|
while ($parenCount >= 0 && $currentPosition >= 0) { |
| 1318 |
|
if ($query[$currentPosition] === '(') { |
| 1319 |
|
$parenCount--; |
| 1320 |
|
} elseif ($query[$currentPosition] === ')') { |
| 1321 |
|
$parenCount++; |
| 1322 |
|
} |
| 1323 |
|
|
| 1324 |
|
// Only yank query text on the same nesting level as the ORDER BY clause. |
| 1325 |
|
$subQueryBuffer = ($parenCount === 0 ? $query[$currentPosition] : ' ') . $subQueryBuffer; |