Skip to content

Commit

Permalink
sqlite3 linkage issue on some systems/package combination fix.
Browse files Browse the repository at this point in the history
Checking the version is not enough, the function might be available
but the symbols are not present still.

Closes GH-5993
  • Loading branch information
devnexen authored and cmb69 committed Aug 21, 2020
1 parent 8f9f308 commit 1b21b56
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions ext/sqlite3/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (PHP_SQLITE3 != "no") {

AC_DEFINE("HAVE_SQLITE3", 1, "SQLite support");
AC_DEFINE("HAVE_SQLITE3_ERRSTR", 1, "have sqlite3_errstr function");
AC_DEFINE("HAVE_SQLITE3_EXPANDED_SQL", 1, "have sqlite3_expanded_sql function");
} else {
WARNING("sqlite3 not enabled; libraries and/or headers not found");
}
Expand Down
4 changes: 4 additions & 0 deletions ext/sqlite3/config0.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ if test $PHP_SQLITE3 != "no"; then
AC_DEFINE(HAVE_SQLITE3_ERRSTR, 1, [have sqlite3_errstr function])
], [], [$SQLITE3_SHARED_LIBADD])

PHP_CHECK_LIBRARY(sqlite3, sqlite3_expanded_sql, [
AC_DEFINE(HAVE_SQLITE3_EXPANDED_SQL, 1, [have sqlite3_expanded_sql function])
], [], [$SQLITE3_SHARED_LIBADD])

PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension,
[],
[AC_DEFINE(SQLITE_OMIT_LOAD_EXTENSION, 1, [have sqlite3 with extension support])],
Expand Down
2 changes: 1 addition & 1 deletion ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ PHP_METHOD(sqlite3stmt, getSQL)
}

if (expanded) {
#if SQLITE_VERSION_NUMBER >= 3014000
#ifdef HAVE_SQLITE3_EXPANDED_SQL
char *sql = sqlite3_expanded_sql(stmt_obj->stmt);
RETVAL_STRING(sql);
sqlite3_free(sql);
Expand Down

0 comments on commit 1b21b56

Please sign in to comment.