| 87 | } |
| 88 | |
| 89 | static inline int db_copy_rest_of_count(const str* _qh, str* count_query) |
| 90 | { |
| 91 | |
| 92 | char* found; |
| 93 | const str searched_str = {" from ", sizeof(" from ")-1}; |
| 94 | |
| 95 | count_query->len = sizeof(COUNT_QUERY)-1; |
| 96 | if ((found=str_strcasestr(_qh, &searched_str)) != NULL) { |
| 97 | const int len=_qh->len-(found-_qh->s); |
| 98 | /* check for overflow */ |
| 99 | if (len > COUNT_BUF_SIZE-(sizeof(COUNT_QUERY)-1)) { |
| 100 | LM_ERR("query too big! try reducing the size of your query!" |
| 101 | "Current max size [%d]!\n", COUNT_BUF_SIZE); |
| 102 | return -1; |
| 103 | } |
| 104 | |
| 105 | memcpy(count_query->s+count_query->len, found, len); |
| 106 | count_query->len += len; |
| 107 | |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | return -1; |
| 112 | } |
| 113 | |
| 114 | static inline int |
| 115 | db_sqlite_get_query_rows(const db_con_t* _h, const str* query, const db_val_t* _v, const int _n) |
no test coverage detected