Ernesto Revilla
2004-02-25 21:58:09 UTC
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==2:
raise
with best regards, Erny
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==2:
raise
with best regards, Erny