Append a regex WHERE clause for a column (case-sensitive or insensitive). */
| 2457 | |
| 2458 | /* Append a regex WHERE clause for a column (case-sensitive or insensitive). */ |
| 2459 | static void where_add_regex(char *where, int where_sz, int *wlen, int *nparams, |
| 2460 | search_bind_t *binds, int *bind_idx, const char *column, |
| 2461 | const char *pattern, bool case_sensitive) { |
| 2462 | char buf[CBM_SZ_128]; |
| 2463 | if (case_sensitive) { |
| 2464 | snprintf(buf, sizeof(buf), "%s REGEXP ?%d", column, *bind_idx + SKIP_ONE); |
| 2465 | } else { |
| 2466 | snprintf(buf, sizeof(buf), "iregexp(?%d, %s)", *bind_idx + SKIP_ONE, column); |
| 2467 | } |
| 2468 | *wlen = where_append(where, where_sz, *wlen, nparams, buf); |
| 2469 | where_bind_text(binds, bind_idx, pattern); |
| 2470 | } |
| 2471 | |
| 2472 | /* Prepend LIKE pre-filter conditions for literal segments of a regex pattern. |
| 2473 | * The idx_nodes_name index satisfies LIKE '%literal%', cutting the rows that |
no test coverage detected