| 308 | |
| 309 | |
| 310 | db_res_t * new_full_db_res(int rows, int cols) |
| 311 | { |
| 312 | db_res_t * res; |
| 313 | int i; |
| 314 | |
| 315 | res = db_new_result(); |
| 316 | |
| 317 | if( res == NULL) |
| 318 | { |
| 319 | LM_ERR("Error allocating db result\n"); |
| 320 | return NULL; |
| 321 | } |
| 322 | |
| 323 | if( db_allocate_columns(res,cols) < 0) |
| 324 | { |
| 325 | LM_ERR("Error allocating db result columns\n"); |
| 326 | pkg_free(res); |
| 327 | return NULL; |
| 328 | } |
| 329 | res->col.n = cols; |
| 330 | |
| 331 | if( db_allocate_rows(res,rows) < 0 ) |
| 332 | { |
| 333 | LM_ERR("Error allocating db result rows\n"); |
| 334 | db_free_columns( res ); |
| 335 | pkg_free(res); |
| 336 | return NULL; |
| 337 | } |
| 338 | |
| 339 | res->n = rows; |
| 340 | res->res_rows = rows; |
| 341 | res->last_row = rows; |
| 342 | |
| 343 | |
| 344 | for( i=0;i<rows;i++) |
| 345 | res->rows[i].n = cols; |
| 346 | |
| 347 | return res; |
| 348 | } |
| 349 | |
| 350 | |
| 351 |
no test coverage detected