Fix "closing dbh with active statement handles" issue caused by prepared
statements which weren't finalized by $dbh->disconnect(). Since version 3.6.0 of sqlite one can use the new sqlite3_next_stmt() function to get all open statements and call sqlite3_finalize() on them. This patch implements that behaviour. Problem brought to my attention again by bernd@ at p2k8 and i had it in my tree since then without any issues. Testing and ok by bernd@ and pea@, thanks! Bug filed upstream at http://rt.cpan.org/Public/Bug/Display.html?id=40383
This commit is contained in:
parent
afd1fb2805
commit
076fd8c72b
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.16 2008/10/02 20:34:39 simon Exp $
|
||||
# $OpenBSD: Makefile,v 1.17 2009/01/24 17:42:22 simon Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
|
||||
@ -6,7 +6,7 @@ COMMENT= SQLite drivers for the Perl DBI
|
||||
|
||||
MODULES= cpan
|
||||
DISTNAME= DBD-SQLite-1.14
|
||||
PKGNAME= p5-${DISTNAME}p0v0
|
||||
PKGNAME= p5-${DISTNAME}p1v0
|
||||
CATEGORIES= databases
|
||||
|
||||
MAINTAINER= Robert Nagy <robert@openbsd.org>
|
||||
@ -19,10 +19,15 @@ PERMIT_DISTFILES_FTP= Yes
|
||||
|
||||
BUILD_DEPENDS= :p5-DBI->=1.08:databases/p5-DBI
|
||||
RUN_DEPENDS= :p5-DBI->=1.08:databases/p5-DBI
|
||||
LIB_DEPENDS= sqlite3::databases/sqlite3
|
||||
LIB_DEPENDS= sqlite3:sqlite3->=3.6.4:databases/sqlite3
|
||||
|
||||
CONFIGURE_ARGS= SQLITE_LOCATION=${LOCALBASE}
|
||||
MAKE_FLAGS= CC='${CC}' \
|
||||
LD='${CC}'
|
||||
|
||||
# as DBD::SQLite bundles sqlite3, our patches can't use functions from newer
|
||||
# versions installed via ports
|
||||
post-extract:
|
||||
rm -f ${WRKSRC}/sqlite3.h ${WRKSRC}/sqlite3ext.h
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
22
databases/p5-DBD-SQLite/patches/patch-dbdimp_c
Normal file
22
databases/p5-DBD-SQLite/patches/patch-dbdimp_c
Normal file
@ -0,0 +1,22 @@
|
||||
This patch makes sure that prepared statements get closed when
|
||||
$dbh->disconnect() is called. Ticket created upstream at
|
||||
http://rt.cpan.org/Public/Bug/Display.html?id=40383
|
||||
|
||||
$OpenBSD: patch-dbdimp_c,v 1.5 2009/01/24 17:42:22 simon Exp $
|
||||
--- dbdimp.c.orig Fri Aug 24 04:51:25 2007
|
||||
+++ dbdimp.c Sat Oct 25 22:31:04 2008
|
||||
@@ -151,8 +151,13 @@ sqlite_db_disconnect (SV *dbh, imp_dbh_t *imp_dbh)
|
||||
}
|
||||
|
||||
if (sqlite3_close(imp_dbh->db) == SQLITE_BUSY) {
|
||||
+ sqlite3_stmt *pStmt;
|
||||
/* active statements! */
|
||||
- warn("closing dbh with active statement handles");
|
||||
+
|
||||
+ while ((pStmt = sqlite3_next_stmt(imp_dbh->db, NULL)) != NULL)
|
||||
+ sqlite3_finalize(pStmt);
|
||||
+
|
||||
+ sqlite3_close(imp_dbh->db);
|
||||
}
|
||||
imp_dbh->db = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user