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

Function db_sqlite_get_query_rows

modules/db_sqlite/dbase.c:114–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)
116{
117 int ret;
118 sqlite3_stmt* stmt;
119
120 ret=sqlite3_prepare_v2(CON_CONNECTION(_h), query->s, query->len, &stmt, NULL);
121
122 if (ret != SQLITE_OK) {
123 LM_ERR("failed to prepare query\n");
124 return -1;
125 }
126
127#ifdef SQLITE_BIND
128 if (db_sqlite_bind_values(stmt, _v, _n) != SQLITE_OK) {
129 LM_ERR("failed to bind values\n");
130 return -1;
131 }
132#endif
133
134 ret=sqlite3_step(stmt);
135 if (ret != SQLITE_ROW) {
136 sqlite3_finalize(stmt);
137 LM_ERR("failed to fetch query size\n");
138 return -1;
139 }
140
141 ret=sqlite3_column_int(stmt, 0);
142
143 sqlite3_finalize(stmt);
144
145 return ret;
146}
147
148int db_sqlite_query(const db_con_t* _h, const db_key_t* _k, const db_op_t* _op,
149 const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,

Callers 3

db_sqlite_queryFunction · 0.85
db_sqlite_raw_queryFunction · 0.85
db_sqlite_store_resultFunction · 0.85

Calls 1

db_sqlite_bind_valuesFunction · 0.85

Tested by

no test coverage detected