]> granicus.if.org Git - php/commitdiff
zts fixes
authorWez Furlong <wez@php.net>
Fri, 12 Aug 2005 23:32:31 +0000 (23:32 +0000)
committerWez Furlong <wez@php.net>
Fri, 12 Aug 2005 23:32:31 +0000 (23:32 +0000)
ext/pdo/pdo.c
ext/pdo/pdo_dbh.c
ext/pdo/php_pdo_driver.h
ext/pdo_dblib/dblib_driver.c
ext/pdo_mysql/mysql_driver.c
ext/pdo_oci/oci_driver.c
ext/pdo_odbc/odbc_driver.c
ext/pdo_pgsql/pgsql_driver.c
ext/pdo_sqlite/sqlite_driver.c

index c80f0602edaf8dd511adad6b74479bc6db2cda96..faf2d5e150b7424701b59bf399141c3ade8838fa 100755 (executable)
@@ -55,7 +55,7 @@ int php_pdo_list_entry(void)
 /* for exceptional circumstances */
 zend_class_entry *pdo_exception_ce;
 
-PDO_API zend_class_entry *php_pdo_get_exception(void)
+PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D)
 {
        return U_CLASS_ENTRY(pdo_exception_ce);
 }
@@ -381,7 +381,7 @@ PHP_MINIT_FUNCTION(pdo)
 #if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
        pdo_exception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException, NULL TSRMLS_CC);
 #else
-       pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(), NULL TSRMLS_CC);
+       pdo_exception_ce = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
 #endif
        zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC);
 
index 2f517c1627c91ed64cbaeb562776cf5e496a1997..83de7012cdaa23403157c5646fa92d90c25556ae 100755 (executable)
@@ -84,7 +84,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate
                }
        } else {
                zval *ex;
-               zend_class_entry *def_ex = zend_exception_get_default(), *pdo_ex = php_pdo_get_exception();
+               zend_class_entry *def_ex = zend_exception_get_default(TSRMLS_C), *pdo_ex = php_pdo_get_exception(TSRMLS_C);
 
                MAKE_STD_ZVAL(ex);
                object_init_ex(ex, pdo_ex);
@@ -165,7 +165,7 @@ void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC)
                }
        } else if (EG(exception) == NULL) {
                zval *ex;
-               zend_class_entry *def_ex = zend_exception_get_default(), *pdo_ex = php_pdo_get_exception();
+               zend_class_entry *def_ex = zend_exception_get_default(TSRMLS_C), *pdo_ex = php_pdo_get_exception(TSRMLS_C);
 
                MAKE_STD_ZVAL(ex);
                object_init_ex(ex, pdo_ex);
@@ -235,7 +235,7 @@ static PHP_FUNCTION(dbh_constructor)
 
                snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source);
                if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name");
+                       zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name");
                        ZVAL_NULL(object);
                        return;
                }
@@ -244,7 +244,7 @@ static PHP_FUNCTION(dbh_constructor)
                colon = strchr(data_source, ':');
                
                if (!colon) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name (via INI: %s)", alt_dsn);
+                       zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name (via INI: %s)", alt_dsn);
                        ZVAL_NULL(object);
                        return;
                }
@@ -254,13 +254,13 @@ static PHP_FUNCTION(dbh_constructor)
                /* the specified URI holds connection details */
                data_source = dsn_from_uri(data_source, alt_dsn, sizeof(alt_dsn) TSRMLS_CC);
                if (!data_source) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source URI");
+                       zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source URI");
                        ZVAL_NULL(object);
                        return;
                }
                colon = strchr(data_source, ':');
                if (!colon) {
-                       zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name (via URI)");
+                       zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "invalid data source name (via URI)");
                        ZVAL_NULL(object);
                        return;
                }
@@ -271,7 +271,7 @@ static PHP_FUNCTION(dbh_constructor)
        if (!driver) {
                /* NB: don't want to include the data_source in the error message as
                 * it might contain a password */
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "could not find driver");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "could not find driver");
                ZVAL_NULL(object);
                return;
        }
@@ -583,14 +583,14 @@ static PHP_METHOD(PDO, beginTransaction)
        pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (dbh->in_txn) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is already an active transaction");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is already an active transaction");
                RETURN_FALSE;
        }
        
        if (!dbh->methods->begin) {
                /* TODO: this should be an exception; see the auto-commit mode
                 * comments below */
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "This driver doesn't support transactions");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "This driver doesn't support transactions");
                RETURN_FALSE;
        }
 
@@ -611,7 +611,7 @@ static PHP_METHOD(PDO, commit)
        pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (!dbh->in_txn) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is no active transaction");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is no active transaction");
                RETURN_FALSE;
        }
 
@@ -632,7 +632,7 @@ static PHP_METHOD(PDO, rollBack)
        pdo_dbh_t *dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
 
        if (!dbh->in_txn) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "There is no active transaction");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "There is no active transaction");
                RETURN_FALSE;
        }
 
@@ -714,7 +714,7 @@ static PHP_METHOD(PDO, setAttribute)
 
 fail:
        if (attr == PDO_ATTR_AUTOCOMMIT) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "The auto-commit mode cannot be changed for this driver");
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "The auto-commit mode cannot be changed for this driver");
        } else if (!dbh->methods->set_attribute) {
                pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support setting attributes" TSRMLS_CC);
        } else {
index 11650ac65efe7326b038e49193af0fcb3338a2ce..c054410cddc4dbec65db6ad4c4d03bfe30fc0ec7 100755 (executable)
@@ -617,7 +617,7 @@ PDO_API int php_pdo_parse_data_source(const char *data_source,
                unsigned long data_source_len, struct pdo_data_src_parser *parsed,
                int nparams);
 
-PDO_API zend_class_entry *php_pdo_get_exception(void);
+PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D);
 
 PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, 
        char **outquery, int *outquery_len TSRMLS_DC);
index 23087775a5d4efb2ba71783165f3cf53c08a5d07..c3065b92bc1bf713d5af3f7e53d62bf12409a8f3 100644 (file)
@@ -247,7 +247,7 @@ cleanup:
        dbh->driver_data = H;
 
        if (!ret) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC,
                        "SQLSTATE[%s] %s (severity %d)",
                        DBLIB_G(err).sqlstate,
                        DBLIB_G(err).dberrstr,
index d880a259e3e35713a53df84cd590c5d5e0c55e05..6321eb24f8a2ec5ee8ecc3eb5b0902d1fcf646db 100755 (executable)
@@ -97,7 +97,7 @@ int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int lin
 #endif
 
        if (!dbh->methods) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
                                *pdo_err, einfo->errcode, einfo->errmsg);
        }
 /* printf("** [%s:%d] %s %s\n", file, line, *pdo_err, einfo->errmsg); */
index 50113c4790dd95dade5ae14d474c11bf3e4eb859..7d52bdc5a6c69f8acc4e2a7426587442cf18bae5 100755 (executable)
@@ -146,7 +146,7 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor
 
        /* little mini hack so that we can use this code from the dbh ctor */
        if (!dbh->methods) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg);
        }
 
        return einfo->errcode;
index 99e05e1322a6d53256dc0dbced19e0ac214f750b..4952c1aa6242668d907de38ac6657115149869ee 100755 (executable)
@@ -87,7 +87,7 @@ void pdo_odbc_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, PDO_ODBC_HSTMT statement,
        strcpy(*pdo_err, einfo->last_state);
 /* printf("@@ SQLSTATE[%s] %s\n", *pdo_err, einfo->last_err_msg); */
        if (!dbh->methods) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] %s: %d %s",
                                *pdo_err, what, einfo->last_error, einfo->last_err_msg);
        }
 }
index 43ed6e3258d893b61cc1f11d3be7441fc9830082..5c15e4f13dadbb6ebd9d8287f5d7e15ec376252d 100644 (file)
@@ -80,7 +80,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *
        }
 
        if (!dbh->methods) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
                                *pdo_err, einfo->errcode, einfo->errmsg);
        }
        
index e3734d4a7c28468756516ca7431b76140cadc7eb..b5304410b9722e8cafcb4213c6ce051aa61bbfa3 100644 (file)
@@ -75,7 +75,7 @@ int _pdo_sqlite_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int li
        }
 
        if (!dbh->methods) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s] [%d] %s",
                                *pdo_err, einfo->errcode, einfo->errmsg);
        }
        
@@ -692,7 +692,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS
        filename = make_filename_safe(dbh->data_source TSRMLS_CC);
 
        if (!filename) {
-               zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+               zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC,
                        "safe_mode/open_basedir prohibits opening %s",
                        dbh->data_source);
                goto cleanup;