Forum BigDB How to save binary data in BigDB

Discussion and help relating to the PlayerIO database solution, BigDB.

How to save binary data in BigDB

Postby robertflesch » May 7th, 2013, 5:25 am

I am trying to store and retrieve some binary data from a table in the BigDB. I am not clear as how to do this.
Right now to create the object I make this call (generalized)
Code: Select all
var ba:ByteArray = new ByteArray();
SaveDataToByteArray( ba );
ba.compress();
client.BigDB.createObject( "myObjects", fileName, ba, createdHandler, errorHandler );

It successfully is created
To retrieve the data
Code: Select all
...
client.BigDB.loadObject( "myObjects", fileName, successHandler, errorHandler );
...
private function successHandler(o:DatabaseObject):void {
var objectId:String = o.key;
var ba:ByteArray = ???? // I don't see the data as part of the returned object

Do I need to add a tag to the byteArray?
Any hints would be great appreciated.
I have read thru all of the examples,
but I can't find anything that accesss binary data.
Thanks
Bob
robertflesch
Paid Member
 
Posts: 136
Joined: April 22nd, 2013, 9:18 pm

Re: How to save binary data in BigDB

Postby robertflesch » May 7th, 2013, 7:06 am

Indeed I did need a tag on the data

Code: Select all
var ba:ByteArray = new ByteArray();
SaveDataToByteArray( ba );
ba.compress();
client.BigDB.createObject( "myObjects", fileName, { data:ba }, createdHandler, errorHandler );



Code: Select all
var fileName:String = o.key;
var ba:ByteArray = o.data as ByteArray;
ba.uncompress();


Gives me access to the data!
robertflesch
Paid Member
 
Posts: 136
Joined: April 22nd, 2013, 9:18 pm


Return to BigDB



cron