Summary: | ASTERISK-07800: Asterisk 1.4.0-beta2 - MySQL not working with an underbar or dash in a field name | ||
Reporter: | a (cyberdjheffer) | Labels: | |
Date Opened: | 2006-09-22 08:51:12 | Date Closed: | 2011-06-07 14:08:19 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | I have compiled Asterisk 1.4.0-beta2, Zaptel 1.4.0-beta1, and Addons 1.4.0-beta1. I have found out that although the MySQL addon does connect with Asterisk, field names with a dash or underbar in them won't work at all. I had no problem with this in Asterisk 1.2 at all. I have included my related dialplan code below. Any help is appreciated. ****** ADDITIONAL INFORMATION ****** exten => _.,n,mysql(Query resultid ${connid} select ringlength\,ring_length3 from sip_buddies where name=${ARG2} and callerid=${ARG2}) exten => _.,n,mysql(Fetch fetchid ${resultid} ringlength ring_length3) exten => _.,n,mysql(Clear ${resultid}) exten => _.,n,mysql(Disconnect ${connid}) exten => _.,n,set(TEST1=${ringlength}) exten => _.,n,set(TEST9=${ring_length3}) Console messages are as follows: ring_length3 has a value of 40 in my MySQL table, but the wrong value is being retrieved. -- Executing [s@macro-stdexten:3] MYSQL("SIP/333-08683e68", "Connect connid localhost asteriskuser asteriskpassword asteriskdb") in new stack -- Executing [s@macro-stdexten:4] MYSQL("SIP/333-08683e68", "Query resultid 1 select ringlength,ring_length3 from sip_buddies where name=334 and callerid=334") in new stack -- Executing [s@macro-stdexten:5] MYSQL("SIP/333-08683e68", "Fetch fetchid 2 ringlength ring_length3") in new stack -- Executing [s@macro-stdexten:6] MYSQL("SIP/333-08683e68", "Clear 2") in new stack -- Executing [s@macro-stdexten:7] MYSQL("SIP/333-08683e68", "Disconnect 1") in new stack -- Executing [s@macro-stdexten:9] Set("SIP/333-08683e68", "TEST1=20") in new stack -- Executing [s@macro-stdexten:10] Set("SIP/333-08683e68", "TEST9=0") in new stack | ||
Comments: | By: Sergey Tamkovich (sergee) 2006-10-05 04:13:03 You can try to enclose fields name, which contain "bad" symbols in backquotes, e.g.: exten => _.,n,mysql(Query resultid ${connid} select ringlength\,`ring_length3` from `sip_buddies` where name=${ARG2} and callerid=${ARG2}) By: jmls (jmls) 2006-11-01 13:07:06.000-0600 cyberdjheffer: did you try the solution above ? By: a (cyberdjheffer) 2006-11-08 07:15:45.000-0600 I was able to get a MySQL query to work with a combination of the tilde, single quote, and backslash characters: exten => _.,n,mysql(Query resultid ${connid} select ringlength\,`ring_length3` from `sip_buddies` where `name`=\'${ARG2}\' and `callerid`=\'${ARG2}\') By: jmls (jmls) 2006-11-08 07:26:46.000-0600 thanks for the feedback. as you can get it to work with the escape characters, I would like to close this bug report. By: Sergey Tamkovich (sergee) 2006-11-08 07:41:12.000-0600 Yes cause it's not a bug. It's even not an asterisk question :) it is a mysql question :) By: jmls (jmls) 2006-11-08 07:43:40.000-0600 not an asterisk bug |