[asterisk-bugs] [JIRA] (ASTERISK-23937) Syntax Error ODBC SQL

Rusty Newton (JIRA) noreply at issues.asterisk.org
Wed Jun 25 19:12:56 CDT 2014


     [ https://issues.asterisk.org/jira/browse/ASTERISK-23937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rusty Newton updated ASTERISK-23937:
------------------------------------

    Description: 
Hi there,

currently I tried to find the string where the SQL is built.
There is an missing apostroph or missing backslash depends on what should be achieved.
look on this debug:
{noformat}
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare:                                                                                                                                                              Skip: 0; SQL: SELECT * FROM sippeers WHERE host = ? AND insecure LIKE ? ESCAPE                                                                                                                                                              '\' ORDER BY host
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 1 ('host') = 'xxx.xxx.xxx.xxx'
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 2 ('insecure LIKE') = '%port%'
[Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysq                                                                                                                                                             ld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manua                                                                                                                                                             l that corresponds to your MySQL server version for the right syntax to use near                                                                                                                                                              ''\' ORDER BY host' at line 1 (219)
[Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:667 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute error -1! Verifying connection to asterisk [asterisk-conne                                                                                                                                                             ctor]...
{noformat}
and second:
{noformat}
[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare: Skip: 0; SQL: SELECT * FROM sippeers WHERE ipaddr = ? AND insecure LIKE ? ESCAPE '\' ORDER BY ipaddr
[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 1 ('ipaddr') = 'xxx.xxx.xxx.xxx'
[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 2 ('insecure LIKE') = '%port%'
[Jun 25 22:52:51] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysqld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\' ORDER BY ipaddr' at line 1 (221)
{noformat}

  was:
Hi there,

currently I tried to find the string where the SQL is built.
There is an missing apostroph or missing backslash depends on what should be achieved.
look on this debug:
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare:                                                                                                                                                              Skip: 0; SQL: SELECT * FROM sippeers WHERE host = ? AND insecure LIKE ? ESCAPE                                                                                                                                                              '\' ORDER BY host
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 1 ('host') = 'xxx.xxx.xxx.xxx'
[Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 2 ('insecure LIKE') = '%port%'
[Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysq                                                                                                                                                             ld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manua                                                                                                                                                             l that corresponds to your MySQL server version for the right syntax to use near                                                                                                                                                              ''\' ORDER BY host' at line 1 (219)
[Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:667 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute error -1! Verifying connection to asterisk [asterisk-conne                                                                                                                                                             ctor]...

and second:

[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare: Skip: 0; SQL: SELECT * FROM sippeers WHERE ipaddr = ? AND insecure LIKE ? ESCAPE '\' ORDER BY ipaddr
[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 1 ('ipaddr') = 'xxx.xxx.xxx.xxx'
[Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 2 ('insecure LIKE') = '%port%'
[Jun 25 22:52:51] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysqld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\' ORDER BY ipaddr' at line 1 (221)



> Syntax Error ODBC SQL
> ---------------------
>
>                 Key: ASTERISK-23937
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-23937
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_config_odbc, Resources/res_odbc
>    Affects Versions: 12.3.2
>         Environment: Ubuntu 12.04.4 LTS Server
> Asterisk 12.3.2
> ODBC on local MySQL
>            Reporter: Simon Balkau
>            Severity: Trivial
>
> Hi there,
> currently I tried to find the string where the SQL is built.
> There is an missing apostroph or missing backslash depends on what should be achieved.
> look on this debug:
> {noformat}
> [Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare:                                                                                                                                                              Skip: 0; SQL: SELECT * FROM sippeers WHERE host = ? AND insecure LIKE ? ESCAPE                                                                                                                                                              '\' ORDER BY host
> [Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 1 ('host') = 'xxx.xxx.xxx.xxx'
> [Jun 25 22:52:21] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare:                                                                                                                                                              Parameter 2 ('insecure LIKE') = '%port%'
> [Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysq                                                                                                                                                             ld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manua                                                                                                                                                             l that corresponds to your MySQL server version for the right syntax to use near                                                                                                                                                              ''\' ORDER BY host' at line 1 (219)
> [Jun 25 22:52:21] WARNING[3692][C-00000002]: res_odbc.c:667 ast_odbc_prepare_and                                                                                                                                                             _execute: SQL Execute error -1! Verifying connection to asterisk [asterisk-conne                                                                                                                                                             ctor]...
> {noformat}
> and second:
> {noformat}
> [Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:112 custom_prepare: Skip: 0; SQL: SELECT * FROM sippeers WHERE ipaddr = ? AND insecure LIKE ? ESCAPE '\' ORDER BY ipaddr
> [Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 1 ('ipaddr') = 'xxx.xxx.xxx.xxx'
> [Jun 25 22:52:51] DEBUG[3692][C-00000002]: res_config_odbc.c:128 custom_prepare: Parameter 2 ('insecure LIKE') = '%port%'
> [Jun 25 22:52:51] WARNING[3692][C-00000002]: res_odbc.c:655 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysqld-5.5.37-0ubuntu0.12.04.1]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\' ORDER BY ipaddr' at line 1 (221)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list