Commit d85c95ca authored by Rafael Monnerat's avatar Rafael Monnerat

slapos/collect: Method for test if table exists

parent 0bfbaeed
......@@ -168,6 +168,15 @@ class Database:
def _getInsertionDateTuple(self):
return strftime("%Y-%m-d -- %H:%M:%S", gmtime()).split(" -- ")
def has_table(self, name):
self.connect()
check_result_cursor = self.select(
table="sqlite_master",
columns='name',
where="type='table' AND name='%s'" % name)
r = check_result_cursor.fetchone()
return r and r[0] is not None
###################
# Insertion methods
###################
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment