Used to store large (>32k) amounts of data:
- binary
- character
Hence, streams are supersized binary (%Binary) or character (%String) types. The difference with other databases systems is that streams in Cache can be stored in external files or database global variables.
The following code:
Class CM.Patient Extends %Persistent
{
Property PatientName As %String;
Property PatientData As %FileCharacterStream(LOCATION = "D:/");
}
Executed in Terminal:
> DO %^CD
> S p = ##class(CM.Patient).%New()
> DO p.PatientData.Write("Test")
Will create a temporary file on drive D: where the "Test" string will be written to; when the Terminal session ends, the file will be deleted as the object is garbage-collected. In the order for the stream to persist, you have to %Save() the object.
SQL Server just recently started offering FILESTREAMs.