Hi Paul,<br><br>Thanks for the pointers. I have attached a couple of new patches, one one R13B03 and the other over commit f3b6a575fceb957805c3b8d8af796a749cbad61c. <br><br>I'm new here and don't understand the code fully yet. Though my particular case is behaving fine now, I'm not sure if I have fixed/tested all conditions. I had to revert back a change done in get_diagnos where the loop should break
after SQLGetDiagRec returns SQL_NO_DATA.<br><br>Reagrds,<br>Tan<br>
<br><div class="gmail_quote">On Thu, Dec 10, 2009 at 5:34 AM, Paul Oliver <span dir="ltr"><<a href="mailto:puzza007@gmail.com">puzza007@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Tan,<br>
<br>
This looks like it could be similar to the bug I observed in<br>
<a href="http://github.com/erlang/otp/commit/f3b6a575fceb957805c3b8d8af796a749cbad61c" target="_blank">http://github.com/erlang/otp/commit/f3b6a575fceb957805c3b8d8af796a749cbad61c</a>.<br>
In fact, it looks like you could easily modify that patch to work in<br>
your case. Check<br>
<a href="http://msdn.microsoft.com/en-us/library/ms716219%28VS.85%29.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms716219%28VS.85%29.aspx</a> for<br>
details.<br>
<br>
Cheers,<br>
Paul.<br>
<div><div></div><div class="h5"><br>
On Wed, Dec 9, 2009 at 6:51 PM, tan <<a href="mailto:tanmaykm@gmail.com">tanmaykm@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I have had a bit of trouble getting erlang to work with iodbc on<br>
> Darwin (Mac Snow Leopard). I could get odbc to work only after<br>
> configuring with --enable-darwin-64bit and getting odbcserver to<br>
> statically link to iodbc. I am using postgresql as my database.<br>
><br>
> The most recent trouble I faced seemed to be because of a call to<br>
> SQLNumResultCols after getting a SQL_NO_DATA_FOUND during a table<br>
> update/delete SQL. The odbcserver process exits with error whenever a<br>
> statement generates SQL_NO_DATA_FOUND. Below is the trace log where<br>
> the error happens.<br>
><br>
> ================= trace start ======================<br>
> [000018.849750]<br>
> odbcserver 7FFF707D2BE0 ENTER SQLExecDirect<br>
> SQLHSTMT 0x10020ec60<br>
> SQLCHAR * 0x10020eb91<br>
> | update game_plays set story_id = 2, wher |<br>
> | e play_id = 101 |<br>
> SQLINTEGER -3 (SQL_NTS)<br>
><br>
> [000018.851035]<br>
> odbcserver 7FFF707D2BE0 EXIT SQLExecDirect with return code 100<br>
> (SQL_NO_DATA_FOUND)<br>
> SQLHSTMT 0x10020ec60<br>
> SQLCHAR * 0x10020eb91<br>
> SQLINTEGER -3 (SQL_NTS)<br>
><br>
> [000018.851071]<br>
> odbcserver 7FFF707D2BE0 ENTER SQLNumResultCols<br>
> SQLHSTMT 0x10020ec60<br>
> SQLSMALLINT * 0x7fff5fbfe8ee<br>
><br>
> [000018.851098]<br>
> odbcserver 7FFF707D2BE0 EXIT SQLNumResultCols with return code<br>
> -1 (SQL_ERROR)<br>
> SQLHSTMT 0x10020ec60<br>
> SQLSMALLINT * 0x7fff5fbfe8ee<br>
> ================= trace end ======================<br>
><br>
><br>
><br>
> To circumvent the issue, I modified odbcserver.c (patch below) to<br>
> prevent calls to SQLNumResultCols in such cases.<br>
><br>
> Is this fix correct?<br>
> Did anybody else face similar issues?<br>
> Is there a better way for getting odbc to work instead of doing a<br>
> 64bit compile and static linking with iodbc correct?<br>
><br>
> Regards,<br>
> Tan<br>
><br>
><br>
> ================= patch file start ======================<br>
> 154c154<br>
> < static db_result_msg encode_result(db_state *state);<br>
> ---<br>
>> static db_result_msg encode_result(db_state *state, SQLRETURN sql_result);<br>
> 588c588<br>
> < msg = encode_result(state);<br>
> ---<br>
>> msg = encode_result(state, result);<br>
> 593c593<br>
> < msg = encode_result(state);<br>
> ---<br>
>> msg = encode_result(state, result);<br>
> 815c815<br>
> < msg = encode_result(state);<br>
> ---<br>
>> msg = encode_result(state, SQL_SUCCESS);<br>
> 980c980<br>
> < static db_result_msg encode_result(db_state *state)<br>
> ---<br>
>> static db_result_msg encode_result(db_state *state, SQLRETURN sql_result)<br>
> 993c993,998<br>
> < DO_EXIT(EXIT_COLS);<br>
> ---<br>
>> if(SQL_NO_DATA_FOUND == sql_result) {<br>
>> num_of_columns = 0;<br>
>> }<br>
>> else {<br>
>> DO_EXIT(EXIT_COLS);<br>
>> }<br>
> 1007c1012,1017<br>
> < DO_EXIT(EXIT_ROWS);<br>
> ---<br>
>> if(SQL_NO_DATA_FOUND == sql_result) {<br>
>> RowCountPtr = 0;<br>
>> }<br>
>> else {<br>
>> DO_EXIT(EXIT_ROWS);<br>
>> }<br>
> ================= patch file end ======================<br>
><br>
><br>
> =============== my environment ========================<br>
> $ erl<br>
> Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-<br>
> threads:0] [kernel-poll:false]<br>
><br>
> Eshell V5.7.4 (abort with ^G)<br>
><br>
><br>
> $ uname -ap<br>
> Darwin tanmac.local 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov 3<br>
> 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386 i386<br>
> =======================================<br>
><br>
><br>
</div></div>> ________________________________________________________________<br>
> erlang-questions mailing list. See <a href="http://www.erlang.org/faq.html" target="_blank">http://www.erlang.org/faq.html</a><br>
> erlang-questions (at) <a href="http://erlang.org" target="_blank">erlang.org</a><br>
><br>
><br>
</blockquote></div><br>