class KuraApp(dbAppDef): """ KuraApp is a central portal to the database. It manages a repository that defines both the data model and the presentation of the data. It also manages the connection to the database. """ def __init__(self,): self.initialized = False def init(self, backend, **args): dbAppDef.__init__(self, None) setRepository(self) setObjects(self) self.settings() self.sql = globals()[backend](self, **args) self.initialized = True def isDirty(self): try: return self.sql.isDirty() except: return False def openFile(self, filename): self.sql = TextQuery(self, filename) def saveFile(self, filename = None): self.sql.saveDatabase(filename) def settings(self, **args): """ Certain fields can have default values that can be used in queries, updates and inserts. This is where those are set. """ self.fieldDefaults=args def reconnect(self, hostname, username, database, password): self.sql = dbSql(self, username = username, database = database, password = password, hostname = hostname)
def openFile(self, filename): self.sql = TextQuery(self, filename)