C M
13 years ago
I'm working on a database program and have found three different kinds
of SQLite errors now and then, only 1 of which is known as to what is
causing it:
1) locked database (due to using SQLite Database Browser to change a
database but not Saving it)
2) sqlite3.OperationalError: SQL logic error or missing database
(happens very rarely. No idea why)
3) sqlite3.OperationalError: disk I/O error (also happens very rarely.
No idea why)
So, because these errors, if not handled, lock up my application, I
have to go through the entire program and find every read or write to
it and make contingencies for these--or other--errors. To assist
that, I've put all database access in a wrapper function so that all
accesses go through that function and I can catch exceptions.
However, I still have to take a lot of time to go through all the code
and make sure the code can handle whatever that wrapper returns when
there is an error. This will take a lot of time.
Therefore, to make sure I'm approaching this task right, what I'd like
to know from this list are answers to a few relevant questions...
- What might be (likely) causing errors (2) and (3)--and how could
they be prevented?
- What other common errors should I be alert for (though these are the
only ones I've ever seen)?
- I'd like to be able to potentially save a great deal of work by
testing that there is an unlocked connection to a working database as
a first step in each module *before* a lot of code runs, and if it
fails, then just stop before I have to back out of a lot of GUI code,
etc. How "risky" is that shortcut? (that is, how much chance is there
of a database error happening anyway once I've done that initial
check?)
- Any pointers to design principles for database applications (future
ones, for me) that make managing possible errors most efficient?
Thanks,
Che
of SQLite errors now and then, only 1 of which is known as to what is
causing it:
1) locked database (due to using SQLite Database Browser to change a
database but not Saving it)
2) sqlite3.OperationalError: SQL logic error or missing database
(happens very rarely. No idea why)
3) sqlite3.OperationalError: disk I/O error (also happens very rarely.
No idea why)
So, because these errors, if not handled, lock up my application, I
have to go through the entire program and find every read or write to
it and make contingencies for these--or other--errors. To assist
that, I've put all database access in a wrapper function so that all
accesses go through that function and I can catch exceptions.
However, I still have to take a lot of time to go through all the code
and make sure the code can handle whatever that wrapper returns when
there is an error. This will take a lot of time.
Therefore, to make sure I'm approaching this task right, what I'd like
to know from this list are answers to a few relevant questions...
- What might be (likely) causing errors (2) and (3)--and how could
they be prevented?
- What other common errors should I be alert for (though these are the
only ones I've ever seen)?
- I'd like to be able to potentially save a great deal of work by
testing that there is an unlocked connection to a working database as
a first step in each module *before* a lot of code runs, and if it
fails, then just stop before I have to back out of a lot of GUI code,
etc. How "risky" is that shortcut? (that is, how much chance is there
of a database error happening anyway once I've done that initial
check?)
- Any pointers to design principles for database applications (future
ones, for me) that make managing possible errors most efficient?
Thanks,
Che