Bug #32420 Don't cache results and SQLExtendedFetch work badly together
Submitted: 15 Nov 2007 20:12 Modified: 14 Mar 2008 19:42
Reporter: Bogdan Degtyariov
Status: Closed
Category:Connector/ODBC Severity:S2 (Serious)
Version:3.51.21 OS:Microsoft Windows
Assigned to: Bugs System Target Version:3.51
Tags: SQL_ROWSET_SIZE, SQLExtendedFetch, MSSQL
Triage: D2 (Serious)

[15 Nov 2007 20: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 11:12] Susanne Ebrecht
Many thanks for writing a bug report.
[16 Nov 2007 13:29] Bogdan Degtyariov
Sorry, I should have noted that the expected result is more than one record in the result
buffer.
[25 Dec 2007 13:55] Bogdan Degtyariov
Test case

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

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

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

[26 Dec 2007 22:39] Jim Winstead
patch looks good, but needs space in "if(!value)" and need to remove added trailing
spaces.
[26 Dec 2007 23:24] Lawrin Novitsky
patch is approved
[31 Dec 2007 14: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.
[3 Jan 2008 0:17] Jim Winstead
The fix for this bug was not correct, and has been reverted.
[24 Feb 2008 0:02] Jess Balint
fix + test

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

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

my applauses! excellent :)
[1 Mar 2008 20:55] Jess Balint
Committed as rev1053. Will be released in 3.51.24.
[14 Mar 2008 19: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