4d / SQLlib_4D

SQL library for 4D
http://4d.github.io/SQLlib_4D
12 stars 7 forks source link

Paging doesn't work with V14 #1

Open ibrewster opened 9 years ago

ibrewster commented 9 years ago

When retrieving a result set with more than 100 results from 4DV14 using this library, paging doesn't work. The first 100 results come in properly, and the server replies with an OK header when requesting the second page, but scrolling through the second page just produces NULL fields. On request for a third page, the server returns a non-ok response.

All testing was done in pure C, against a 4DV14R3 server, using the fourd_exec_statement() function to run the query.

ibrewster commented 9 years ago

The problem with paging appears to be limited to FOURD_RESULT objects with the updateability flag set to zero. When attempting to get the next page, a new FOURD_RESULT object is created, and this flag gets initialized to 1. Since the server is not sending that information on a request for additional pages, it never gets set back to 0, causing issues when trying to read the data stream (it is expecting additional fields it never gets). On result sets where this flag is set to 1, paging works properly.

The solution is simple: when the "new" FOURD_RESULT object is created, the value of the updateability should be initialized to be the same as the old FOURD_RESULT object, and the line that initializes it to 1 should be removed.