Bug #32420 Don't cache results and SQLExtendedFetch work badly together
Submitted: 15 Nov 2007 19:12 Modified: 14 Mar 2008 18:42
Reporter: Bogdan Degtyariov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.21 OS:Windows
Assigned to: Jess Balint CPU Architecture:Any
Tags: MSSQL, SQL_ROWSET_SIZE, SQLExtendedFetch

[15 Nov 2007 19:12] Bogdan Degtyariov
Description:
MSSQL Server 2000 cannot retrieve more than two records from the linked servers table in case MySQL Option "Don't cache results" is set. The bug seems to be in SQLExtendedFetch function that returns only one record into the result set disregard SQL_ROWSET_SIZE option.

How to repeat:
- Create a new DSN with "Don't cache results" option
- Create a linked server in MS SQL 2000 using the DSN from the previous step
- Open MS Query Analyzer and try to get some data using the query like follows:
    select * from openquery( MySQLLink, 'SELECT * FROM my_db.my_tab');

See two records in the result window.
The same can be repeated from any application that connects to MSSQL and refers to the linked server.
[16 Nov 2007 10:12] Susanne Ebrecht
Many thanks for writing a bug report.
[16 Nov 2007 12:29] Bogdan Degtyariov
Sorry, I should have noted that the expected result is more than one record in the result buffer.
[25 Dec 2007 12:55] Bogdan Degtyariov
Test case

Attachment: test_case32420.c (text/plain), 2.24 KiB.

[26 Dec 2007 19:55] Bogdan Degtyariov
patch with the test case

Attachment: patch32240.diff (application/octet-stream, text), 11.06 KiB.

[26 Dec 2007 21:39] Jim Winstead
patch looks good, but needs space in "if(!value)" and need to remove added trailing spaces.
[26 Dec 2007 22:24] Lawrenty Novitsky
patch is approved
[31 Dec 2007 13:48] MC Brown
A note has been added to the 3.51.23 changelog: 

SQLExtendedFetch() and SQLFetchScroll() ignored the rowset size if the Don't cache result DSN option was set.
[2 Jan 2008 23:17] Jim Winstead
The fix for this bug was not correct, and has been reverted.
[23 Feb 2008 23:02] Jess Balint
fix + test

Attachment: bug32420.diff (application/octet-stream, text), 4.42 KiB.

[25 Feb 2008 18:42] Bogdan Degtyariov
Jess,

my applauses! excellent :)
[1 Mar 2008 19:55] Jess Balint
Committed as rev1053. Will be released in 3.51.24.
[14 Mar 2008 18:42] MC Brown
A note has been added to the 3.51.24 changelog: 

SQLExtendedFetch() and SQLFetchScroll() ignored the rowset size if the Don't cache result DSN option was set