[odb-users] Opening an already existing database (SQLite) and appending

Boris Kolpackov boris at codesynthesis.com
Wed Jun 29 08:32:12 EDT 2011


Hi Thomas,

Szumowski, Thomas <thomas.szumowski at lmco.com> writes:

> I also tried the database constructor that takes in a name and flags - 
> something to the effect "database(string name, int flags)", setting 
> the flags to SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, with no luck.

According to the SQLite documentation[1], opening with just 
SQLITE_OPEN_READWRITE will open the existing database but fail if it does 
not already exist. Opening with SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
will create the database if it does not exist. ODB underneath always uses
the sqlite3_open_v2() function. 

So it sounds to me that this should work as expected. Can you elaborate
on the overwrite behavior that you are observing? Is the database always
empty after you open it even though you stored something into it before?
Can you also check that you are actually committing the transaction? If
none of this helps, can you send a small test case that reproduces this?

[1] http://www.sqlite.org/c3ref/open.html

Boris



More information about the odb-users mailing list