Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-02-22 21:08:34 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-02-22 21:08:34 (GMT)
commitc076bb811b6b64bcdd890b6adb0ae54438ab208f (patch)
tree7bc4f558639a5990133fcf1956ec020c5384337c
parent14ef8b32f2a492e831df4d5915a99284ba5b26ce (diff)
Cleanup the sqlite3 code a bit
-rw-r--r--readdb.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/readdb.py b/readdb.py
index 0ad6eb5..216429c 100644
--- a/readdb.py
+++ b/readdb.py
@@ -13,7 +13,6 @@ class BookmarkManager:
def __init__(self, filehash, dbpath='read.db'):
self._filehash = filehash
self._conn = sqlite3.connect(dbpath)
- self._cur = self._conn.cursor()
self._bookmarks = []
self._populate_bookmarks()
@@ -27,7 +26,7 @@ class BookmarkManager:
color = client.get_string("/desktop/sugar/user/color")
t = (self._filehash, page, title, timestamp, user, color, local)
- self._cur.execute('insert into bookmarks values (?, ?, ?, ?, ?, ?, ?)', t)
+ self._conn.execute('insert into bookmarks values (?, ?, ?, ?, ?, ?, ?)', t)
self._conn.commit()
self._resync_bookmark_cache()
@@ -39,16 +38,16 @@ class BookmarkManager:
# We delete only the locally made bookmark
t = (self._filehash, page, user)
- self._cur.execute('delete from bookmarks where md5=? and page=? and user=?', t)
+ self._conn.execute('delete from bookmarks where md5=? and page=? and user=?', t)
self._conn.commit()
self._resync_bookmark_cache()
def _populate_bookmarks(self):
# TODO: Figure out if caching the entire set of bookmarks is a good idea or not
- self._cur.execute('select * from bookmarks where md5=? order by page', (self._filehash,))
+ rows = self._conn.execute('select * from bookmarks where md5=? order by page', (self._filehash,))
- for row in self._cur:
+ for row in rows:
self._bookmarks.append(Bookmark(row))
def get_bookmarks_for_page(self, page):