MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / db_copy_rest_of_count

Function db_copy_rest_of_count

modules/db_sqlite/dbase.c:89–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89static 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
114static inline int
115db_sqlite_get_query_rows(const db_con_t* _h, const str* query, const db_val_t* _v, const int _n)

Callers 2

db_sqlite_queryFunction · 0.85
db_sqlite_raw_queryFunction · 0.85

Calls 1

str_strcasestrFunction · 0.85

Tested by

no test coverage detected