Commit c68afc55 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos/collect: Method for test if table exists

parent b02471cd
......@@ -167,6 +167,15 @@ class Database:
def _getInsertionDateTuple(self):
return strftime("%Y-%m-d -- %H:%M:%S").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