[sr-dev] need for more informative db query error message

Daniel-Constantin Mierla miconda at gmail.com
Thu May 21 12:45:58 CEST 2015


Yes, you can commit.

The only thing I may consider is checking the length of query not to be
very big and print only first 100 chars or so in that case, like:

LM_ERR("failed to execute query [%.*s] on async worker\n",
 		(p[1].len>100)?100:p[1].len, p[1].s);


It would be probably enough to detect which query was, last part being
the values which can be large if one wants to insert full message
content via sqlops, for example.

Cheers,
Daniel

On 21/05/15 08:35, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> perhaps the log in db_mysql_async_exec_task() can be easily extended to
>> print more details.
> looks like it.  i made the change below.  is it ok to commit the diff?
>
> -- juha
>
> *** /usr/src/orig/kamailio/modules/db_mysql/km_dbase.c	Mon May  4 10:34:34 2015
> --- km_dbase.c	Thu May 21 09:27:57 2015
> ***************
> *** 140,146 ****
>   		return;
>   	}
>   	if(db_mysql_submit_query(dbc, &p[1])<0) {
> ! 		LM_ERR("failed to execute query on async worker\n");
>   	}
>   	db_mysql_close(dbc);
>   }
> --- 140,147 ----
>   		return;
>   	}
>   	if(db_mysql_submit_query(dbc, &p[1])<0) {
> ! 		LM_ERR("failed to execute query [%.*s] on async worker\n",
> ! 		       p[1].len, p[1].s);
>   	}
>   	db_mysql_close(dbc);
>   }

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com




More information about the sr-dev mailing list