Paul wrote: >> Paul wrote: >>> My goal is to make structure initialization of an *abstract* database >>> atomic. >>> [...] if database file is missing it must be created and initialized. >> >> <http://www.sqlite.org/transactional.html> >> >> Just do the check for the database structure and the initialization inside >> a transaction. > > Yeah, but you didn't read my statements carefully. I was talking about an > abstract database. > It's wrappers responsibility to call *on_create* so it's wrappers > responsibility to check. > How do you check if structure is initializad in an abstract databse?
By calling a non-abstract function? I fear this description is too abstract to be useful. Please show some concrete (pseudo)code. >>> SQLITE_OPEN_EXCLUSIVE >> >> This flag does not mean what you think it means, and is used only >> internally; you are not allowed to use it. > > Please explain, why am I not allowed to use it in sqlite3_open_v2()? That's what the documentation says (<http://www.sqlite.org/c3ref/open.html>): | The flags parameter to sqlite3_open_v2() can take one of the following | three values, optionally combined with the SQLITE_OPEN_NOMUTEX, | SQLITE_OPEN_FULLMUTEX, SQLITE_OPEN_SHAREDCACHE, SQLITE_OPEN_PRIVATECACHE, | and/or SQLITE_OPEN_URI flags: | SQLITE_OPEN_READONLY [...] | SQLITE_OPEN_READWRITE [...] | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE [...] ... and also what the code actually does: /* Remove harmful bits from the flags parameter ** ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were ** dealt with in the previous code block. Besides these, the only ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY, ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits. Silently mask ** off all other flags. */ flags &= ~( SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_TRANSIENT_DB | SQLITE_OPEN_MAIN_JOURNAL | SQLITE_OPEN_TEMP_JOURNAL | SQLITE_OPEN_SUBJOURNAL | SQLITE_OPEN_MASTER_JOURNAL | SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_WAL ); Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users