[asterisk-users] mysql call stored procedure

Borin katerin.borin at gmail.com
Wed May 18 02:45:05 CDT 2011


MYSQL(Nextresult resultid ${connid}) after MySQL(Fetch fetchid ${resultid}
pass) helped to resolve this.
you should  always get all results sp produce otherwise mysql returns error.

On Tue, May 17, 2011 at 4:36 PM, Borin <katerin.borin at gmail.com> wrote:

> Hi Guys,
> I am getting an error when executing another mysql query in dialplan after
> calling stored procedure.
> If calling the procedure from mysql cli it gives a result like:
> mysql> call call_control(78236721,1000,1233);
> +------+
> | pass |
> +------+
> |    1 |
> +------+
> So I need asterisk to recognize this pass and take some actions based on
> what the pass value is.
> Dialplan looks like this:
>
> MYSQL(Connect connid ${DBDefaultHost} ${DBuser} ${DBpass} ${DBname})
> MySQL(Query resultid ${connid} CALL call_control(78236721,1000,1233))
> MySQL(Fetch fetchid ${resultid} pass)
> MYSQL(clear ${resultid})
> MySQL(Query resultid ${connid} SELECT/INSERT whatever from table)
>
> So, it gives me this pass value correct, but if I execute some other query
> INSERT or SELECT after clearing the result, it gives me an error
> [May 17 16:16:13] WARNING[19572]: app_addon_sql_mysql.c:374 aMYSQL_query:
> aMYSQL_query: mysql_query failed. Error: Commands out of sync; you can't run
> this command now
> The error disappears if I reconnect to mysql after calling the stored
> procedure but it seams not right to me to connect to mysql 2 times for 1
> call.
>
> Did anyone have the same issue?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110518/b6d83790/attachment.htm>


More information about the asterisk-users mailing list