[asterisk-users] func_odbc questions

Tim Panton thp at westhawk.co.uk
Mon Dec 1 09:29:00 CST 2008


On 1 Dec 2008, at 13:38, Giedrius Augys wrote:

>
>
> 2008/12/1 Tilghman Lesher <tilghman at mail.jeffandtilghman.com>
> On Monday 01 December 2008 06:15:15 Giedrius Augys wrote:
> >   I'm working with asterisk 1.6. And I have success using  
> func_odbc with
> > one row query results (SELECT source,destination from cc  
> WHERE ... ):
> > exten => s,1,Ringing
> > exten => s,n,Wait(4)
> > exten => s,n,Answer
> > exten =>
> > s,n,Set(ARRAY(NUMBER,REALNUMBER1,REALNUMBER2,STATUSAS)=$ 
> {ODBC_GETVARIABLES(
> >${NUMERIS})}) exten => s,n,Verbose(1| ${NUMERIS}, ${REALNUMBER1}
> > ${REALNUMBER1}, ${STATUSAS})
> >
> >
> > But I don't know how to retrieve data, if query returns a lot of  
> rows. In
> > documentation I read that need to use in config file:
> > mode=multirow,
> > and use function ODBC_FETCH. But how to get result-id variable and  
> use
> > ODBC_FETCH?
>
> The initial result in mode=multirow is not data at all, but a  
> query_id that
> may be used with ODBC_FETCH to return the first row of data and every
> subsequent row of data (up to the max number of rows, if any).
>
> > And another question is, if I execute not SELECT , but stored  
> procedure,
> > and this procedure will return two, three tables? Is it possible  
> retrieve
> > these data from couple tables?
>
> If you're talking about a JOIN, then yes.  As long as the fields  
> have distinct
> names, then you can retrieve each row in turn, same as any other  
> query.
>
> --
> Tilghman
>
> _______________________________________________
> -- 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
>
>
> Thanks for your reply, but I don't get it... Is there any  
> documentation or simple examples how to use ODBC_FETCH and so on.
>

For your own sanity (if nothing else) I'd wrap the stored procedure in  
a view, then
get FUNC_ODBC to query that view.

Tim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20081201/b4f06c40/attachment-0001.htm 


More information about the asterisk-users mailing list