| 832 | */ |
| 833 | |
| 834 | static 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 |
no test coverage detected