[odb-users] create_schema deletes db tables
Lidia Kalinovsky
lidia at lemur-soft.com
Fri Jul 5 08:17:35 EDT 2013
Hello
When I try to open existing database, all existing data is deleted just
after schema_catalog::create_schema (*db); is called.
Could somebody advice ?
Code is following ( create_database function provided with examples )
auto_ptr<database> db (
new odb::sqlite::database (
databasename, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
// Create the database schema. Due to bugs in SQLite foreign key
// support for DDL statements, we need to temporarily disable
// foreign keys.
//
{
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");
}
return db;
--
Software integration and outsourcing services,
Lemur-Soft, Giv'at Nili
Israel, 37825
Phone : (+972) 545748325
Fax : (+972) 775345383
Email : lidia at lemur-soft.com
Web: www.lemur-soft.com
More information about the odb-users
mailing list