[odb-users] Declaring db connection in reading query

Boris Kolpackov boris at codesynthesis.com
Mon Mar 9 07:21:58 EDT 2015


Hi Nicholas,

Nicholas Cremonesi <nicholas.cremonesi at gmail.com> writes:

> I'm trying to execute queries on an already populated database. If I
> declare the db connection like this "auto_ptr<database> db (create_database
> (argc, argv));" I notice that, executing the query, the target table is
> cleared.

You copied the create_database() function from one of the examples.
If you looked into its implementation, you would have seen that,
for SQLite, it re-creates the database schema. This is the desired
behavior for examples (we want them to start from the clean slate
every time) but not necessarily for your application.

Boris



More information about the odb-users mailing list