def getTables(self): tbQuery = Query(self.cursor, "select name from sqlite_master where type='table'") # create array of table objects self.tables=[] rows = tbQuery.execute().getRows() for r in rows: self.tables.append(SqltTable(self._db, r)) return self.tables
def addRows(self, varnames): qry = "insert into " + self.tname + "(" i = 0 for i in range(0, len(self.colList) - 1): c = self.colList[i] qry += c.name + "," qry += self.colList[-1].name + ") values (" for i in range(0, len(self.colList) - 1): qry += "?," qry += "?);" query = Query(self.cursor, qry, varnames) print(qry + "\n", varnames) query.execute() self.db.commit()
def getColumns(self): print(self.tname) sql = "show columns from " + "".join(self.tname) tquery = Query(self.cursor, sql) self.columns = tquery.execute().getRows() return self.columns