Hi,
I want to convert anOrderedCollection with things to a ByteArray to get it into Glrop:
I have been trying things like
self task_res_selections: ((BinaryObjectStorage onNew: 'Resources' asByteArray readWriteStream) nextPut: (OrderedCollection with: aResourceKeyColl); close)
To get things back I do:
| boss storeCollection | boss := self task_res_selections. boss isNil ifTrue: [^nil] ifFalse: [boss reset. storeCollection := boss next.
^storeCollection first]
This does not give an error but doesn't really write to the database as Glorp needs a real ByteArray to do do. Can someone indicate how to convert back and forth from an ByteArray.
Thanks,
@+Maarten,
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
HiTom,
Yes I do !
> "Tom Robinson" <[hidden email]> |
-- _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Maarten,
If you look at class Store.Glorp.StoreBlob, you will find how Store does this. The method StoreBlob class>>#forObject: basically does what you're looking for. For an example of creating an instance, look at StoreProperty>>#named:forObject:in:. I haven't looked at what you have to do with just Glorp lately, but let me know if examination of these pieces (and possibly the StoreDescriptorSystem hierarchy) raises more questions... Tom On 8/16/13 8:04 AM, [hidden email] wrote:
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi Tom,
This does the job, where aResourceKeyColl can probably whatever object lessthen 32k, thanks
task_res_selections: aResourceKeyColl "task_res_selections <> BinaryObjectStorage" | myByteArray | myByteArray := #Resources asByteArray. (BinaryObjectStorage onNew: myByteArray readWriteStream) nextPut: (OrderedCollection with: aResourceKeyColl); close. self task_res_selections_bits: myByteArray
task_res_selections "task_res_selections <> BinaryObjectStorage"
| boss | boss := self task_res_selections_bits. boss isNil ifTrue: [^OrderedCollection new] ifFalse: [^(BinaryObjectStorage onOldNoScan: boss readStream) next first]
> "Tom Robinson" <[hidden email]> | Maarten,
If you look at class Store.Glorp.StoreBlob, you will find how Store does this. The method StoreBlob class>>#forObject: basically does what you're looking for. For an example of creating an instance, look at StoreProperty>>#named:forObject:in:. I haven't looked at what you have to do with just Glorp lately, but let me know if examination of these pieces (and possibly the StoreDescriptorSystem hierarchy) raises more questions... Tom On 8/16/13 8:04 AM, [hidden email] wrote:
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |