Migrating to FireDAC: The devil is in the details
I recently discovered that some of the few queries that we have that return a large rowset, would max out at 50 rows.
It turns out that TFDQuery.FetchOptions.Mode defaults to fmOnDemand, which means that the query first returns a default of 50 rows, and then fetches 50 more as you MoveNext past the 50 first. Other options are fmAll, fmExactRecsMax, fmManual.
Since we still are in the “make it work” and not in the “make it fast” stage, I switched to using fmAll.
Interestingly, RowCount by default also returns 50 even if the query actually matches more rows. and there is a TFDQuery.FetchOptions.RecordCountMode setting that can be modified, as well: cmFetched, cmVisible, cmAll.
This differs from ADO TQuery, which will retrieve all rows and the full record count by default.
TFDDataSet has the same settings, and there are numerous other tweakable parameters that I need to explore for both of these components..
2 thoughts on “Migrating to FireDAC: The devil is in the details”
I am extremely happy that you’re doing this migration, as it means you can tell me everything we shouldn’t do in a few months’ time….
We are actually pushing to pilot testing in production next week. If it all goes horribly bad, we still can switch back to ADO at the flick of a compiler directive. The pilot should force out any possible remaining issues that we didn’t manage to discover during our test sessions.
You must log in to post a comment.