def insertData(self, exp_desc, cost_inc): if (self.checkTable(self.tableName) is True): self.query = """ INSERT INTO {} (EXP_DESC, COST_INC) VALUES(?, ?)""".format(self.tableName) try: self.db.execute(self.query, (exp_desc, cost_inc)) self.db.commit() except Exception as ex: em(None, ex)
def createTable(self, table_name): if (self.checkTable(table_name) is True): self.connectTable(table_name) else: self.tableName = table_name self.query = """ CREATE TABLE {}( EXP_DESC TEXT NOT NULL, COST_INC INT NOT NULL); """.format(table_name) try: self.db.execute(self.query) return True except Exception as ex: em(None, ex) return False
def createTable(self, table_name): if (self.checkTable(table_name) is True): self.connectTable(table_name) else: self.tableName = table_name self.query = """ CREATE TABLE {}( SALES_ID INT NOT NULL, ITEM_SOLD TEXT NOT NULL, TOTAL_PRICE INT NOT NULL); """.format(table_name) try: self.db.execute(self.query) return except Exception as ex: em(None, ex) return
def getTablelist(self): self.tableList = [] self.query = """ SELECT name FROM sqlite_master WHERE type ='table' AND name NOT LIKE 'sqlite_%'; """ try: self.dbCursor.execute(self.query) for data in self.dbCursor.fetchall(): self.tableList.append(data[0]) return self.tableList except Exception as ex: em(None, ex)
def createTable(self, table_name): if (self.checkTable(table_name) is True): self.connectTable(table_name) else: self.tableName = table_name self.query = """ CREATE TABLE {}( FOR_DATE CHAR(255) PRIMARY KEY NOT NULL, TOTAL_SALES INT NOT NULL, TOTAL_EXPENSE INT NOT NULL, PROFIT_PERCENT INT NOT NULL, LOSS_PERCENT INT NOT NULL) """.format(table_name) try: self.db.execute(self.query) return True except Exception as ex: em(None, ex) return False