Fix for "Invalid integer value 'Not found' [QUERY: REPLACE INTO version VALUES ('storage_zfs', ?)]"

This commit is contained in:
Dan Stillman 2009-09-16 03:37:14 +00:00
parent e4fd15c228
commit 5be1b75b2b
2 changed files with 26 additions and 8 deletions

View file

@ -591,10 +591,15 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac
return;
}
var lastModified = req.getResponseHeader("Last-Modified");
var date = new Date(lastModified);
Zotero.debug("Last successful storage sync was " + date);
ts = Zotero.Date.toUnixTimestamp(date);
if (req.status == 200) {
var lastModified = req.getResponseHeader("Last-Modified");
var date = new Date(lastModified);
Zotero.debug("Last successful storage sync was " + date);
ts = Zotero.Date.toUnixTimestamp(date);
}
else {
ts = null;
}
}
finally {
callback(ts);

View file

@ -715,10 +715,16 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback)
return;
}
var ts = req.responseText;
var date = new Date(req.responseText * 1000);
Zotero.debug("Last successful storage sync was " + date);
self._lastSyncTime = ts;
if (req.status == 200) {
var ts = req.responseText;
var date = new Date(req.responseText * 1000);
Zotero.debug("Last successful storage sync was " + date);
self._lastSyncTime = ts;
}
else {
var ts = null;
self._lastSyncTime = null;
}
callback(ts);
});
}
@ -726,6 +732,13 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback)
Zotero.Sync.Storage.Session.ZFS.prototype.setLastSyncTime = function (callback, useLastSyncTime) {
if (useLastSyncTime) {
if (!this._lastSyncTime) {
if (callback) {
callback();
}
return;
}
var sql = "REPLACE INTO version VALUES ('storage_zfs', ?)";
Zotero.DB.query(sql, { int: this._lastSyncTime });