[Home]

Summary:ASTERISK-11510: func_odbc does not use readhandle for readsql
Reporter:Kamil Czajko (kactus)Labels:
Date Opened:2008-02-25 23:15:34.000-0600Date Closed:2008-02-27 09:39:58.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Hi

When using func_odbc in format

[FUNCTION]
readhandle=database
readsql= select a from b

readsql will never execute unless a writehandle is set with the dns name. This also occurs whether or not dns=database is set as well.

in the source you can see that stmt is initialised to null at line 254 in func_odbc.c (function acf_odbc_read) and is only then set on line 313 when writehandle is being tested.

stmt is then tested on line 319  and if a valid writehandle has not been found it throw an error and exits the function.


****** ADDITIONAL INFORMATION ******

Actually using 1.6.0-beta4 but its not in your drop down.
Comments:By: Digium Subversion (svnbot) 2008-02-26 00:39:47.000-0600

Repository: asterisk
Revision: 104125

U   trunk/funcs/func_odbc.c

------------------------------------------------------------------------
r104125 | tilghman | 2008-02-26 00:39:42 -0600 (Tue, 26 Feb 2008) | 2 lines

Use the readhandle for reads (closes issue ASTERISK-11510)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=104125

By: Kamil Czajko (kactus) 2008-02-26 19:55:24.000-0600

Please reread the issue, when using

[FUNCTION]
readhandle=database
readsql= select a from b

it does not work and throws the error:

[Feb 27 19:50:21] ERROR[25133]: func_odbc.c:320 acf_odbc_read: Unable to execute query [select a from b]

The reason for the error is listed above but to reiterate:

readsql does not use readhandle regardless of what the documentation states, it is a bug
the function acf_odbc_read in func_odbc.c source check for writehandle and if not found exits

Please at least test before closing again and note that asterisk version is 1.6.0-beta4 as mentioned in the additional information.

Current work around is to specify a writehandle for your readsql to work.

Thank you

By: Tilghman Lesher (tilghman) 2008-02-27 09:35:54.000-0600

Betas don't change; but it was fixed in SVN.  Please try the latest SVN before reopening a bug that was fixed.

By: Joshua C. Colp (jcolp) 2008-02-27 09:39:38.000-0600

This issue was closed because Corydon committed a change which fixed the issue in question in revision 104125. This change will be in the next beta.