Setting a mysql connect variables at the top


#1

Hi…I do a lot of things with mysql in extension.conf’s include scripts.

I would like to set the connect string as a variable at the top of each script so I do not have to go to every line that i connect to mysql and change it.
Example :

exten => 1,31,MYSQL(connect connid tigger astusr password dbname)
exten => 1,32,MYSQL(query resultid ${connid} select pin from _mobile where MobileNo=’${phone_num}’)
exten => 1,33,MYSQL(fetch fetchid ${resultid} passrd1)

Is there a way to set line 31 as a variable at the top? so i do not have spell out the connect string to connect to mysql ???
I switch between different databases.
thanks
mjh


#2

You can use global variable.


#3

Can you give me an example ???
I have tried many ways to set it…but find that i am unable to.
thanks
mjh


#4

Do i have to iniate a connect command everytime i connect to mysql for a select, insert,update or call a stored procedure???
Is there any easy way to do this ??
can you point me to a url or an example of how this can be accomplished???
thanks
mjh