[asterisk-users] func_odbc creating records or best practice

Sherwood McGowan sherwood.mcgowan at gmail.com
Fri May 9 11:40:25 CDT 2008


David Van Ginneken wrote:
> Al Baker wrote:
>   
>> I would love to be able to issues the necessary Mysql commands to have 
>> true TRANSACTIONS
>> Such as - Begin Transaction
>>                Select @var=agent.id, agent.exstension where 
>> agent.status='free'
>>                 Update agent.status='BUSY' where agent.id=@var
>>                 End Transaction
>> Of Course the syntax I used above is just psuedo-code and NOT correct MySQL
>> but I think you can see what I am trying to do. Which I think would be 
>> darn handy !!!
>>
>>   
>>     
> I'm not sure if it supports it now as I've never had a need nor tried,
> but being able to call stored procedures would be a great addition (If
> its not already there) and solve many transaction problems as the
> transactions could be done on the server side. Here is a psuedo example
> based on your example.
>
>
> CREATE PROCEDURE `get_available_agent`(
> /* Field sizes are arbitrary just for example purposes */
> OUT agentid varchar(10),
> OUT extension varchar(100)
> )
> BEGIN
> select agents.agentid, agents.extension from agents into agentid,
> extension where agents.status = 'FREE' limit 0,1 FOR UPDATE;
> if (agentid IS NOT NULL) then
> update agents set agents.status = 'BUSY' where agents.agentid = agentid;
> end if;
>
> END
>
> If the ODBC driver or implementation cannot read output parameters, just
> do a select agentid, extension and have it read the resultset.
>
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>   
Actually, I don't know about the ODBC func, but there's a patch for 
app_mysql_addon() that allows use of stored procedures, I use it quite often



More information about the asterisk-users mailing list