View Single Post
Old 06-17-2014, 09:30 PM   #2
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
All of mine use

Code:
with closing(sqlite.connect(self.device_database_path())) as connection:
    connection.text_factory = lambda x: unicode(x, "utf-8", "ignore")
    connection.row_factory = sqlite.Row
"self.device_database_path()" returns the full path to the database.

I don't use the row_factory everywhere. The code I was working with initially didn't and just used numeric indices into the results. I'm now using a mix depending on when I wrote the code and how many columns are in the result. If I have to take my shoes of to count, I use the names
davidfor is offline   Reply With Quote