Reputation: 1921
I need to store datas like DBs does on client-side in JS,
db.insert(unique_key,{
a : 20,
b : 30
}) ;
db.select('a>10') ;
This is just illustrative syntax to show,
How can I procces datas more than key/value pair do.
Any acknowledge would be great,
Thank you!
Upvotes: 0
Views: 65
Reputation: 30993
You can use JavaScript object literal notation to store data and a javascript linq library (ex. jslinq) to query them. If you can use jQuery, data operation are simple see: Adding/removing items from JSON data with JQuery
Example from codeplex jslinq:
var myList = [
{FirstName:"Chris",LastName:"Pearson"},
{FirstName:"Kate",LastName:"Johnson"},
{FirstName:"Josh",LastName:"Sutherland"},
{FirstName:"John",LastName:"Ronald"},
{FirstName:"Steve",LastName:"Pinkerton"}
];
var exampleArray = JSLINQ(myList)
.Where(function(item){ return item.FirstName == "Chris"; })
.OrderBy(function(item) { return item.FirstName; })
.Select(function(item){ return item.FirstName; });
Upvotes: 1
Reputation: 66663
Lookup HTML5 SQLite: http://cookbooks.adobe.com/post_Store_data_in_the_HTML5_SQLite_database-19115.html which allows you to store data in more complex structured than a key-value pair.
Upvotes: 1