Well, the write was an example. So, a lock_schema wouldn't do the
....
re-prepare, in some cases reparse, the other threaded transactions.
I don't quite follow how exactly this is supposed to help. Are you
saying that there should be some kind of a lock from the moment the
statement is prepared to the moment it is finalized, and no schema
change should occur while this lock is held?
Not exactly, to allow a statement change the schema, it must have
exclusive access to the schema. Not all statements change the schema.
I don't think this would be desirable - I beleve many applications
now prepare certain often-used queries up front when the database
handle is opened, and keep prepared statements around until it's
time to close the database. Think of them as poor man's stored procedures.
But this pre-prepared statements are also affected by the schema
change, no? I don't use pre-prepared statements and didn't thought about them.
You seem to think that the problem occurs when schema changes right
in the middle of sqlite3_prepare call. This is not the case. The
problem is that a prepared statement may sit around for a long time
before it is actually used in a sqlite3_step call. At this point the
engine may find out that the schema now differs from what it was
when the statement was prepared, so the internal data structures are
no longer valid. How do you propose to handle this situation, other
than re-prepare? Would you prefer disabling any and all schema
modifications for as long as there exists a single prepared statement?
Instead of re-prepare the affected transaction/s, don't allow any
transaction prepare if other is changing the schema. Perhaps my idea
is a bit distorsionated by the use i do of sqlite and don't have a
general point of view.
Must add that doing this way you don't need to modify the API.
Must add that doing it the way Dr. Hipp proposed doesn't modify the
API either. It simply makes one error code obsolete - the engine
never reports it where it could be reported before. Fully backward compatible.
Oppsss.... i was thinking about the SQLITE_ERROR in sqlite3_step change. Sorry.
**************************************************************************************************************************************************
This document represent my ideas. They are original from me. It's
forbidden think the same than me, without previous payment.
If you agree me, PAY. If you don't do so and divulge my ideas in any
media, i'll send you my lawyers... sit lawyer SIT!!