Skip to Content.
Sympa Menu

freetds - [freetds] [ freetds-Patches-744992 ] Empty result-sets ignored in dbresults

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "SourceForge.net" <noreply AT sourceforge.net>
  • To: noreply AT sourceforge.net
  • Cc:
  • Subject: [freetds] [ freetds-Patches-744992 ] Empty result-sets ignored in dbresults
  • Date: Mon, 10 Jan 2005 01:36:32 -0800

Patches item #744992, was opened at 2003-05-28 18:18
Message generated for change (Comment added) made by freddy77
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=744992&group_id=33106

Category: db-lib
Group: None
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: Arnar Birgisson (arnar)
Assigned to: Nobody/Anonymous (nobody)
Summary: Empty result-sets ignored in dbresults

Initial Comment:
Following is a summary from a post to the mailinglist.
The post was possibly rejected due to it's size.

The following code produces different results when
linked against freetds and ms-dblib in the case of the
stored procedure returning an empty result-set.

dbrpcinit(dbproc, &quot;sp_get_athugasemdir_starfsmanns&quot;,
0);
dbrpcparam(dbproc, &quot;@kennitala&quot;, 0, SQLCHAR, 10,
10, kt);
dbrpcsend(dbproc);
dbsqlok(dbproc);

while (dbresults(dbproc) == SUCCEED) {
printf(&quot;Got resultset %d\n&quot;, ++i);
j = 0;
while (dbnextrow(dbproc) != NO_MORE_ROWS) {
printf(&quot; -&gt; line %d\n&quot;, ++j);
}
}


The tested procedure returns for result sets, with 0, 1, 2
and 1 rows, respectively. The program output when run
with ms-dblib is

Got resultset 1
Got resultset 2
-&gt; line 1
Got resultset 3
-&gt; line 1
-&gt; line 2
Got resultset 4
-&gt; line 1

but when run with freetds it yields

Got resultset 1
-&gt; line 1
Got resultset 2
-&gt; line 1
-&gt; line 2
Got resultset 3
-&gt; line 1

effectively ignoring the first resultset. Attached is a
TDSDUMP log of one execution of the program. This
shows that after the first result set's
TDS_ROWFMT_RESULT is recieved, an
TDS_CMD_DONE indicates that there are no rows in
the resultset. dbresults_r ignores the TDS_CMD_DONE
and and goes straight to fetching the next resultset.

Attached is a patch for a quick fix of this. It basically
adds a variable indicating whether
TDS_ROWFMT_RESULT has been recieved, and if so,
bails out on a TDS_CMD_DONE.

Again.. I'm not familiar enough with the rest of the code
to know if this breaks anything, or if this is the correct
way of doing things.

Arnar

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

>Comment By: Frediano Ziglio (freddy77)
Date: 2005-01-10 10:36

Message:
Logged In: YES
user_id=75766

Problem not present in CVS, improved rpc test to catch this
problem

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=744992&group_id=33106



  • [freetds] [ freetds-Patches-744992 ] Empty result-sets ignored in dbresults, SourceForge.net, 01/10/2005

Archive powered by MHonArc 2.6.24.

Top of Page