Spent a couple of days tracking down a strange error using PHPunit and SQLite for testing a complex application. The test suite kept throwing
PDOException: SQLSTATE[HY000]: General error: 5 database is lockedand halting in test that didn't touch the database. The problem was in an unrelated test that ran before it. The test uses iterators to examine database contents, but didn't iterate all the way through the result set. The iterator left the database locked. Finishing the iterator unlocked the database. while($iterator->current()){ $iterator->next(); } // clean out the iterator or the db gets locked.
- Log in to post comments