mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Move dict_factory out of database class.
This commit is contained in:
parent
a5bd7e6563
commit
37b92f3d88
1 changed files with 8 additions and 8 deletions
|
@ -46,6 +46,13 @@ def get_cache_size():
|
||||||
return 0
|
return 0
|
||||||
return int(plexpy.CONFIG.CACHE_SIZEMB)
|
return int(plexpy.CONFIG.CACHE_SIZEMB)
|
||||||
|
|
||||||
|
def dict_factory(cursor, row):
|
||||||
|
d = {}
|
||||||
|
for idx, col in enumerate(cursor.description):
|
||||||
|
d[col[0]] = row[idx]
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
class MonitorDatabase(object):
|
class MonitorDatabase(object):
|
||||||
|
|
||||||
|
@ -58,14 +65,7 @@ class MonitorDatabase(object):
|
||||||
self.connection.execute("PRAGMA journal_mode = %s" % plexpy.CONFIG.JOURNAL_MODE)
|
self.connection.execute("PRAGMA journal_mode = %s" % plexpy.CONFIG.JOURNAL_MODE)
|
||||||
# 64mb of cache memory, probably need to make it user configurable
|
# 64mb of cache memory, probably need to make it user configurable
|
||||||
self.connection.execute("PRAGMA cache_size=-%s" % (get_cache_size() * 1024))
|
self.connection.execute("PRAGMA cache_size=-%s" % (get_cache_size() * 1024))
|
||||||
self.connection.row_factory = self.dict_factory
|
self.connection.row_factory = dict_factory
|
||||||
|
|
||||||
def dict_factory(self, cursor, row):
|
|
||||||
d = {}
|
|
||||||
for idx, col in enumerate(cursor.description):
|
|
||||||
d[col[0]] = row[idx]
|
|
||||||
|
|
||||||
return d
|
|
||||||
|
|
||||||
def action(self, query, args=None, return_last_id=False):
|
def action(self, query, args=None, return_last_id=False):
|
||||||
if query is None:
|
if query is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue