[fpc-pascal] TSQLQuery and buffering.

Gary Doades gpd at gpdnet.co.uk
Mon Mar 27 13:20:06 CEST 2017

On Mon, 27 Mar 2017, Gary Doades wrote:

>> The problem therefore lies in either the Pascal layer on top of the native client libs or in the way the client libs themselves work :( I suspect the latter.

> As far as I know, the DB-Specific pascal layer does not buffer anything, it just fetches the result.
> There is of course little to no control over how the client lib fetches the result.

> If memory serves well, mySQL has 2 separate calls: mysql_use_result and mysql_store_result where the difference is exactly how it fetches the result set.

> Please report your findings, if any :)

Yeah, exactly right. The Pascal code in mysqlconn.inc calls mysql_store_result which does indeed fetch the entire result set into memory. It could be changed (perhaps) to use mysql_use_result instead which does row-at-a-time streaming, but I'm not sure I have the expertise to make that change or what any other implications of that change might be.

I may hack it for my own purposes in the short term to see what happens!


More information about the fpc-pascal mailing list