|
@@ -47,26 +47,18 @@
|
|
int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
|
|
int db_mysql_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)
|
|
{
|
|
{
|
|
unsigned long* lengths;
|
|
unsigned long* lengths;
|
|
- int i, len;
|
|
|
|
|
|
+ int i;
|
|
|
|
|
|
if ((!_h) || (!_res) || (!_r)) {
|
|
if ((!_h) || (!_res) || (!_r)) {
|
|
LM_ERR("invalid parameter value\n");
|
|
LM_ERR("invalid parameter value\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- len = sizeof(db_val_t) * RES_COL_N(_res);
|
|
|
|
- ROW_VALUES(_r) = (db_val_t*)pkg_malloc(len);
|
|
|
|
- if (!ROW_VALUES(_r)) {
|
|
|
|
- LM_ERR("no private memory left\n");
|
|
|
|
- return -1;
|
|
|
|
|
|
+ if (db_allocate_row(_res, _r) != 0) {
|
|
|
|
+ LM_ERR("could not allocate row");
|
|
|
|
+ return -2;
|
|
}
|
|
}
|
|
- LM_DBG("allocate %d bytes for row values at %p\n", len,
|
|
|
|
- ROW_VALUES(_r));
|
|
|
|
-
|
|
|
|
- memset(ROW_VALUES(_r), 0, len);
|
|
|
|
- /* Save the number of columns in the ROW structure */
|
|
|
|
- ROW_N(_r) = RES_COL_N(_res);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
lengths = mysql_fetch_lengths(CON_RESULT(_h));
|
|
lengths = mysql_fetch_lengths(CON_RESULT(_h));
|
|
|
|
|
|
for(i = 0; i < RES_COL_N(_res); i++) {
|
|
for(i = 0; i < RES_COL_N(_res); i++) {
|