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