ltatas
January 19, 2020, 2:56pm
1
Hi friends
I have the problem with the query
In the message find this error
app_mysql.c:417 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\ Number\ from\ _numbersEnabled' at line 1
And this the query with error
exten => _.,n,MYSQL(Query resultid ${connid} SELECT\ Number\ from\ _numbersEnabled\ where\ Number={$EXTEN})
I find on internet but dont find the problem.
MYSQL app it is deprecated, also you have an issue with the query, I was about this app and it says âNOTE, using the backslash âescapeâ character in front of spaces and other special characters, as is done above in the SELECT command, is no longer needed as of asterisk 1.6.x, in fact it will cause the commands to fail.â
maybe, check your asterisk module!
specaily app_mysql.so in /usr/lib/asterisk/module or /usr/lib64/asterisk/module
I think the module is correctly loaded, as the error point specifically to Query format issue.
app_mysql.c:417 aMYSQL_query: aMYSQL_query: mysql_query failed. Err
Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near â\ Number\ from\ _numbersEnabledâ at line 1
Thanks. youâre right!!
1 Like
ltatas
January 20, 2020, 7:45am
6
ambiorixg12:
MYSQL app it is deprecated, also you have an issue with the query, I was about this app and it says âNOTE, using the backslash âescapeâ character in front of spaces and other special characters, as is done above in the SELECT command, is no longer needed as of asterisk 1.6.x, in fact it will cause the commands to fail.â
Hi ambiorixg12 i try with and without backslash but dont work and have same error
I have this extension.conf
exten => _X.,3,MYSQL(Connect connid localhost mouse password database)
exten => _X.,4,MYSQL(Query resultid ${connid} SELECT\ Enabled\ FROM\ _numbersEnabled\ WHERE\ Number=${CALLERID})
I try the QUERY on MYSQL and work but when is in extension dont work.
How can try the connection on SQL?
Shell Function easiest method
ODBC recommended method
ltatas
January 20, 2020, 4:58pm
8
I check but the configuration is ok.
echo âshow tables;â | isql -v db-connect
±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL> show tables;
±-------------------------------------------------------------------------+
| Tables_in_db |
±-------------------------------------------------------------------------+
| _numbersEnabled |
±-------------------------------------------------------------------------+
SQLRowCount returns 1
1 rows fetched
odbc show
ODBC DSN Settings
Name: MySQL-db
DSN: db-connect
Last fail connection attempt: 2020-01-19 20:34:14
Number of active connections: 0 (out of 1)
Logging: Disabled
I want check from extension it is work.
I think MYSQL function doesnt use ODBC, assuming query is OK, try using ODBC directly or Shell function as I made reference before
I mean use ODBC, it s that instead of use MYSQL command switch to func_odbc on the dial plan
ltatas
January 20, 2020, 5:10pm
12
Scuse me but i dont know.
How can I do?
ltatas
January 20, 2020, 6:38pm
14
This is crazy
I remove the backslash and now i dont have the problem and the query work
congrats!
I check it out at CentOS 6 + Asterisk 16 + MySQL 5.5.62
https://hsunryou.blog.me/221707313582?Redirect=Log&from=postView
I pointed about that on my first post, but you said you tried without and with it
ltatas
January 23, 2020, 8:51am
17
Yes i try with and without backslash.
It is a possibile that it was a space?
system
Closed
February 22, 2020, 8:51am
18
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.