There was a conversation on Skype CW-Talk about a loop to copy one table to another, where the tables included a blob.
It was pointed out that StringTheory has code that does this fairly cleanly
However that approach has the extra overhead of copying the entire blob to an intermediate string
ST StringTheory
CODE
ST.FromBlob( MyFile.MyBlob )
ST.ToBlob( OtherFile.MyBlob )
So I wrote the following BlobToBlob code with @Bruce Johnsons help
BlobToBlob PROCEDURE(*BLOB xTo, *BLOB xFrom)
FromSize ULONG,AUTO
CODE
FromSize = xFrom{PROP:Size}
xTo{PROP:Size} = 0 ! Important, even when later setting to FromSize
IF FromSize > 0
xTo{PROP:Size} = FromSize
xTo[ 0 : FromSize - 1] = xFrom[ 0 : FromSize - 1 ]
END
In my opinion it would be nice to see this added to SV’s Libsrc\Win\CWUtil.clw
where FileToBlob and BlobToFile appear
Regarding the “extra” xTo{PROP:Size} = 0
I asked @Bruce what happens if this is skipped, His response was:
In MSSQL for example, the later assignment will fail, or “explode” to 64K.
Let’s just say “not good things”.
The Clarion docs make it explicit that it must be set to 0, but it’s not intuitive.