-
Notifications
You must be signed in to change notification settings - Fork 7
Persistence Management
Rob Parham edited this page Sep 25, 2017
·
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.commit()
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.commit();
Rollback any changes not yet committed.
jSQL.dropTable('Users');
jSQL.rollback();
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.name
jSQLTable.columns
jSQLTable.data
jSQLTable.colmap
jSQLTable.renameColumn
jSQLTable.addColumn
jSQLTable.loadData
jSQLTable.insertRow
jSQLQuery.ifNotExists
jSQLQuery.ignore
jSQLQuery.execute
jSQLQuery.fetch
jSQLQuery.fetchAll
jSQLQuery.values
jSQLQuery.set
jSQLQuery.where
jSQLQuery.from
jSQLQuery.limit
jSQLQuery.orderBy
jSQLQuery.asc
jSQLQuery.desc
jSQLQuery.distinct
jSQLWhereClause.where
jSQLWhereClause.equals
jSQLWhereClause.preparedLike
jSQLWhereClause.doesNotEqual
jSQLWhereClause.lessThan
jSQLWhereClause.contains
jSQLWhereClause.endsWith
jSQLWhereClause.beginsWith
jSQLWhereClause.and
jSQLWhereClause.or
jSQLWhereClause.limit
jSQLWhereClause.orderBy
jSQLWhereClause.asc
jSQLWhereClause.desc
jSQLWhereClause.execute