--- Joe Wilson <[EMAIL PROTECTED]> wrote:
>
> Your code fragment seems fine.
>
> There seems to be a finalization problem between the NativeDB and the
> PrepStmt.
>
> See if it still crashes if you close each prepared statement after use.
>
> In addition, you might also try this untested patch to sqlitejdbc:
>
> --- PrepStmt.java-orig 2007-08-21 19:27:11.000000000 -0400
> +++ PrepStmt.java 2007-08-21 19:54:03.000000000 -0400
> @@ -33,7 +33,14 @@
> /** Weaker close to support object overriding (see docs in RS.java). */
> public void close() throws SQLException {
> batch = null;
> - if (pointer == 0 || db == null) clearRS(); else clearParameters();
> + if (pointer == 0 || db == null) {
> + clearRS();
> + } else {
> + clearParameters();
> + int resp = db.finalize(this);
> + if (resp != SQLITE_OK && resp != SQLITE_MISUSE)
> + db.throwex();
> + }
> }
>
> public void clearParameters() throws SQLException {
Please try this patch as well:
--- DB.java-orig 2007-08-22 09:40:08.000000000 -0400
+++ DB.java 2007-08-22 10:44:40.000000000 -0400
@@ -40,7 +40,7 @@
Iterator i = stmts.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry)i.next();
- RS stmt = (RS)((WeakReference)entry.getValue()).get();
+ RS stmt = (RS)(entry.getValue());
finalize(((Long)entry.getKey()).longValue());
if (stmt != null) {
stmt.pointer = 0;
@@ -60,8 +60,7 @@
if (stmt.pointer != 0)
finalize(stmt);
stmt.pointer = prepare(stmt.sql);
- stmts.put(new Long(stmt.pointer),
- new WeakReference(stmt));
+ stmts.put(new Long(stmt.pointer), stmt);
}
final synchronized int finalize(RS stmt) throws SQLException {
____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---