Namespace RemoteDB
Defined in: db.js.
Constructor Attributes | Constructor Name and Description |
---|---|
contains reference to remote database and handle its functionalities
|
Field Attributes | Field Name and Description |
---|---|
<static> |
RemoteDB.md5
conatins the previous md5 that determine the state of database
if it is changed or not
|
<static> |
RemoteDB.md5_tick_interval
the interval to check for md5
|
<static> |
RemoteDB.url
server URL 196.218.156.154:8880
|
Method Attributes | Method Name and Description |
---|---|
<static> |
RemoteDB.checkForChanges(records)
connect to remote server and get the changes of updates and inserts.
|
<static> |
RemoteDB.checkForDeletionChanges(records)
connect to remote server and get the changes of deletes.
|
<static> |
RemoteDB.checkMD5()
check md5
if md5 changed connect with local database.
|
<static> |
RemoteDB.sync()
begin synchronization.
|
Field Detail
<static>
RemoteDB.md5
conatins the previous md5 that determine the state of database
if it is changed or not
<static>
RemoteDB.md5_tick_interval
the interval to check for md5
<static>
RemoteDB.url
server URL 196.218.156.154:8880
Method Detail
<static>
RemoteDB.checkForChanges(records)
connect to remote server and get the changes of updates and inserts.
Description
connect to myProduct table on local database and get its records then compare it with records from remote database
1.update every common record
2.if record was founded on remote database and not found on local one ,so insert it in local
Description
connect to myProduct table on local database and get its records then compare it with records from remote database
1.update every common record
2.if record was founded on remote database and not found on local one ,so insert it in local
- Parameters:
- {Object} records
- the records for remote database
<static>
RemoteDB.checkForDeletionChanges(records)
connect to remote server and get the changes of deletes.
Description
connect to myProduct table on local database and get its records then compare it with records from remote database
if record was founded on local database and not found on remote one ,so delete it from local
Description
connect to myProduct table on local database and get its records then compare it with records from remote database
if record was founded on local database and not found on remote one ,so delete it from local
- Parameters:
- {Object} records
- the records for remote database
<static>
RemoteDB.checkMD5()
check md5
if md5 changed connect with local database.
Description
use get request to get md5 and compare it with the last md5
if it is changed so the database changed and needs to make updates so call LocalDB.connect.
Description
use get request to get md5 and compare it with the last md5
if it is changed so the database changed and needs to make updates so call LocalDB.connect.
<static>
RemoteDB.sync()
begin synchronization.
Description
use get request to get the records of the remote database (myProduct table) using method getProducts on backend then begin synchronization
1.call RemoteDB.checkForChanges to make insert and update operations.
2.call RemoteDB.checkForDeletionChanges to make delete operations.
then call Device.display to show the new offers
Description
use get request to get the records of the remote database (myProduct table) using method getProducts on backend then begin synchronization
1.call RemoteDB.checkForChanges to make insert and update operations.
2.call RemoteDB.checkForDeletionChanges to make delete operations.
then call Device.display to show the new offers