www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit dc4f2762977e3b3799cd684fa6220ae1710dcf36
parent 749ef47bbd0dc31041b1e0b9858bea21117c7ea3
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 18 Mar 2006 23:46:50 +0000

Scholar_Object._loadObjectData() and _loadCreators() weren't setting the _objectDataLoaded and _creatorsLoaded flags if there were no rows, causing incessant trips to the DB


Diffstat:
Mchrome/chromeFiles/content/scholar/data_access.js | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/data_access.js b/chrome/chromeFiles/content/scholar/data_access.js @@ -219,6 +219,7 @@ Scholar_Object.prototype.removeCreator = function(orderIndex){ * Field can be passed as fieldID or fieldName */ Scholar_Object.prototype.getField = function(field){ + //Scholar.debug('Requesting field ' + field + ' for object ' + this.getID(), 4); if (this.isPrimaryField(field)){ return this._data[field] ? this._data[field] : ''; } @@ -646,6 +647,8 @@ Scholar_Object.prototype._loadCreators = function(){ + 'WHERE objectID=' + this.getID() + ' ORDER BY orderIndex'; var creators = Scholar_DB.query(sql); + this._creatorsLoaded = true; + if (!creators){ return true; } @@ -659,7 +662,6 @@ Scholar_Object.prototype._loadCreators = function(){ this._creators.set(creators[i]['orderIndex'], creator); } - this._creatorsLoaded = true; return true; } @@ -679,11 +681,12 @@ Scholar_Object.prototype._loadObjectData = function(){ var result = Scholar_DB.query(sql,[{'int':this._data['objectID']}]); + this._objectDataLoaded = true; + if (result){ for (var i=0,len=result.length; i<len; i++){ this.setField(result[i]['fieldID'], result[i]['value'], true); } - this._objectDataLoaded = true; return true; } else {