summaryrefslogtreecommitdiff
path: root/ext/sqlite3
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-16 18:50:19 +0200
committerAnatol Belski <ab@php.net>2014-10-16 18:50:19 +0200
commitaac7b1db7c9df59ffb0860de7692c653719cf4d0 (patch)
tree1fe1bdc2ffc380a0eaeea069ed5cbb0176eb7715 /ext/sqlite3
parent073c79b8b539fbbfc540db1cb1a15dfba5358f24 (diff)
downloadphp-git-aac7b1db7c9df59ffb0860de7692c653719cf4d0.tar.gz
converted ext/sqlite and ext/pdo_mysql to use static tsrmls cache
Diffstat (limited to 'ext/sqlite3')
-rw-r--r--ext/sqlite3/config.w322
-rw-r--r--ext/sqlite3/config0.m42
-rw-r--r--ext/sqlite3/php_sqlite3.h3
-rw-r--r--ext/sqlite3/sqlite3.c6
4 files changed, 11 insertions, 2 deletions
diff --git a/ext/sqlite3/config.w32 b/ext/sqlite3/config.w32
index 8ddb6b9ac8..60dd2fae52 100644
--- a/ext/sqlite3/config.w32
+++ b/ext/sqlite3/config.w32
@@ -5,7 +5,7 @@ ARG_WITH("sqlite3", "SQLite 3 support", "no");
if (PHP_SQLITE3 != "no") {
ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 /D SQLITE_API=__declspec(dllexport) ");
- EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname);
+ EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname + " /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES(configure_module_dirname + "/libsqlite", "sqlite3.c", "sqlite3");
diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4
index 6959a6f916..bbb1133fe4 100644
--- a/ext/sqlite3/config0.m4
+++ b/ext/sqlite3/config0.m4
@@ -8,7 +8,7 @@ PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension,
if test $PHP_SQLITE3 != "no"; then
sqlite3_extra_sources=""
- PHP_SQLITE3_CFLAGS=""
+ PHP_SQLITE3_CFLAGS=" -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 "
dnl when running phpize enable_maintainer_zts is not available
if test -z "$enable_maintainer_zts"; then
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index 5c7dfcfa5a..8f1c500211 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.h
@@ -32,6 +32,9 @@ ZEND_END_MODULE_GLOBALS(sqlite3)
#ifdef ZTS
# define SQLITE3G(v) TSRMG(sqlite3_globals_id, zend_sqlite3_globals *, v)
+# ifdef COMPILE_DL_SQLITE3
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
# define SQLITE3G(v) (sqlite3_globals.v)
#endif
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index af3dec0681..a98b303547 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -2271,6 +2271,9 @@ PHP_MINFO_FUNCTION(sqlite3)
*/
static PHP_GINIT_FUNCTION(sqlite3)
{
+#if defined(COMPILE_DL_SQLITE3) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
memset(sqlite3_globals, 0, sizeof(*sqlite3_globals));
}
/* }}} */
@@ -2296,6 +2299,9 @@ zend_module_entry sqlite3_module_entry = {
/* }}} */
#ifdef COMPILE_DL_SQLITE3
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(sqlite3)
#endif