Webbase.js
01 Jul 2012
Webbase.js is a data manager library for javascript web applications, which provide the concept of creating tables in the storage method (localStorage) provided by the browser. its just like mimicing the database to the browser. Basic operations that webbase support are " insert, delete, update, select, select..where and join."
Create Table
// Webbase.Storage.create(table_name, structure, primary_key);
Webbase.Storage.create('student',{
id : 'number',
name : 'string',
marks : 'number'
},'id');
Insert Record
// Webbase.Storage.insert(table_name, data);
Webbase.Storage.insert('student',{
id : 5225,
name : "Jaison Justus",
marks : 53
});
Delete Record
// Webbase.Storage.from(table_name).where(condition).delete();
Webbase.Storage.from('student')
.where('{id} == 5225')
.delete();
Update Record
/*
* Webbase.Storage.from(table_name)
* .set(data)
* .where(condition).update();
*/
Webbase.Storage.from('student')
.set({ marks : 69 })
.where('{id} == 5225 || {id} == 5222')
.update();
Select Record
/*
* Webbase.Storage.select(fields)
* .from(table_name)
* .where(condition).find();
*/
Webbase.Storage.select('name,marks')
.from('student')
.where('{id} == 5222')
.find();
Select Record by Joining Multiple Table
/*
* Webbase.Storage.select(fields[student_fieldname])
* .join(tables)
* .where(condition).find();
*/
Webbase.Storage.select('student_name,student_marks,score_english')
.join('student.score')
.where('{id} == 5222')
.find();
jaisonjustus/Webbase.js
A Javascript Storage Library implemented using localstorage.