On Tuesday 03 August 2010, Iñaki Baz Castillo wrote:
* 1 on succes
* 2 on success, but no result after query
* -1 on failure
modules_k/sqlops/sql_api.c
197:int sql_do_query(struct sip_msg *msg, sql_con_t *con, pv_elem_t
*query,
Thanks a lot for the clarification. Would make sense this information
to be added in the documentation?
Hi Iñaki,
yes, i think it would be useful.
Let me another question. Let's suppose the
following case:
-------------------
sql_query("con1", "SELECT field1 FROM table1", "res");
sql_query("con1", "SELECT field1, field2, field3 FROM table2",
"res");
sql_result_free("res");
------------------
Is it safe? This is, can I perform a second query storing the result
in same "res" structure without freeing before? would it leak? would
be overlap in the "res" structure after the second query?
AFAIK this was discussed to some extend earlier - if i remember correctly the
second sql_query will free the first result set before executing its SQL. So
neiter the queries nor the result sets should overlap. If you looking for
something like a cfg script DB "fetch_result", then i think this is currently
not available. But of course this could be added.
Regards,
Henning