-
Notifications
You must be signed in to change notification settings - Fork 7
Persistence Management
Pamblam edited this page Dec 11, 2016
·
10 revisions
jSQL databases are stored on the user's hard drive but are loaded into memory when jSQL is loaded. For query speed, all database operations are made in memory and are not saved to the user's hard drive until jSQL.persist() is called.
Register a callback to be fired when the database has been loaded into memory and is ready to be queried.
- onLoadCallback: A function to be called when the database has been loaded.
jSQL.load(function(){
jSQL.createTable('Users', ['Name', `Age`]).ifNotExists().execute();
var allUsers = jSQL.select('*').from('Users').execute().fetchAll('ASSOC');
});
Commit any changes made to the database from memory to the user's hard drive.
jSQL.dropTable('Users');
jSQL.persist();
An object containing a jSQLTable object for each of your tables. If you have a table called myTable, it is located in jSQL.tables.myTable.
jSQLTable.namejSQLTable.columnsjSQLTable.datajSQLTable.colmapjSQLTable.renameColumnjSQLTable.addColumnjSQLTable.loadDatajSQLTable.insertRow
jSQLQuery.ifNotExistsjSQLQuery.ignorejSQLQuery.executejSQLQuery.fetchjSQLQuery.fetchAlljSQLQuery.valuesjSQLQuery.setjSQLQuery.wherejSQLQuery.fromjSQLQuery.limitjSQLQuery.orderByjSQLQuery.ascjSQLQuery.descjSQLQuery.distinct
jSQLWhereClause.wherejSQLWhereClause.equalsjSQLWhereClause.preparedLikejSQLWhereClause.doesNotEqualjSQLWhereClause.lessThanjSQLWhereClause.containsjSQLWhereClause.endsWithjSQLWhereClause.beginsWithjSQLWhereClause.andjSQLWhereClause.orjSQLWhereClause.limitjSQLWhereClause.orderByjSQLWhereClause.ascjSQLWhereClause.descjSQLWhereClause.execute