<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9070">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_odbc: NODATA if SQLNumResultCols returned 0 columns on readsql<br><br>The functions acf_odbc_read/cli_odbc_read ignore a number of columns<br>returned by the SQLNumResultCols.<br>If the number of columns is zero it means no data.<br>In this case, a SQLFetch function has to be not called,<br>because it will cause an error.<br><br>ASTERISK-27888 #close<br><br>Change-Id: Ie0f7bdac6c405aa5bbd38932c7b831f90729ee19<br>---<br>M funcs/func_odbc.c<br>1 file changed, 24 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c<br>index d19b56f..f4821c0 100644<br>--- a/funcs/func_odbc.c<br>+++ b/funcs/func_odbc.c<br>@@ -859,6 +859,21 @@<br>            return -1;<br>    }<br> <br>+ if (colcount <= 0) {<br>+              ast_verb(4, "Returned %d columns [%s]\n", colcount, ast_str_buffer(sql));<br>+          buf[0] = '\0';<br>+               SQLCloseCursor(stmt);<br>+                SQLFreeHandle (SQL_HANDLE_STMT, stmt);<br>+               release_obj_or_dsn (&obj, &dsn);<br>+             if (!bogus_chan) {<br>+                   pbx_builtin_setvar_helper(chan, "ODBCROWS", "0");<br>+                        pbx_builtin_setvar_helper(chan, "ODBCSTATUS", "NODATA");<br>+                 ast_autoservice_stop(chan);<br>+          }<br>+            odbc_datastore_free(resultset);<br>+              return 0;<br>+    }<br>+<br>  res = SQLFetch(stmt);<br>         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {<br>                 int res1 = -1;<br>@@ -1522,6 +1537,15 @@<br>                                return CLI_SUCCESS;<br>                   }<br> <br>+                 if (colcount <= 0) {<br>+                              SQLCloseCursor(stmt);<br>+                                SQLFreeHandle (SQL_HANDLE_STMT, stmt);<br>+                               release_obj_or_dsn (&obj, &dsn);<br>+                             ast_cli(a->fd, "Returned %d columns.  Query executed on handle %d:%s [%s]\n", colcount, dsn_num, query->readhandle[dsn_num], ast_str_buffer(sql));<br>+                           AST_RWLIST_UNLOCK(&queries);<br>+                             return CLI_SUCCESS;<br>+                  }<br>+<br>                  res = SQLFetch(stmt);<br>                         if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {<br>                                 SQLCloseCursor(stmt);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9070">change 9070</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9070"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie0f7bdac6c405aa5bbd38932c7b831f90729ee19 </div>
<div style="display:none"> Gerrit-Change-Number: 9070 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>