[odb-users] bug in Android
Lidia Kalinovsky
lidia at lemur-soft.com
Mon Nov 4 04:07:57 EST 2013
Hello
I suspect there is some bug that happens on Android ( ok in Windows).
I got exception
14: unable to open database file
if 2 updates are called sequentially in one transaction.
( problem is in journal file locking, i guess...)
Could you advice, please ?
( erase/persist does work, but it is not option for us, unfortunately :( ).
Also, I believe, opening/commit transaction is slower than doing
everything in one transaction.
Please fix me if I am wrong.
Thanks.
Lidia.
Code fragment is following:
LOG("SyncManager::FullSync()->","test");
std::shared_ptr<odb::database> testDB =
DBHelper::CreateDatabase(fullDatabasePath+"_1.sqlite",true);
std::shared_ptr<Agent> a(new Agent());
std::shared_ptr<Agent> b(new Agent());
a->setWrntyID(25);
b->setWrntyID(20);
LOG("SyncManager::FullSync()->","before 2 persist in one transaction");
odb::transaction testTrans (testDB->begin());
testDB->persist(a);
testDB->persist(b);
testTrans.commit();
LOG("SyncManager::FullSync()->","after 2 persist in one transaction");
a->setAccountStatus(1);
b->setAccountStatus(1);
odb::transaction testTrans1 (testDB->begin());
LOG("SyncManager::FullSync()->","before 1 updates in one transaction");
testDB->update(a);
testTrans1.commit();
odb::transaction testTrans2 (testDB->begin());
LOG("SyncManager::FullSync()->","before 1 updates in one transaction");
testDB->update(b);
testTrans2.commit();
LOG("SyncManager::FullSync()->","before 2 updates in one transaction");
try
{
odb::transaction testTrans1 (testDB->begin());
a->setAccountStatus(2);
b->setAccountStatus(2);
testDB->update(a);
testDB->update(b);
testTrans1.commit();
}
catch(odb::exception& e)
{
LOG("SyncManager::FullSync()->","exception from 2 updates in one
transaction");
}
--
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