From dc4f2762977e3b3799cd684fa6220ae1710dcf36 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 18 Mar 2006 23:46:50 +0000 Subject: [PATCH] Scholar_Object._loadObjectData() and _loadCreators() weren't setting the _objectDataLoaded and _creatorsLoaded flags if there were no rows, causing incessant trips to the DB --- chrome/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 index 34701a015..1f3f20933 100644 --- 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