Returns NULL if this doesn't look like a column definition */
| 445 | |
| 446 | /* Returns NULL if this doesn't look like a column definition */ |
| 447 | static const char *find_column_name(const tal_t *ctx, |
| 448 | const char *sqlpart, |
| 449 | size_t *after) |
| 450 | { |
| 451 | size_t start = 0; |
| 452 | |
| 453 | while (cisspace(sqlpart[start])) |
| 454 | start++; |
| 455 | *after = strspn(sqlpart + start, "abcdefghijklmnopqrstuvwxyz_0123456789") + start; |
| 456 | if (*after == start || !cisspace(sqlpart[*after])) |
| 457 | return NULL; |
| 458 | return tal_strndup(ctx, sqlpart + start, *after - start); |
| 459 | } |
| 460 | |
| 461 | /* Move table out the way, return columns. |
| 462 | * Note: with db_hook, frees tmpctx! */ |
no test coverage detected