]> granicus.if.org Git - php/commitdiff
Switch to the v2 version of these functions.
authorRasmus Lerdorf <rasmus@lerdorf.com>
Sun, 22 Jan 2017 15:26:07 +0000 (07:26 -0800)
committerRasmus Lerdorf <rasmus@lerdorf.com>
Sun, 22 Jan 2017 15:26:07 +0000 (07:26 -0800)
The sqlite3 docs suggest always using prepare_v2 and the close_v2
could potentially help with an fd leak we have been seeing

NEWS
UPGRADING
ext/pdo_sqlite/sqlite_driver.c

diff --git a/NEWS b/NEWS
index cb835f43119851eecb8a428437430ce83955be2f..45d6df5be25bc3e29b69a13af8cc1c738ef72bec 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -99,6 +99,9 @@ PHP                                                                        NEWS
   . Fixed bug #73959 (lastInsertId fails to throw an exception for wrong 
     sequence name). (andrewnester)
 
+- PDO_Sqlite
+  . Switch to sqlite3_prepare_v2() and sqlite3_close_v2() functions (rasmus)
+
 - posix:
   . Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoh)
 
index 6b429dae79f4f6d3685e986013170e9097ca7af0..af739b81a43c391b8122cefed088c8f8c4650182 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -189,6 +189,10 @@ PHP 7.2 UPGRADE NOTES
   . mb_convert_encoding() accepts array parameter. Only value encodings
     are converted recursively.
 
+- pdo_sqlite
+  . Use sqlite3_prepare_v2() and sqlite3_close_v2() functions instead of their
+    legacy counterparts.
+
 ========================================
 10. New Global Constants
 ========================================
index 80b52d550b15864d46581ed33755ebb49511002b..c5fd54cfb4a6ced6fd73495984aed4c2e4775ad6 100644 (file)
@@ -161,7 +161,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */
 
                pdo_sqlite_cleanup_callbacks(H);
                if (H->db) {
-                       sqlite3_close(H->db);
+                       sqlite3_close_v2(H->db);
                        H->db = NULL;
                }
                if (einfo->errmsg) {
@@ -193,7 +193,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_le
                return 0;
        }
 
-       i = sqlite3_prepare(H->db, sql, sql_len, &S->stmt, &tail);
+       i = sqlite3_prepare_v2(H->db, sql, sql_len, &S->stmt, &tail);
        if (i == SQLITE_OK) {
                return 1;
        }