[asterisk-bugs] [JIRA] (ASTERISK-15788) [patch] func_odbc query is limited to 15 characters

Leif Madsen (JIRA) noreply at issues.asterisk.org
Wed Dec 10 11:52:29 CST 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-15788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=223980#comment-223980 ] 

Leif Madsen commented on ASTERISK-15788:
----------------------------------------

Just to add some further commentary here. We just recently ran into something that appeared like this issue, and it was incredibly bizarre. The issue ended up being when using func_odbc against a MySQL {{longtext}} field, the func_odbc implementation won't know exactly how to handle that, so it defaults to the 15 character limit, and only returns the first 15 chars.

The work around for this is to 1) not use {{longtext}} fields, or 2) to {{CAST}} the variable into a {{varchar}}.

For example:

*func_odbc.conf*
{noformat}
...
readsql=SELECT CAST(my_awesome_longtext_column AS char(255)) FROM table_name WHERE something = '${SQL_ESC(${ARG1})}'
...
{noformat}

> [patch] func_odbc query is limited to 15 characters
> ---------------------------------------------------
>
>                 Key: ASTERISK-15788
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-15788
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Functions/func_odbc
>            Reporter: viniciusfontes
>            Severity: Minor
>         Attachments: 20100311__issue17006.diff.txt, func_odbc.c.patch
>
>
> You can't have a query string longer than 15 characters passed to ODBC_[NAME] functions. The query string is trimmed to the first 15 characters.
> There's a patch to solve this included.
> ****** ADDITIONAL INFORMATION ******
> That happens because the ast_str_create() function is called with the parameter 16. Passing 4096 to allow a 4KB string solved the issue. Patch included.



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



More information about the asterisk-bugs mailing list