I have two sqlite connections and are executed as shown below (CMyDatabase is a sqlite3 derived class):
CMyDatabase* dbConnection1 = new CMyDatabase;
dbConnection1->OpenDataBase(CQCommon::GetModulePath() + L"test.db");
CMyDatabase* dbConnection2 = new CMyDatabase;
dbConnection2->OpenDataBase(CQCommon::GetModulePath() + L"test.db");
dbConnection2->BeginTrans();
CString updateStr("update ImageAlbumEntry set ImageID = 2 where ID = 1;");
dbConnection2->ExecNoQuery(updateStr);
CString queryStr("select ImageID from ImageAlbumEntry where ID = 1;");
CppSQLite3Query queryResult;
dbConnection2->ExecQuery(queryStr, queryResult);
cout<<queryResult.getIntField(0)<<endl;
dbConnection2->EndTrans(TRUE);
dbConnection2->CloseDataBase();
dbConnection1->CloseDataBase();
Now when I call dbConnection1-> CloseDataBase (). I met with an error declared as "Failed to close due to pending statements." Can someone explain the reason and solve the problem? Thanks!
source
share