def connect_db(self):
if os.path.exists(self.appSettings['basename']):
if 'con' in dir(self):
self.con.close()
self.con = sqlite.connect(self.appSettings['basename'])
else:
if os.path.exists(os.path.abspath(os.curdir) + '/myBase.db'):
createIt = False
else:
createIt = True
self.appSettings['basename'] = 'myBase.db'
self.con = sqlite.connect(self.appSettings['basename'])
if createIt:
with self.con:
cur = self.con.cursor()
#cur.execute("DROP TABLE IF EXISTS Items")
cur.execute("CREATE TABLE shabl ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, keyword TEXT, code TEXT, datechange DATE)")
#cur.execute("CREATE TABLE Items(Id INTEGER PRIMARY KEY, Name TEXT, Price INT)")
评论列表
文章目录