Add one projected row under a row cap, de-duplicating when DISTINCT. * Returns false once a NEW row arrives with the cap already full: the caller * stops there, and flags truncation when the cap is the engine budget. A * duplicate past the cap is neither kept nor evidence of truncation. */
| 3150 | * stops there, and flags truncation when the cap is the engine budget. A |
| 3151 | * duplicate past the cap is neither kept nor evidence of truncation. */ |
| 3152 | static bool rb_add_row_capped(result_builder_t *rb, rb_distinct_t *d, const char **vals, int cap) { |
| 3153 | char *key = NULL; |
| 3154 | if (!rb_distinct_is_new(d, vals, rb->col_count, &key)) { |
| 3155 | return true; |
| 3156 | } |
| 3157 | if (rb->row_count >= cap) { |
| 3158 | cbm_free(CBM_MEM_CLASS_OTHER, key); |
| 3159 | return false; |
| 3160 | } |
| 3161 | rb_distinct_keep(d, key); |
| 3162 | rb_add_row(rb, vals); |
| 3163 | return true; |
| 3164 | } |
| 3165 | |
| 3166 | /* ── Main execution ─────────────────────────────────────────────── */ |
| 3167 |
no test coverage detected