← Back to team overview

zeitgeist team mailing list archive

[Bug 783688] [NEW] make sql connection more modular

 

Public bug reported:

In order to make handling cursors / connections in sql.py, we should
create a function _connect_to_db which does exactly that.

19:34 <thekorn> I think we should make these lines a new method, like connect_to_database:
19:34 <thekorn> Iconn = sqlite3.connect(file_path)
19:34 <thekorn> Iconn.row_factory = sqlite3.Row
19:34 <thekorn> Icursor = conn.cursor(UnicodeCursor)
19:34 <thekorn> in sql.py that is
19:35 <jplacerda> thekorn I agree
19:35 <thekorn> and call it in create_db and in the restore code
19:35 <jplacerda> I ran into a similar problem (while working on a fix for sqlite memory) because I couldn't easily manipulate cursors / connection
19:35 <jplacerda> Seems *very* sane to me

** Affects: zeitgeist
     Importance: Undecided
         Status: New

** Branch linked: lp:~jplacerda/zeitgeist/660307

-- 
You received this bug notification because you are a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Framework.
https://bugs.launchpad.net/bugs/783688

Title:
  make sql connection more modular

Status in Zeitgeist Framework:
  New

Bug description:
  In order to make handling cursors / connections in sql.py, we should
  create a function _connect_to_db which does exactly that.

  19:34 <thekorn> I think we should make these lines a new method, like connect_to_database:
  19:34 <thekorn> Iconn = sqlite3.connect(file_path)
  19:34 <thekorn> Iconn.row_factory = sqlite3.Row
  19:34 <thekorn> Icursor = conn.cursor(UnicodeCursor)
  19:34 <thekorn> in sql.py that is
  19:35 <jplacerda> thekorn I agree
  19:35 <thekorn> and call it in create_db and in the restore code
  19:35 <jplacerda> I ran into a similar problem (while working on a fix for sqlite memory) because I couldn't easily manipulate cursors / connection
  19:35 <jplacerda> Seems *very* sane to me


Follow ups

References