(toks, start_idx, tables_with_alias, schema, default_tables)
| 442 | |
| 443 | |
| 444 | def parse_order_by(toks, start_idx, tables_with_alias, schema, default_tables): |
| 445 | idx = start_idx |
| 446 | len_ = len(toks) |
| 447 | val_units = [] |
| 448 | order_type = 'asc' # default type is 'asc' |
| 449 | |
| 450 | if idx >= len_ or toks[idx] != 'order': |
| 451 | return idx, val_units |
| 452 | |
| 453 | idx += 1 |
| 454 | assert toks[idx] == 'by' |
| 455 | idx += 1 |
| 456 | |
| 457 | while idx < len_ and not (toks[idx] in CLAUSE_KEYWORDS or toks[idx] in (")", ";")): |
| 458 | idx, val_unit = parse_val_unit(toks, idx, tables_with_alias, schema, default_tables) |
| 459 | val_units.append(val_unit) |
| 460 | if idx < len_ and toks[idx] in ORDER_OPS: |
| 461 | order_type = toks[idx] |
| 462 | idx += 1 |
| 463 | if idx < len_ and toks[idx] == ',': |
| 464 | idx += 1 # skip ',' |
| 465 | else: |
| 466 | break |
| 467 | |
| 468 | return idx, (order_type, val_units) |
| 469 | |
| 470 | |
| 471 | def parse_having(toks, start_idx, tables_with_alias, schema, default_tables): |
no test coverage detected