Is it bug or feature?
When I try to ExecuteSql (DROP TABLE) after using DBEnumerator I catch E_OBJECT_LOCKED.
If I remove rs->MoveFirst() - the code above works fine
- DbEnumerator* rs;
- rs = pDatabase->QueryN(L"SELECT count(*) FROM tbl");
- if (rs)
- {
- rs->Reset();
- if (rs->MoveFirst() == E_SUCCESS)// If remove this line - everything OK
- {
- //
- }
- }
- AppLog("DROP1");
- r = pDatabase->ExecuteSql(L"DROP TABLE IF EXISTS tbl", true);//Error - object locked
- if (IsFailed(r)) { AppLog("Error drop table r=%d %s",r,GetErrorMessage(r)); Close(); return r; }
- r = pDatabase->ExecuteSql(L"CREATE TABLE IF NOT EXISTS tbl (fid INTEGER PRIMARY KEY AUTOINCREMENT, fx DOUBLE, fy DOUBLE);", true);
- if (IsFailed(r)) { AppLog("Error CREATE TABLE r=%d",r); Close(); return r; }
- AppLog("DROP2");// the same
- r = pDatabase->ExecuteSql(L"DROP TABLE IF EXISTS tbl", true);
- if (IsFailed(r)) { AppLog("Error drop table r=%d %s",r,GetErrorMessage(r)); Close(); return r; }
- r = pDatabase->ExecuteSql(L"CREATE TABLE IF NOT EXISTS tbl (fid INTEGER PRIMARY KEY AUTOINCREMENT, fx DOUBLE, fy DOUBLE);", true);
- if (IsFailed(r)) { AppLog("Error CREATE TABLE r=%d",r); Close(); return r; }