[OpenSIPS-Users] I have changed the dbase.c source code. There was an unnecessary log.

Johan De Clercq johan at democon.be
Sat Mar 12 10:25:29 CET 2016


IT makers sense.

Verzonden vanuit Outlook Mobile




On Fri, Mar 11, 2016 at 11:55 AM -0800, "Rodrigo Pimenta Carvalho" <pimenta at inatel.br> wrote:



















Hi.







I'm using a release of OpenSIPS 2.1 from 2015.









When I use avp_db_query to execute SQL Select, everything is ok.


However if I use avp_db_query to execute, let's say, a SQL Update, there is a misinterpretation of a parameter in db_sqlite_free.







The parameter _r will be null and the original function db_sqlite_free interprets it as an invalid parameter. But it is not. For SQL Updates, the result (_r) will be null. It is not an error.


So, there is no need to log 'invalid parameter value' message. In this case, I have changed the beginning of the function db_sqlite_free as you can see:














/**

 * Release a result set from memory.

 * \param _h handle to the database

 * \param _r result set that should be freed

 * \return zero on success, negative value on failure

 */

int db_sqlite_free_result(db_con_t* _h, db_res_t* _r)

{

    int i;

    int j;

    db_val_t* v;

    db_row_t* res_col;



    if (!_h) {

        LM_ERR("invalid parameter value
");

        return -1;

    }

        if (!_r){

      return 0; //Returns zero because it is  not a problem when this parameter is null, for example.

    }


.


.


.







Does it make sense?







Regards.




















RODRIGO PIMENTA CARVALHO

Inatel Competence Center

Software

Ph: +55 35 3471 9200 RAMAL 979













-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160312/2f139bf7/attachment.htm>


More information about the Users mailing list