[asterisk-users] mySQL connection testing

Andrew Thomas andy at datavox.co.uk
Thu Mar 3 09:19:23 CST 2011


MYSQL_STATUS???

Is this documented anywhere (as I can't seem to find anything about this
variable)?

Remember, I need to test whether a specific {connid} is still connected
or not - not the whole mySQL connection.

As for the 'wait' command in my example - it is there purely for testing
purposes - otherwise you'd have to be damn quick to beat the disconnect
(but it's not impossible)!



-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Doug Lytle
Sent: 03 March 2011 15:03
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] mySQL connection testing


Andrew Thomas wrote:
> The wait is there as a test.  This gives the 'tester' the option of 
> hanging up before the disconnect or not.
>    

And the purpose for that would be to share available connections?

I've always considered it bad to leave a connection open and have always

closed them down after a query.

Either way, I test for mysql connection errors by:

exten => s,n,GotoIf($["${MYSQL_STATUS}" = "-1"]?mysql_failed,s,1)

Doug


-- 

Ben Franklin quote:

"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."


-- _____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


 If you have received this communication in error we would appreciate
you advising us either by telephone or return of e-mail. The contents
of this message, and any attachments, are the property of DataVox,
and are intended for the confidential use of the named recipient only.
If you are not the intended recipient, employee or agent responsible
for delivery of this message to the intended recipient, take note that
any dissemination, distribution or copying of this communication and
its attachments is strictly prohibited, and may be subject to civil or
criminal action for which you may be liable.
Every effort has been made to ensure that this e-mail or any attachments
are free from viruses. While the company has taken every reasonable
precaution to minimise this risk, neither company, nor the sender can
accept liability for any damage which you sustain as a result of viruses.
It is recommended that you should carry out your own virus checks
before opening any attachments. 

Registered in England. No. 27459085.





More information about the asterisk-users mailing list