Use shared cursor where possible
This commit is contained in:
parent
61c72ac3ea
commit
c88152cac2
1 changed files with 8 additions and 2 deletions
10
src/Db/Db.py
10
src/Db/Db.py
|
@ -181,6 +181,11 @@ class Db(object):
|
||||||
|
|
||||||
return cur
|
return cur
|
||||||
|
|
||||||
|
def getSharedCursor(self):
|
||||||
|
if not self.conn:
|
||||||
|
self.connect()
|
||||||
|
return self.cur
|
||||||
|
|
||||||
# Get the table version
|
# Get the table version
|
||||||
# Return: Table version or None if not exist
|
# Return: Table version or None if not exist
|
||||||
def getTableVersion(self, table_name):
|
def getTableVersion(self, table_name):
|
||||||
|
@ -201,7 +206,8 @@ class Db(object):
|
||||||
def checkTables(self):
|
def checkTables(self):
|
||||||
s = time.time()
|
s = time.time()
|
||||||
changed_tables = []
|
changed_tables = []
|
||||||
cur = self.getCursor()
|
|
||||||
|
cur = self.getSharedCursor()
|
||||||
|
|
||||||
# Check internal tables
|
# Check internal tables
|
||||||
# Check keyvalue table
|
# Check keyvalue table
|
||||||
|
@ -301,7 +307,7 @@ class Db(object):
|
||||||
|
|
||||||
# No cursor specificed
|
# No cursor specificed
|
||||||
if not cur:
|
if not cur:
|
||||||
cur = self.getCursor()
|
cur = self.getSharedCursor()
|
||||||
cur.logging = False
|
cur.logging = False
|
||||||
|
|
||||||
# Row for current json file if required
|
# Row for current json file if required
|
||||||
|
|
Loading…
Reference in a new issue