use("CoreDB"); function my_callback(hash) { console_log("notice", "name=[" + hash["name"] + "] age=[" + hash["age"] + "]\n"); } var db = new CoreDB("js"); var sql; var people = new Array(); people["authur"] = 30; people["ford"] = 42; people["trillian"] = 29; people["zaphod"] = 304; people["marvin"] = 1000001; db.exec("create table demo (name varchar(255), age varchar(80));"); for (var i in people) { sql = "insert into demo values('" + i + "', " + people[i] + ");"; db.exec(sql); } sql = "select * from demo;"; var line = "==============================\n"; console_log("notice", "CallBack Style:\n"); console_log("notice", line); db.exec(sql, "my_callback"); console_log("notice", line); console_log("notice", "Straight Style:\n"); console_log("notice", line); db.prepare(sql); while(db.next()) { hash = db.fetch(); console_log("notice", "name=[" + hash["name"] + "] age=[" + hash["age"] + "]\n"); } console_log("notice", line); db.exec("drop table demo");