www

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

commit 42578ace5970b6d911a1e6ad5541eb8c318ad84e
parent 6f19b215f51e6cc52d1b099cf66c02284b90d59c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 23 Jun 2006 22:00:39 +0000

Fixes #61, creator caching sometimes malfunctions


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 27++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -467,12 +467,8 @@ Scholar.Item.prototype.save = function(){ } } - // Append the SQL to delete obsolete creators - // - // TODO: fix this so it actually purges the internal memory - if (sql = Scholar.Creators.purge(true)){ - Scholar.DB.query(sql); - } + // Delete obsolete creators + Scholar.Creators.purge(); } @@ -1680,22 +1676,15 @@ Scholar.Creators = new function(){ /* * Delete obsolete creators from database and clear internal array entries * - * Returns TRUE on success, or SQL query to run in returnSQL mode + * Returns removed creatorIDs on success */ - function purge(returnSQL){ + function purge(){ var sql = 'SELECT creatorID FROM creators WHERE creatorID NOT IN ' + '(SELECT creatorID FROM itemCreators);'; var toDelete = Scholar.DB.columnQuery(sql); if (!toDelete){ - return returnSQL ? '' : false; - } - - sql = 'DELETE FROM creators WHERE creatorID NOT IN ' - + '(SELECT creatorID FROM itemCreators);'; - - if (!returnSQL){ - var result = Scholar.DB.query(sql); + return false; } // Clear creator entries in internal array @@ -1705,7 +1694,11 @@ Scholar.Creators = new function(){ delete _creatorsByID[toDelete[i]]; } - return returnSQL ? sql : result; + sql = 'DELETE FROM creators WHERE creatorID NOT IN ' + + '(SELECT creatorID FROM itemCreators);'; + var result = Scholar.DB.query(sql); + + return toDelete; }