diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-11-29 15:10:39 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-11-29 15:10:39 +0100 |
commit | a757ebb5b58db9e15b71ed50c6ba9e2a5111508c (patch) | |
tree | 21928175b0254e55a478e85955a90d570e9066fa /ext/sqlite3 | |
parent | 1674db8c40f363a5fe0ef2ca5dd1bcebbd6cdfa0 (diff) | |
download | php-git-a757ebb5b58db9e15b71ed50c6ba9e2a5111508c.tar.gz |
Require SQLite ≥ 3.7.4 for ext/sqlite3
`SQLite3::readOnly()` uses `sqlite3_stmt_readonly()` which is only
available as of libsqlite 3.7.4. For older SQLite3 versions we return
always `false`, which can be confusing. Instead of sticking with this
behavior, or even undefining the method for old SQLite3 versions, we
lift the requirements to SQLite 3.7.4 (released on 2010-12-08),
according to a respective discussion[1].
Since pdo_sqlite doesn't use `sqlite3_stmt_readonly()`, we stick with
the minimum requirement of SQLite 3.5.0.
[1] <https://github.com/php/php-src/pull/3614>
Diffstat (limited to 'ext/sqlite3')
-rw-r--r-- | ext/sqlite3/config0.m4 | 6 | ||||
-rw-r--r-- | ext/sqlite3/sqlite3.c | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 98495da300..24a4df0277 100644 --- a/ext/sqlite3/config0.m4 +++ b/ext/sqlite3/config0.m4 @@ -33,14 +33,14 @@ if test $PHP_SQLITE3 != "no"; then AC_MSG_ERROR([Please reinstall the sqlite distribution from http://www.sqlite.org]) fi - AC_MSG_CHECKING([for SQLite 3.5.0+]) - PHP_CHECK_LIBRARY(sqlite3, sqlite3_open_v2, [ + AC_MSG_CHECKING([for SQLite 3.7.4+]) + PHP_CHECK_LIBRARY(sqlite3, sqlite3_stmt_readonly, [ AC_MSG_RESULT(found) PHP_ADD_LIBRARY_WITH_PATH(sqlite3, $SQLITE3_DIR/$PHP_LIBDIR, SQLITE3_SHARED_LIBADD) PHP_ADD_INCLUDE($SQLITE3_DIR/include) ],[ AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Please install SQLite 3.5.0 first or check libsqlite3 is present]) + AC_MSG_ERROR([Please install SQLite 3.7.4 first or check libsqlite3 is present]) ],[ -L$SQLITE3_DIR/$PHP_LIBDIR -lm ]) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 7f76e55684..58d8cf2791 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1386,11 +1386,9 @@ PHP_METHOD(sqlite3stmt, readOnly) SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3); SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt); -#if SQLITE_VERSION_NUMBER >= 3007004 if (sqlite3_stmt_readonly(stmt_obj->stmt)) { RETURN_TRUE; } -#endif RETURN_FALSE; } /* }}} */ |