[Asterisk-Users] Updated app_mysql.c, enabling use of INSERT and UPDATE

Andreas Sikkema andreas.sikkema at ritstele.com
Fri Aug 27 02:32:37 MST 2004


Hi,

For those interested in using MySQL directly from extensions.conf, there's 
already a source file floating around for using a MYSQL application to 
do SELECT queries.

We're using the MYSQL app a lot in our exensions.conf, but we missed 
support for queries that don't return a result like UPDATE or INSERT. 
Here's an updated app_mysql.c which introduces the Execute command. 

Sample:
exten => s,300,MYSQL(Connect connid ${HOST} ${USER} ${PASSWORD} ${DATABSE})
exten => s,301,MYSQL(Execute resultid ${connid} UPDATE table SET haveSetting = 1 WHERE dnid=\'${CALLERIDNUM}\')
exten => s,302,MYSQL(Disconnect ${connid})

This somewhat mimics the way the Borland implements this type of queries 
in their products like Delphi.

It is a quick hack, but we've been using it for a couple of days now and 
have not seen any issues with it. (yet? ;-) )

Enjoy.

-- 
Andreas Sikkema                Rits tele.com
Scheepmakersstraat 11      3011 VH Rotterdam
t: +31 (0)10 2245544    f: +31 (0)10 2245540
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app_mysql.c
Type: application/octet-stream
Size: 13518 bytes
Desc: app_mysql.c
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20040827/35ae1c80/app_mysql.obj


More information about the asterisk-users mailing list