I think i found solution.
The problem is that DBD::SQlite->disconnect() method execute
This function return SQLITE_BUSY in case if there are any active statement.
"Applications should finalize all prepared statements and close all
BLOBs associated with the sqlite3 object prior to attempting to close
the sqlite3 object."
Currently DBD::SQLite can finalize statements only via DESTROY method.
In simplest case you can always use "undef $sth" or wait untill it
goes out of scope
which will finalize statement.
But if you prepared statement via cache (prepare_cached) it will not
work for you,
because statement is till inside DBI cache. In this case we can call
DESTROY on our cached statement only via DESTROY for database handler.
And we can achieve it by "undef $dbh".
"undef $dbh" - will close all cached statements and close database
without any errors.
Conclusion: avoid using $dbh->disconnect() for DBD::SQLite, instead
use "undef $dbh".
in reply to Re^2: CGI::Session + DBD::SQLite = closing dbh with active statement handles
in thread CGI::Session + DBD::SQLite = closing dbh with active statement handles