I think i found solution.
The problem is that DBD::SQlite->disconnect() method execute
sqlite3_close() function.
This function return SQLITE_BUSY in case if there are any active statement.
From API:
"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".
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|