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

Function db_sqlite_store_result

modules/db_sqlite/dbase.c:834–870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832 */
833
834static int db_sqlite_store_result(const db_con_t* _h, db_res_t** _r, const db_val_t* _v, const int _n)
835{
836 int rows;
837
838 if ((!_h) || (!_r)) {
839 LM_ERR("invalid parameter value\n");
840 return -1;
841 }
842
843 *_r = db_new_result();
844 if (*_r == 0) {
845 LM_ERR("no memory left\n");
846 return -2;
847 }
848
849 rows=db_sqlite_get_query_rows(_h, &count_str, _v, _n);
850
851 /* reset the length to initial for future uses */
852 if (rows < 0) {
853 LM_ERR("failed to fetch number of rows\n");
854 return -1;
855 }
856
857 /* trying to fetch all rows
858 * these values are not final values as, in the
859 * meantime, the db can be changed by another process */
860 RES_NUM_ROWS(*_r) = RES_ROW_N(*_r) = rows;
861 if (db_sqlite_convert_result(_h, *_r) < 0) {
862 LM_ERR("error while converting result\n");
863 pkg_free(*_r);
864 *_r = 0;
865
866 return -4;
867 }
868
869 return 0;
870}
871
872/**
873 * Store the name of table that will be used by subsequent database functions

Callers 2

db_sqlite_queryFunction · 0.85
db_sqlite_raw_queryFunction · 0.85

Calls 3

db_new_resultFunction · 0.85
db_sqlite_get_query_rowsFunction · 0.85
db_sqlite_convert_resultFunction · 0.85

Tested by

no test coverage detected