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. */
| 1732 | * LIMIT and flooded the caller with the whole result set. Returns 0 on |
| 1733 | * success, CBM_NOT_FOUND when the key list exceeds the modeled maximum. */ |
| 1734 | static int parse_order_by_clause(parser_t *p, cbm_return_clause_t *r) { |
| 1735 | expect(p, TOK_BY); |
| 1736 | do { |
| 1737 | if (r->order_key_count >= CBM_CYPHER_ORDER_KEYS_MAX) { |
| 1738 | return CBM_NOT_FOUND; |
| 1739 | } |
| 1740 | char order_buf[CBM_SZ_256]; |
| 1741 | parse_order_by_expr(p, order_buf, sizeof(order_buf)); |
| 1742 | bool desc = false; |
| 1743 | if (match(p, TOK_ASC)) { |
| 1744 | desc = false; |
| 1745 | } else if (match(p, TOK_DESC)) { |
| 1746 | desc = true; |
| 1747 | } |
| 1748 | r->order_keys[r->order_key_count] = heap_strdup(order_buf); |
| 1749 | r->order_descs[r->order_key_count] = desc; |
| 1750 | r->order_key_count++; |
| 1751 | } while (match(p, TOK_COMMA)); |
| 1752 | return 0; |
| 1753 | } |
| 1754 | |
| 1755 | static void free_return_clause(cbm_return_clause_t *r); |
| 1756 |
no test coverage detected