(toks, start_idx, tables_with_alias, schema, default_tables)
| 471 | |
| 472 | |
| 473 | def parse_order_by(toks, start_idx, tables_with_alias, schema, default_tables): |
| 474 | idx = start_idx |
| 475 | len_ = len(toks) |
| 476 | val_units = [] |
| 477 | order_type = 'asc' # default type is 'asc' |
| 478 | |
| 479 | if idx >= len_ or toks[idx] != 'order': |
| 480 | return idx, val_units |
| 481 | |
| 482 | idx += 1 |
| 483 | assert toks[idx] == 'by' |
| 484 | idx += 1 |
| 485 | |
| 486 | while idx < len_ and not (toks[idx] in CLAUSE_KEYWORDS or toks[idx] in (")", ";")): |
| 487 | idx, val_unit = parse_val_unit(toks, idx, tables_with_alias, schema, default_tables) |
| 488 | val_units.append(val_unit) |
| 489 | if idx < len_ and toks[idx] in ORDER_OPS: |
| 490 | order_type = toks[idx] |
| 491 | idx += 1 |
| 492 | if idx < len_ and toks[idx] == ',': |
| 493 | idx += 1 # skip ',' |
| 494 | else: |
| 495 | break |
| 496 | |
| 497 | return idx, (order_type, val_units) |
| 498 | |
| 499 | |
| 500 | def parse_having(toks, start_idx, tables_with_alias, schema, default_tables): |
no test coverage detected