Parse the full comma-separated ORDER BY key list (#1334). Consuming only the * first key left ", key2 ... LIMIT n" unparsed, which silently dropped the * LIMIT and flooded the caller with the whole result set. Returns 0 on * success, CBM_NOT_FOUND when the key list exceeds the modeled maximum. */
| 1762 | * LIMIT and flooded the caller with the whole result set. Returns 0 on |
| 1763 | * success, CBM_NOT_FOUND when the key list exceeds the modeled maximum. */ |
| 1764 | static int parse_order_by_clause(parser_t *p, cbm_return_clause_t *r) { |
| 1765 | expect(p, TOK_BY); |
| 1766 | do { |
| 1767 | if (r->order_key_count >= CBM_CYPHER_ORDER_KEYS_MAX) { |
| 1768 | return CBM_NOT_FOUND; |
| 1769 | } |
| 1770 | char order_buf[CBM_SZ_256]; |
| 1771 | parse_order_by_expr(p, order_buf, sizeof(order_buf)); |
| 1772 | bool desc = false; |
| 1773 | if (match(p, TOK_ASC)) { |
| 1774 | desc = false; |
| 1775 | } else if (match(p, TOK_DESC)) { |
| 1776 | desc = true; |
| 1777 | } |
| 1778 | r->order_keys[r->order_key_count] = heap_strdup(order_buf); |
| 1779 | r->order_descs[r->order_key_count] = desc; |
| 1780 | r->order_key_count++; |
| 1781 | } while (match(p, TOK_COMMA)); |
| 1782 | return 0; |
| 1783 | } |
| 1784 | |
| 1785 | static void free_return_clause(cbm_return_clause_t *r); |
| 1786 |
no test coverage detected