When using the old stream classes (%Library.GlobalXXXXStream) you should never set a stream property A to the oref from another stream B, as the Location value of stream B will be copied into stream A. You should use CopyFrom to avoid this Location change.
Taking @Lorenzo Scalese sample method add2(), it should be rewriiten as:
ClassMethod add2() As %Status
{
Set o = ..%New()
Set st = ##class(%GlobalBinaryStream).%New()
Do st.Write("azeruiop")
//Set o.st = st
Do o.st.CopyFrom(st)
Quit o.%Save()
}
If you use the new stream classes %Stream,GlobalXXXX, the original code from method add2() will keep the Location from stream property:
ClassMethod add2() As %Status
{
Set o = ..%New()
Set st = ##class(%Stream.GlobalBinary).%New()
Do st.Write("azeruiop")
Set o.st = st
Quit o.%Save()
}
- Log in to post comments