My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

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 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 as3corelib - Derek Wischusen's as3yaml decoder that can be found at as3yaml

View the docs

Please submit any bugs that you find to the issues list on the google project site

Check out a working 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);
 

Powered by Google Project Hosting