Check whether a column contains numeric data by examining the first non-empty value */
| 3869 | |
| 3870 | /* Check whether a column contains numeric data by examining the first non-empty value */ |
| 3871 | static bool rb_is_numeric_column(const result_builder_t *rb, int col) { |
| 3872 | for (int i = 0; i < rb->row_count; i++) { |
| 3873 | const char *v = rb->rows[i][col]; |
| 3874 | if (v && *v) { |
| 3875 | const char *p2 = (*v == '-') ? v + SKIP_ONE : v; |
| 3876 | if (*p2 == '\0') { |
| 3877 | return false; |
| 3878 | } |
| 3879 | for (; *p2; p2++) { |
| 3880 | if (*p2 < '0' || *p2 > '9') { |
| 3881 | return false; |
| 3882 | } |
| 3883 | } |
| 3884 | return true; |
| 3885 | } |
| 3886 | } |
| 3887 | return false; |
| 3888 | } |
| 3889 | |
| 3890 | typedef struct { |
| 3891 | const int *cols; |