<div dir="ltr">I am sorry if this is a duplicated post.<div><br></div><div><div>When running multi-statement request in which the first statement returns zero rows, the Erlang ODBC App returns wrong result.</div><div><br></div><div>To reproduce:</div><div><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">1> odbc:start().</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">ok</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">2> {ok, Ref}=odbc:connect("Driver=ODBC Driver 13 for SQL Server;Server=XXX;Database=<wbr>YYY;Uid=ZZZ;Pwd=PPP;Encrypt=<wbr>yes;TrustServerCertificate=no;<wbr>Connection Timeout=30;", []).</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">{ok,<0.40.0>}</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">3> odbc:sql_query(Ref, "create table z1(i integer);").</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">{updated,undefined}</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">4> odbc:sql_query(Ref, "insert into z1 select * from z1 where 1<0; select 1;").</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">{updated,0}</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1"><br></span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">As you can see, odbc_sql_query only returns the first result, and ignore all subsequence results.</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1">Looking at the source code, I found that this code block swallow subsequence result:</span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1"><br></span></p><p class="gmail-m_2361039220655552545gmail-p1" style="font-size:12.8px"><span class="gmail-m_2361039220655552545gmail-s1"></span></p><table class="gmail-m_2361039220655552545gmail-highlight gmail-m_2361039220655552545gmail-tab-size gmail-m_2361039220655552545gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-LC661" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"><br class="gmail-m_2361039220655552545gmail-Apple-interchange-newline"> <span class="gmail-m_2361039220655552545gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* OTP-5759, fails when 0 rows deleted */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L662" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC662" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> (result == SQL_NO_DATA_FOUND) {</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L663" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC663" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> msg = <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">encode_result</span>(state);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L664" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC664" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> } <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">else</span> {</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L665" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC665" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* Handle multiple result sets */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L666" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC666" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">do</span> {</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L667" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC667" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">ei_x_encode_list_header</span>(&<span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">dynam<wbr>ic_buffer</span>(state), <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">1</span>);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L668" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC668" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> msg = <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">encode_result</span>(state);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L669" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC669" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* We don't want to continue if an error occured */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L670" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC670" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> (msg.<span class="gmail-m_2361039220655552545gmail-pl-smi" style="box-sizing:border-box">length</span> != <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>) { </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L671" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC671" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">break</span>;</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L672" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC672" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> }</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L673" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC673" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> msg = <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">more_result_sets</span>(state);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L674" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC674" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* We don't want to continue if an error occured */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L675" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC675" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> (msg.<span class="gmail-m_2361039220655552545gmail-pl-smi" style="box-sizing:border-box">length</span> != <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>) { </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L676" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC676" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">break</span>;</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L677" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC677" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> }</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L678" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC678" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> } <span class="gmail-m_2361039220655552545gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">while</span> (<span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">exists_more_result_sets</span>(<wbr>state)); </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L679" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC679" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L680" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC680" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">ei_x_encode_empty_list</span>(&<span class="gmail-m_2361039220655552545gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">dynami<wbr>c_buffer</span>(state));</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_2361039220655552545gmail-L681" class="gmail-m_2361039220655552545gmail-blob-num gmail-m_2361039220655552545gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_2361039220655552545gmail-LC681" class="gmail-m_2361039220655552545gmail-blob-code gmail-m_2361039220655552545gmail-blob-code-inner gmail-m_2361039220655552545gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> }
</td></tr></tbody></table></div></div><div><span style="font-size:12.8px">I can't find any detailed information about the issue OTP-5759.</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">IMHO, the else branch is good enough for this code block. In particular, we can replace that code block by:</div><span class="gmail-im" style="font-size:12.8px"><div><br></div><div><table class="gmail-m_1453508585797017360gmail-highlight gmail-m_1453508585797017360gmail-tab-size gmail-m_1453508585797017360gmail-js-file-line-container" style="box-sizing:border-box;border-collapse:collapse;color:rgb(51,51,51);font-family:-apple-system,blinkmacsystemfont,"segoe ui",helvetica,arial,sans-serif,"apple color emoji","segoe ui emoji","segoe ui symbol";font-size:14px"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-LC665" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"><span class="gmail-m_1453508585797017360gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* Handle multiple result sets */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L666" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC666" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">do</span> {</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L667" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC667" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">ei_x_encode_list_header</span>(&<span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">dynam<wbr>ic_buffer</span>(state), <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">1</span>);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L668" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC668" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> msg = <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">encode_result</span>(state);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L669" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC669" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* We don't want to continue if an error occured */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L670" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC670" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> (msg.<span class="gmail-m_1453508585797017360gmail-pl-smi" style="box-sizing:border-box">length</span> != <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>) { </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L671" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC671" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">break</span>;</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L672" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC672" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> }</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L673" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC673" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> msg = <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">more_result_sets</span>(state);</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L674" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC674" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)">/* We don't want to continue if an error occured */</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L675" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC675" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> (msg.<span class="gmail-m_1453508585797017360gmail-pl-smi" style="box-sizing:border-box">length</span> != <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>) { </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L676" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC676" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">break</span>;</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L677" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC677" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> }</td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L678" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC678" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> } <span class="gmail-m_1453508585797017360gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">while</span> (<span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">exists_more_result_sets</span>(<wbr>state)); </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L679" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC679" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> </td></tr><tr style="box-sizing:border-box"><td id="gmail-m_1453508585797017360gmail-L680" class="gmail-m_1453508585797017360gmail-blob-num gmail-m_1453508585797017360gmail-js-line-number" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-size:12px;line-height:20px;color:rgba(0,0,0,0.298039);text-align:right;white-space:nowrap;vertical-align:top"></td><td id="gmail-m_1453508585797017360gmail-LC680" class="gmail-m_1453508585797017360gmail-blob-code gmail-m_1453508585797017360gmail-blob-code-inner gmail-m_1453508585797017360gmail-js-file-line" style="font-family:consolas,"liberation mono",menlo,courier,monospace;box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;word-wrap:normal;white-space:pre-wrap"> <span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">ei_x_encode_empty_list</span>(&<span class="gmail-m_1453508585797017360gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">dynami<wbr>c_buffer</span>(state));</td></tr></tbody></table></div><div><br></div><div><br></div></span><div style="font-size:12.8px">I am afraid that doing so will re-surface the issue reported by OTP-5759. </div><div style="font-size:12.8px">If you have detailed information(for example: bug report, how it was fixed), please share with me.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks,</div><div style="font-size:12.8px">Tuan</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>