> 
> There is also a PRAGMA user_version (see 
> http://www.sqlite.org/pragma.html#pragma_schema_version) which will let you 
> store a number in the database header so you can keep track of what version 
> of the "user schema" you have implemented in the database. Initially, when 
> the database is created empty, the value is zero.
> 
> pragma user_version;
> 
> returns a single row with a single value which is the version, and the 
> command,
> 
> pragma user_version=n;
> 
> lets you change it to n. Perhaps you can use this as a flag to tell yourself 
> that you are working with an uninitialized database (value is 0), that 
> another process is updating the database schema (change it to -1), or that it 
> is at some internal revision number known to your program (it has a value > 
> 0) such that you do not need to change the schema or initialize it.
> 

This is actually very helpful! 
This soultion avoids unnecessary transaction after database open.
I can use *double checked locking* and start transaction only if necessary.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to