Share

From this page you can share TaffyDB: A Javascript database for your browser to a social bookmarking site or email a link to the page.
Social WebE-mail
Enter multiple addresses on separate lines or separate them with commas.
TaffyDB: A Javascript database for your browser
(Your Name) has forwarded a page to you from Ajaxonomy
(Your Name) thought you would like to see this page from the Ajaxonomy web site.

TaffyDB: A Javascript database for your browser

Tagged:  

Have you ever built an Ajax application that has some data that needs to be saved and queried for the current session, but not for multiple sessions. Well, instead of creating a temporary database table Ian Smith has come up with a better solution called Taffy DB.

Taffy DB is like having a SQL database in your browser! The Taffy DB is accessed through JavaScript, so it is great for Ajax applications. The library is under 10KB and plays well with other libraries like jQuery and the Yahoo! User Interface.

Below is how the library is described on the official Taffy DB Website

Taffy DB is a free and opensource JavaScript library that acts as thin data layer inside Web 2.0 and Ajax applications.

What makes it cool:

  • Under 10K!
  • Simple, JavaScript Centric Syntax
  • Fast
  • Easy to include in any web application
  • Compatible with major Ajax libraries: YUI, JQuery, Dojo, Prototype, EXT, etc
  • CRUD Interface (Create, Read, Update, Delete)
  • Sorting
  • Looping
  • Advanced Queries

Think of it as a SQL database in your web browser.

Below are some examples of how you would use the library.

Example #1:

Let's say you have a collection of products and you want to find every product that costs less $10 and is not a book. Simple, just write some JavaScript:

products.find({price:{lessthan:10}, type:{not:"Book"}});



Example #2:

Let's say you want to update every product from XZYDesign and set the status to not available:

products.update({status:"NA"},{manufacturer:"XZYDesign"});



Example #3:

Let's say you want to sort your products based on type, price ascending, and quantity ascending:

products.orderBy(["type",{"price":"asce"},{"quantity":"asce"}]);

Below are the methods that are available from the library.

  • Find Method
  • Update Method
  • Insert Method
  • Remove Method
  • OrderBy Method
  • ForEach Method
  • Get and First Methods

You can find an overview of all of these methods here.

You can read more about the library here.
You can download the library here.

You can see the library in action at Joe's Goals and Quote Wizard. I can see a lot of uses for this in some future applications. If you use this library in any of your applications I would love to hear about it (you can leave a comment about it or write a blog using your free Ajaxonomy account).