bzoo


Opensource data layer for flash

Bzoo is an AS3 database for flash.

The library provides a thin data layer for flash/flex applications or websites, allowing data manipulation and persistence . It is an indirect AS3 translation of the javascript library http://taffydb.com'>Taffy DB

Bzoo works like a temp or persistent database for flash, implementing the CRUD interface: * Create * Read * Update * Delete

Bzoo takes amf array collections, JSON strings and YAML strings. JSON and YAML will be automatically parsed and made available.

By using the persistent attribute, Bzoo will allow data to be retained in Shared Objects for automatic retrieval after refresh, in other words bzoo allows you to store your data on the client machine.

Bzoo makes the use of: - JSON decoder classes from the http://code.google.com/p/as3corelib/'>as3corelib - http://flexonrails.net/?cat=35'>Derek Wischusen's as3yaml decoder that can be found at http://code.google.com/p/as3yaml/'>as3yaml

http://www.rtistique.com/bzoo/docs/bzoo.html'>View the docs

Please submit any bugs that you find to http://code.google.com/p/bzoo/issues/list'>the issues list on the google project site

Check out a workinghttp://rtistique.com/blog/?page_id=23'> Bzoo Example

Example: ``` import com.rtistique.bzoo.Bzoo;

var data:Array = [ {name :"Bob", gender :"M", married:"No", age :25, state :"NY", favorite_foods:["pizza","tacos"]}, {name :"Joyce", gender :"F", married:"No", age :29, state :"WA", favorite_foods:["salad","cheese sticks"]}, {name :"Dan", gender :"M", married:"No", age :29, state :"MT", favorite_foods:["pizza","hamburgers","BLTs"]}, {name :"Sarah", gender :"F", married:"No", age :21, state :"ID", favorite_foods:["pizza","sushi"]} ];

var friends:Bzoo = new Bzoo(data);

```

Find all friends that are 29 years old: ```

var result:Object = friends.find("all", { conditions :[{ field:"age", equal:"29"}]); ```

Find only the name and the state for friends that are older than 21 and sort the result by ascending "state" values: ```

var result:Object = bzoo.find("all", { fields :["name", "state"], conditions:[{ field:"age", greaterThan:"21"}], orderBy :{ field :"state", order:Bzoo.ASCENDING} } ); ```

Find the first friend that is 29 years old: ```

var result:Object = friends.find("first", { conditions:{ field:"age", equal:"29" } } ); ```

Find the number of friends that are 29 years old: ```

var result:Object = bzoo.find(Bzoo.FIND_COUNT, { conditions:{ field:"age", equal:"29" } } ); ```

Add a new friend to the list: ```

var result:Object = friends.insert( { name :"Bachir", gender :"M", married:"YES", age : 28, state :"NSW", favorite_food:["Moussaka", "Noodles"] }); ```

Update a friend's details: ```

friends.update( {conditions:{field:"name", equal:"Sarah"}}, {field:"name", equal:"Bachir"}); ```

Delete a friend from the list: ```

friends.remove({conditions:{field:"age", equal:"29"}}); ```

Delete a friend by index: ```

friends.removeByIndex(1); ```

Project Information

Labels:
bzoo as3 flash database data