Is there any way to return multiple values from functions defined in func_odbc.conf?
It appears that you can only return one value.
Yes you can. Use Array. e.g.,
Dialplan in extensions. conf,
… …
same => n,Set(ARRAY(value1,value2)=${GET_VALUES(${MyID})})
funcodbc.conf,
… …
[GET_VALUES]
dsn=asterisk-db
readsql=SELECT field1,field2 from table where id=${SQL_ESC(${ARG1})}
–Satish Barot
Thank’s satish4asterisk,
What i mean is that my SQL request is:
func_odbc.conf:
[GET_VALUES]
dsn=asterisk-db
readsql=SELECT field from table where id= ${ARG1} ; where ‘field’ is a list of values.
extensions.conf:
same =>n,set(Values=${GET_VALUES(${Myid})})
But when i tried this solution, ‘values’ is populated JUST by the first value of the list.
How can i get all values of ‘field’ in my extensions.conf ?
So you are talking about how to handle multiple rows from func_odbc.
Go through following link anf check the section Multirow Functionality with func_odbc to get the idea.
scribd.com/doc/54892783/294/ … -func-odbc
–Satish Barot
I steel have the same problem odbc_fetch doesn’t work, ODBC_FETCH returns just the first row. and
ODBCROWS=1 instead of 2
Can anyone help me ?
(1) Do you have mode set to multirow in your function? Post complete [GET_VALUES] function from funcodbc.conf.
(2)Post dialplan snippet where you expect result for GET_VALUES function.
–Satish Barot
thanks it works now