Without offering a solution to develop this magic data type that Julius suggested
You should also define what datatype you plan to present for the SQL side.
And that is always taken from the Compiled Property definition.
All streams typically present themselves a CLOB or BLOB or similar and have no MAXsize
While a String presents itself as a VARCHAR with a MAXSIZE.
I see no way to manipulate this on the fly.
For object access, you may write a Setter and Getter that covers the real nature of your data:
For SQL access I see no chance at the moment.
Indexing is another issue. This would require another piece of magic.
have a %String
have a %Stream
and have a calculated property of %String to decide which one to present.
like a centipede with a wooden leg: 99 times tic and 1 toc
the stream is then truncated and still requires extra coding.