[odb-users] ODB Sqlite Database

Thomas Hayes baileythomashayes at gmail.com
Thu Feb 13 10:43:01 EST 2020


Hello,

I am using odb with sqlite and never had any issues.  I am currently using
Beta 2.5 built with build2.
Currently I use:

shared_ptr<odb::sqlite:database> db (new odb::sqlite::database ("test.db" ,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));

{
    connection_ptr c (db->connection ());

    c->execute ("PRAGMA foreign_keys=OFF");

    transaction t (c->begin ());
    schema_catalog::create_schema (*db);
    t.commit ();

    c->execute ("PRAGMA foreign_keys=ON");
  }


However I want to use:

"memory" to use the ram or "" to use a temp file, but when I do this I
get no such table error


Please help! Thanks!


shared_ptr<odb::sqlite:database> db (new odb::sqlite::database
(":memory:" , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));

{
    connection_ptr c (db->connection ());

    c->execute ("PRAGMA foreign_keys=OFF");

    transaction t (c->begin ());
    schema_catalog::create_schema (*db);
    t.commit ();

    c->execute ("PRAGMA foreign_keys=ON");
  }


More information about the odb-users mailing list