[Modeling-users] leaving the database open
Status: Abandoned
Brought to you by:
sbigaret
From: Ernesto R. <er...@si...> - 2004-02-25 23:57:34
|
Hi all, strange thing (for me) that the AdaptorContext does not define a close = operation. Working with SQLite, I only see code to close the database when all = channels are closed and the = os.environ.get('MDL_TRANSIENT_DB_CONNECTION') is set (to something = different as '' and 0). The problem arose when I executed the mdl_create_DB_schema.py with = execfile from within my PyModel definition with execfile with the -R = option. The database was open (after running a schema creation). So = rerunning the script with some changes in the model, didn't drop the DB. So I have the following questions: * does loading the model open the database? * is it possible to close explicitly the database, i.e. context, so that = after the creation of the schema the database is closed? * what does the MDL_TRANSIENT_DB_CONNECTION mean: a) do not close the DB when all cursor have closed, or b) the opposite, close the DB when all channels are closed? If mdl_generate_DB_schema.py is invoked with the -R option, using = SQLiteAptor, and the file does not exist, an error is rosen. Perhaps = this could be ignored. (-R is: drop the database if it exists). This = could be done with the following code in = dropDatabaseWithAdministrativeConnectionDictionary: try: os.unlink(administrativeConnectionDictionary['database']) except OSError, exc: # ignore if file does not exist, else, reraise exception if not exc.errno=3D=3D2: raise with best regards, Erny |