Switch to the v2 version of these functions.

The sqlite3 docs suggest always using prepare_v2 and the close_v2
could potentially help with an fd leak we have been seeing
This commit is contained in:
Rasmus Lerdorf 2017-01-22 07:26:07 -08:00
parent 5d0048cd75
commit 7b8b2e50f6
3 changed files with 9 additions and 2 deletions

3
NEWS
View file

@ -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)

View file

@ -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
========================================

View 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;
}