[sr-dev] [sqlops] What does sql_query return in case of DB error?
Iñaki Baz Castillo
ibc at aliax.net
Tue Aug 3 17:04:37 CEST 2010
2010/8/3 Henning Westerholt <henning.westerholt at 1und1.de>:
> On Monday 02 August 2010, Iñaki Baz Castillo wrote:
>> Hi, sqlops module documentation doesn't say what the function
>> sql_query returns in case of DB failure. I'll do my tests but if
>> somebody knows I would like to know the expected return code.
>
> Hi Iñaki,
>
> it returns this values:
>
> * 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?
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?
Thanks a lot.
--
Iñaki Baz Castillo
<ibc at aliax.net>
More information about the sr-dev
mailing list