Namespace LocalDB
Defined in: db.js.
Constructor Attributes | Constructor Name and Description |
---|---|
contains reference to local database and handle its functionalities
|
Field Attributes | Field Name and Description |
---|---|
<static> |
LocalDB.connection
|
<static> |
LocalDB.max_db_size
max database size
|
Method Attributes | Method Name and Description |
---|---|
<static> |
LocalDB.connect()
connect to local database named main with max size = 100 GB.
|
<static> |
LocalDB.init(tx)
initiate the tables of the database.
|
<static> |
LocalDB.onError(e)
called in case of error in connecting with local database.
|
<static> |
LocalDB.onReady()
if database is ready to connect to server begin synchronization using RemoteDB.sync.
|
Field Detail
<static>
LocalDB.connection
<static>
LocalDB.max_db_size
max database size
Method Detail
<static>
LocalDB.connect()
connect to local database named main with max size = 100 GB.
Description
if it is found just open it, else create it.
then begin initiation of database by calling LocalDB.init. if the initiation has been done successfuly call LocalDB.onReady, else call LocalDB.onError
Description
if it is found just open it, else create it.
then begin initiation of database by calling LocalDB.init. if the initiation has been done successfuly call LocalDB.onReady, else call LocalDB.onError
<static>
LocalDB.init(tx)
initiate the tables of the database.
Description
create table myProducts if not exits using the following query
create table if not exists myProduct(id INTEGER PRIMARY KEY,name,price)
Description
create table myProducts if not exits using the following query
create table if not exists myProduct(id INTEGER PRIMARY KEY,name,price)
- Parameters:
- {Object} tx
- transaction manager that used to execute the SQL statement
<static>
LocalDB.onError(e)
called in case of error in connecting with local database.
Description
printing the error code and the type of it
Description
printing the error code and the type of it
- Parameters:
- {Object} e
- error code and type
<static>
LocalDB.onReady()
if database is ready to connect to server begin synchronization using RemoteDB.sync.
Description
make many checks to begin synchronization such as:
1. checking network state
2. checking connection state
if the connection failed only display the offers calling Device.display
Description
make many checks to begin synchronization such as:
1. checking network state
2. checking connection state
if the connection failed only display the offers calling Device.display