From aff0518e5ced9bd97041a7a7c59e535df2160af5 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Tue, 23 Jun 2009 09:29:33 +1200 Subject: [PATCH] Resolve MySQLisms. --- services/command/feedparse.py | 6 +++--- services/master/refreshmanager.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/services/command/feedparse.py b/services/command/feedparse.py index db31986..ad35ffc 100644 --- a/services/command/feedparse.py +++ b/services/command/feedparse.py @@ -54,7 +54,7 @@ class FeedRefreshSetup(BaseCommand): SELECT site_id FROM site_refresh WHERE id = %s """ - d = self.dcm.runQuery(q, id) + d = self.dcm.runQuery(q, [ id ]) d.addCallback(self.gotNewSite) d.addErrback(self.error) @@ -71,7 +71,7 @@ class FeedRefreshSetup(BaseCommand): SELECT feed, url, etag, last_modified, entity_url FROM site WHERE id = %s """ - d = self.dcm.runQuery(q, site_id) + d = self.dcm.runQuery(q, [ site_id ]) d.addCallback(self.gotFeed) d.addErrback(self.error) @@ -478,7 +478,7 @@ class FeedUpdateDatabaseCommand(BaseCommand): UPDATE site_history set title = %s, link = %s, touched = %s, published = %s, updated = %s, summary = %s, content = %s, display_cache = %s WHERE id = %s """ - return self.dcm.runQuery(q, (entry["title"], entry["link"], datetime.utcnow(), published, updated, + return self.dcm.runInteraction(self.newInteraction, q, (entry["title"], entry["link"], datetime.utcnow(), published, updated, entry["summary"], self.getBestContent(entry), entry["display_cache"], id)) diff --git a/services/master/refreshmanager.py b/services/master/refreshmanager.py index cb4ce0e..9c80fec 100644 --- a/services/master/refreshmanager.py +++ b/services/master/refreshmanager.py @@ -73,7 +73,7 @@ class RefreshManager: q = """ SELECT id, url, last_poll from site where is_removed is null and id > %s """ - d = self.master.database_manager.runQuery(q, [ self.site_check_last_id ]) + d = self.master.database_manager.runInteraction(q, [ self.site_check_last_id ]) d.addCallback(self.gotNewSites) d.addErrback(self.newSitesError) @@ -128,14 +128,13 @@ class RefreshManager: def scheduleRefresh(self, site): print("schedule refresh for site %d: %s" % (site.id, site.url)) q = """ - INSERT INTO site_refresh values (NULL, %s, "new", NULL) + INSERT INTO site_refresh (site_id, status) values (%s, 'new') """ d = self.master.database_manager.runQuery(self.newInteraction, q, [ site.id ]) d.addErrback(self.error) def newInteraction(self, trans, *args): trans.execute(*args) - return true def error(self, failure): print("error: %s" % failure.getErrorMessage()) -- 2.30.2