I am trying out the Data framework and have made some progress. I am able to create tables as well as insert into them. However my first test at deleting records is failing. My code is as follows:
- Code: Select all
void PersistenceManagerImpl::deleteCollection( const string& name )
{
Session ses = getSession();
if ( ses.isConnected() ) // added if statement to see if the database missing error message was related to invalid session
{
ses << "delete from Collections where name = :name", use( name ), now;
collections.erase( name );
}
}
My unit test code catches an exception with the following displayText "SQL Statement invalid or database missing: delete from Collections where name = :name"
I do have foreign key constraints and cascade deletes set on the table. As per SQLite manual I execute a pragma statement as part of the PersistenceManager singleton initialisation process.
- Code: Select all
ses << "PRAGMA foreign_keys = ON", now;
Any ideas on what the issue is? I tried a simple delete statement "delete from Collections" and I get the same error. Running the same command (both versions) from sqlite3 terminal session works as expected.
Thanks
Rakesh





