knadh / localStorageDB

A simple database layer for localStorage and sessionStorage for creating structured data in the form of databases and tables
http://nadh.in/code/localstoragedb
814 stars 128 forks source link

Query Question #7

Closed danroose closed 12 years ago

danroose commented 12 years ago

Hi knadh,

I am trying to implement your localStorageDB and have created a database. When I run the following query:

db.query("senators", function(row) { // the callback function is applied to every row in the table if(row.chamber == "upper" && row.geoid10 == geo_id) { // if it returns true, the row is selected return true; } else { return false; } });

How do I retrieve the results? I can watch the query loop and it returns true on one of the records but I don't understand where the results are stored in order to display them on my page?

Should I create an array and add each record to that array each time it returns true? Or do you have a function I need to call that will display results for all rows returned the way you mention in your README File?

danroose commented 12 years ago

I wasn't storing the the value. Rookie mistake! :-)