db icon indicating copy to clipboard operation
db copied to clipboard

Lazy parsing for `array`, `structured` and `json` types

Open Tigrov opened this issue 1 year ago • 3 comments

Suggested to store in ArrayExpression, StructuredExpression and JsonExpression the string value retrieved from the database and convert it to an array or other PHP representation as the data is accessed.

This will save resources if the data is not used during execution.

Can be optionally.

Tigrov avatar Oct 19 '24 12:10 Tigrov

Sounds good from a performance perspective. The only thing is that checks such as is_array would become instanceof ArrayResult or something alike.

samdark avatar Oct 20 '24 11:10 samdark

Actually I think about ArrayExpression which already realizes ArrayAccess, Countable and IteratorAggregate interfaces and the check should be is_iterable().

Tigrov avatar Oct 20 '24 15:10 Tigrov

Expression is logically an input. Not sure it is a good idea to reuse for results.

samdark avatar Oct 21 '24 14:10 samdark