Commit 02d0043f authored by mcmlxxix's avatar mcmlxxix
Browse files

use JSONdb.remove() method instead of writing undefined when deleting a record...

use JSONdb.remove() method instead of writing undefined when deleting a record (removes records completely instead of leaving an empty property behind)
parent 41023743
......@@ -296,7 +296,7 @@ function JSONClient(serverAddr,serverPort) {
this.send({
scope:scope,
func:"QUERY",
oper:"WRITE",
oper:"DELETE",
location:location,
data:undefined,
lock:lock,
......
......@@ -498,9 +498,12 @@ function JSONdb (fileName, scope) {
/* remove a record from the database (requires WRITE_LOCK) */
this.remove = function(request,record) {
var client = request.client;
/* if the requested data does not exist, do nothing */
if(record.data === undefined)
if(record.data === undefined || !record.data.hasOwnProperty(record.property)) {
return true;
}
/* if this client has this record locked */
else if(record.shadow[record.property]._lock[client.id] &&
record.shadow[record.property]._lock[client.id].type == locks.WRITE) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment