diff options
author | Anatol Belski <ab@php.net> | 2014-12-18 10:09:02 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-12-18 10:09:02 +0100 |
commit | 4b943c9c0dd4114adc78416c5241f11ad5c98a80 (patch) | |
tree | c9628d91eae3f580f9ebd73d2372e4c9089b2e00 /ext/pdo | |
parent | 79354ba6d0d6a1a4596f9ac66ee9bc3a34ed972b (diff) | |
parent | dec8eb431adee340fb8dfb9ff33ed29d3279c35f (diff) | |
download | php-git-POST_NATIVE_TLS_MERGE.tar.gz |
Merge remote-tracking branch 'origin/native-tls'POST_NATIVE_TLS_MERGE
Diffstat (limited to 'ext/pdo')
-rw-r--r-- | ext/pdo/pdo.c | 14 | ||||
-rw-r--r-- | ext/pdo/pdo_dbh.c | 240 | ||||
-rw-r--r-- | ext/pdo/pdo_sql_parser.c | 22 | ||||
-rw-r--r-- | ext/pdo/pdo_sql_parser.re | 22 | ||||
-rw-r--r-- | ext/pdo/pdo_stmt.c | 467 | ||||
-rw-r--r-- | ext/pdo/php_pdo.h | 8 | ||||
-rw-r--r-- | ext/pdo/php_pdo_driver.h | 66 | ||||
-rw-r--r-- | ext/pdo/php_pdo_error.h | 6 | ||||
-rw-r--r-- | ext/pdo/php_pdo_int.h | 24 |
9 files changed, 434 insertions, 435 deletions
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c index 61c68ff46d..0e2759793b 100644 --- a/ext/pdo/pdo.c +++ b/ext/pdo/pdo.c @@ -77,7 +77,7 @@ PDO_API char *php_pdo_str_tolower_dup(const char *src, int len) /* {{{ */ } /* }}} */ -PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC) /* {{{ */ +PDO_API zend_class_entry *php_pdo_get_exception_base(int root) /* {{{ */ { #if defined(HAVE_SPL) if (!root) { @@ -93,7 +93,7 @@ PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC) /* {{{ } } #endif - return zend_exception_get_default(TSRMLS_C); + return zend_exception_get_default(); } /* }}} */ @@ -309,7 +309,7 @@ PDO_API int php_pdo_parse_data_source(const char *data_source, zend_ulong data_s /* }}} */ static const char digit_vec[] = "0123456789"; -PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC) /* {{{ */ +PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64) /* {{{ */ { char buffer[65]; char outbuf[65] = ""; @@ -368,12 +368,12 @@ PHP_MINIT_FUNCTION(pdo) INIT_CLASS_ENTRY(ce, "PDOException", NULL); - pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0 TSRMLS_CC) TSRMLS_CC); + pdo_exception_ce = zend_register_internal_class_ex(&ce, php_pdo_get_exception_base(0)); - zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_null(pdo_exception_ce, "errorInfo", sizeof("errorInfo")-1, ZEND_ACC_PUBLIC); - pdo_dbh_init(TSRMLS_C); - pdo_stmt_init(TSRMLS_C); + pdo_dbh_init(); + pdo_stmt_init(); return SUCCESS; } diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 571e08b4c0..9cc1c7dfbf 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -36,9 +36,9 @@ #include "zend_object_handlers.h" #include "zend_hash.h" -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC); +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value); -void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp TSRMLS_DC) /* {{{ */ +void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate, const char *supp) /* {{{ */ { pdo_error_type *pdo_err = &dbh->error_code; char *message = NULL; @@ -72,24 +72,24 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate } if (dbh && dbh->error_mode != PDO_ERRMODE_EXCEPTION) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message); + php_error_docref(NULL, E_WARNING, "%s", message); } else { zval ex, info; - zend_class_entry *def_ex = php_pdo_get_exception_base(1 TSRMLS_CC), *pdo_ex = php_pdo_get_exception(); + zend_class_entry *def_ex = php_pdo_get_exception_base(1), *pdo_ex = php_pdo_get_exception(); object_init_ex(&ex, pdo_ex); - zend_update_property_string(def_ex, &ex, "message", sizeof("message")-1, message TSRMLS_CC); - zend_update_property_string(def_ex, &ex, "code", sizeof("code")-1, *pdo_err TSRMLS_CC); + zend_update_property_string(def_ex, &ex, "message", sizeof("message")-1, message); + zend_update_property_string(def_ex, &ex, "code", sizeof("code")-1, *pdo_err); array_init(&info); add_next_index_string(&info, *pdo_err); add_next_index_long(&info, 0); - zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info TSRMLS_CC); + zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo")-1, &info); zval_ptr_dtor(&info); - zend_throw_exception_object(&ex TSRMLS_CC); + zend_throw_exception_object(&ex); } if (message) { @@ -98,7 +98,7 @@ void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *sqlstate } /* }}} */ -PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ +PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */ { pdo_error_type *pdo_err = &dbh->error_code; const char *msg = "<<Unknown>>"; @@ -127,7 +127,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ add_next_index_string(&info, *pdo_err); - if (dbh->methods->fetch_err(dbh, stmt, &info TSRMLS_CC)) { + if (dbh->methods->fetch_err(dbh, stmt, &info)) { zval *item; if ((item = zend_hash_index_find(Z_ARRVAL(info), 1)) != NULL) { @@ -147,21 +147,21 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ } if (dbh->error_mode == PDO_ERRMODE_WARNING) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", message->val); + php_error_docref(NULL, E_WARNING, "%s", message->val); } else if (EG(exception) == NULL) { zval ex; - zend_class_entry *def_ex = php_pdo_get_exception_base(1 TSRMLS_CC), *pdo_ex = php_pdo_get_exception(); + zend_class_entry *def_ex = php_pdo_get_exception_base(1), *pdo_ex = php_pdo_get_exception(); object_init_ex(&ex, pdo_ex); - zend_update_property_str(def_ex, &ex, "message", sizeof("message") - 1, message TSRMLS_CC); - zend_update_property_string(def_ex, &ex, "code", sizeof("code") - 1, *pdo_err TSRMLS_CC); + zend_update_property_str(def_ex, &ex, "message", sizeof("message") - 1, message); + zend_update_property_string(def_ex, &ex, "code", sizeof("code") - 1, *pdo_err); if (!Z_ISUNDEF(info)) { - zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo") - 1, &info TSRMLS_CC); + zend_update_property(pdo_ex, &ex, "errorInfo", sizeof("errorInfo") - 1, &info); } - zend_throw_exception_object(&ex TSRMLS_CC); + zend_throw_exception_object(&ex); } if (!Z_ISUNDEF(info)) { @@ -178,7 +178,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC) /* {{{ } /* }}} */ -static char *dsn_from_uri(char *uri, char *buf, size_t buflen TSRMLS_DC) /* {{{ */ +static char *dsn_from_uri(char *uri, char *buf, size_t buflen) /* {{{ */ { php_stream *stream; char *dsn = NULL; @@ -209,7 +209,7 @@ static PHP_METHOD(PDO, dbh_constructor) char alt_dsn[512]; int call_factory = 1; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!a!", &data_source, &data_source_len, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!a!", &data_source, &data_source_len, &username, &usernamelen, &password, &passwordlen, &options)) { ZEND_CTOR_MAKE_NULL(); return; @@ -224,7 +224,7 @@ static PHP_METHOD(PDO, 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(), 0, "invalid data source name"); ZEND_CTOR_MAKE_NULL(); return; } @@ -233,7 +233,7 @@ static PHP_METHOD(PDO, 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(), 0, "invalid data source name (via INI: %s)", alt_dsn); ZEND_CTOR_MAKE_NULL(); return; } @@ -241,15 +241,15 @@ static PHP_METHOD(PDO, dbh_constructor) if (!strncmp(data_source, "uri:", sizeof("uri:")-1)) { /* the specified URI holds connection details */ - data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn) TSRMLS_CC); + data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn)); 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(), 0, "invalid data source URI"); ZEND_CTOR_MAKE_NULL(); 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(), 0, "invalid data source name (via URI)"); ZEND_CTOR_MAKE_NULL(); return; } @@ -260,7 +260,7 @@ static PHP_METHOD(PDO, 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(), 0, "could not find driver"); ZEND_CTOR_MAKE_NULL(); return; } @@ -300,7 +300,7 @@ static PHP_METHOD(PDO, dbh_constructor) pdbh = (pdo_dbh_t*)le->ptr; /* is the connection still alive ? */ - if (pdbh->methods->check_liveness && FAILURE == (pdbh->methods->check_liveness)(pdbh TSRMLS_CC)) { + if (pdbh->methods->check_liveness && FAILURE == (pdbh->methods->check_liveness)(pdbh)) { /* nope... need to kill it */ /*??? memory leak */ zend_list_close(le); @@ -316,13 +316,13 @@ static PHP_METHOD(PDO, dbh_constructor) pdbh = pecalloc(1, sizeof(*pdbh), 1); if (!pdbh) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory while allocating PDO handle"); + php_error_docref(NULL, E_ERROR, "out of memory while allocating PDO handle"); /* NOTREACHED */ } pdbh->is_persistent = 1; if (!(pdbh->persistent_id = pemalloc(plen + 1, 1))) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory while allocating PDO handle"); + php_error_docref(NULL, E_ERROR, "out of memory while allocating PDO handle"); } memcpy((char *)pdbh->persistent_id, hashkey, plen+1); pdbh->persistent_id_len = plen; @@ -350,10 +350,10 @@ static PHP_METHOD(PDO, dbh_constructor) dbh->default_fetch_type = PDO_FETCH_BOTH; } - dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1 TSRMLS_CC); + dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1); if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory"); + php_error_docref(NULL, E_ERROR, "out of memory"); } if (!call_factory) { @@ -361,7 +361,7 @@ static PHP_METHOD(PDO, dbh_constructor) goto options; } - if (driver->db_handle_factory(dbh, options TSRMLS_CC)) { + if (driver->db_handle_factory(dbh, options)) { /* all set */ if (is_persistent) { @@ -377,7 +377,7 @@ static PHP_METHOD(PDO, dbh_constructor) if ((zend_hash_str_update_mem(&EG(persistent_list), (char*)dbh->persistent_id, dbh->persistent_id_len, &le, sizeof(le))) == NULL) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Failed to register persistent entry"); + php_error_docref(NULL, E_ERROR, "Failed to register persistent entry"); } } @@ -392,7 +392,7 @@ options: if (str_key) { continue; } - pdo_dbh_attribute_set(dbh, long_key, attr_value TSRMLS_CC); + pdo_dbh_attribute_set(dbh, long_key, attr_value); } ZEND_HASH_FOREACH_END(); } @@ -405,15 +405,15 @@ options: } /* }}} */ -static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args TSRMLS_DC) /* {{{ */ +static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */ { if (!Z_ISUNDEF_P(ctor_args)) { if (Z_TYPE_P(ctor_args) != IS_ARRAY) { - pdo_raise_impl_error(dbh, NULL, "HY000", "constructor arguments must be passed as an array" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "constructor arguments must be passed as an array"); return NULL; } if (!dbstmt_ce->constructor) { - pdo_raise_impl_error(dbh, NULL, "HY000", "user-supplied statement does not accept constructor arguments" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "user-supplied statement does not accept constructor arguments"); return NULL; } } @@ -425,14 +425,14 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry return object; } /* }}} */ -static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args TSRMLS_DC) /* {{{ */ +static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */ { zval query_string; zval z_key; ZVAL_STRINGL(&query_string, stmt->query_string, stmt->query_stringlen); ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString") - 1); - std_object_handlers.write_property(object, &z_key, &query_string, NULL TSRMLS_CC); + std_object_handlers.write_property(object, &z_key, &query_string, NULL); zval_ptr_dtor(&query_string); zval_ptr_dtor(&z_key); @@ -451,7 +451,7 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt fci.params = NULL; fci.no_separation = 1; - zend_fcall_info_args(&fci, ctor_args TSRMLS_CC); + zend_fcall_info_args(&fci, ctor_args); fcc.initialized = 1; fcc.function_handler = dbstmt_ce->constructor; @@ -459,7 +459,7 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt fcc.called_scope = Z_OBJCE_P(object); fcc.object = Z_OBJ_P(object); - if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) { + if (zend_call_function(&fci, &fcc) == FAILURE) { Z_OBJ_P(object) = NULL; ZEND_CTOR_MAKE_NULL(); object = NULL; /* marks failure */ @@ -484,7 +484,7 @@ static PHP_METHOD(PDO, prepare) pdo_dbh_object_t *dbh_obj = Z_PDO_OBJECT_P(getThis()); pdo_dbh_t *dbh = dbh_obj->inner; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &statement, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|a", &statement, &statement_len, &options)) { RETURN_FALSE; } @@ -495,25 +495,25 @@ static PHP_METHOD(PDO, prepare) if (ZEND_NUM_ARGS() > 1 && (opt = zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_STATEMENT_CLASS)) != NULL) { if (Z_TYPE_P(opt) != IS_ARRAY || (item = zend_hash_index_find(Z_ARRVAL_P(opt), 0)) == NULL || Z_TYPE_P(item) != IS_STRING - || (pce = zend_lookup_class(Z_STR_P(item) TSRMLS_CC)) == NULL + || (pce = zend_lookup_class(Z_STR_P(item))) == NULL ) { pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " "the classname must be a string specifying an existing class" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } dbstmt_ce = pce; - if (!instanceof_function(dbstmt_ce, pdo_dbstmt_ce TSRMLS_CC)) { + if (!instanceof_function(dbstmt_ce, pdo_dbstmt_ce)) { pdo_raise_impl_error(dbh, NULL, "HY000", - "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); + "user-supplied statement class must be derived from PDOStatement"); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } if (dbstmt_ce->constructor && !(dbstmt_ce->constructor->common.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED))) { pdo_raise_impl_error(dbh, NULL, "HY000", - "user-supplied statement class cannot have a public constructor" TSRMLS_CC); + "user-supplied statement class cannot have a public constructor"); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } @@ -522,7 +522,7 @@ static PHP_METHOD(PDO, prepare) pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS requires format array(classname, ctor_args); " "ctor_args must be an array" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } @@ -535,10 +535,10 @@ static PHP_METHOD(PDO, prepare) ZVAL_COPY_VALUE(&ctor_args, &dbh->def_stmt_ctor_args); } - if (!pdo_stmt_instantiate(dbh, return_value, dbstmt_ce, &ctor_args TSRMLS_CC)) { + if (!pdo_stmt_instantiate(dbh, return_value, dbstmt_ce, &ctor_args)) { pdo_raise_impl_error(dbh, NULL, "HY000", "failed to instantiate user-supplied statement class" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; } @@ -555,8 +555,8 @@ static PHP_METHOD(PDO, prepare) /* we haven't created a lazy object yet */ ZVAL_UNDEF(&stmt->lazy_object_ref); - if (dbh->methods->preparer(dbh, statement, statement_len, stmt, options TSRMLS_CC)) { - pdo_stmt_construct(execute_data, stmt, return_value, dbstmt_ce, &ctor_args TSRMLS_CC); + if (dbh->methods->preparer(dbh, statement, statement_len, stmt, options)) { + pdo_stmt_construct(execute_data, stmt, return_value, dbstmt_ce, &ctor_args); return; } @@ -581,18 +581,18 @@ static PHP_METHOD(PDO, beginTransaction) PDO_CONSTRUCT_CHECK; 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(), 0, "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(), 0, "This driver doesn't support transactions"); RETURN_FALSE; } - if (dbh->methods->begin(dbh TSRMLS_CC)) { + if (dbh->methods->begin(dbh)) { dbh->in_txn = 1; RETURN_TRUE; } @@ -614,11 +614,11 @@ static PHP_METHOD(PDO, commit) PDO_CONSTRUCT_CHECK; 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(), 0, "There is no active transaction"); RETURN_FALSE; } - if (dbh->methods->commit(dbh TSRMLS_CC)) { + if (dbh->methods->commit(dbh)) { dbh->in_txn = 0; RETURN_TRUE; } @@ -640,11 +640,11 @@ static PHP_METHOD(PDO, rollBack) PDO_CONSTRUCT_CHECK; 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(), 0, "There is no active transaction"); RETURN_FALSE; } - if (dbh->methods->rollback(dbh TSRMLS_CC)) { + if (dbh->methods->rollback(dbh)) { dbh->in_txn = 0; RETURN_TRUE; } @@ -669,16 +669,16 @@ static PHP_METHOD(PDO, inTransaction) RETURN_BOOL(dbh->in_txn); } - RETURN_BOOL(dbh->methods->in_transaction(dbh TSRMLS_CC)); + RETURN_BOOL(dbh->methods->in_transaction(dbh)); } /* }}} */ -static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSRMLS_DC) /* {{{ */ +static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value) /* {{{ */ { #define PDO_LONG_PARAM_CHECK \ if (Z_TYPE_P(value) != IS_LONG && Z_TYPE_P(value) != IS_STRING && Z_TYPE_P(value) != IS_FALSE && Z_TYPE_P(value) != IS_TRUE) { \ - pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer" TSRMLS_CC); \ + pdo_raise_impl_error(dbh, NULL, "HY000", "attribute value must be an integer"); \ PDO_HANDLE_DBH_ERR(); \ return FAILURE; \ } \ @@ -694,7 +694,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR dbh->error_mode = Z_LVAL_P(value); return SUCCESS; default: - pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "invalid error mode"); PDO_HANDLE_DBH_ERR(); return FAILURE; } @@ -710,7 +710,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR dbh->desired_case = Z_LVAL_P(value); return SUCCESS; default: - pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "invalid case folding mode"); PDO_HANDLE_DBH_ERR(); return FAILURE; } @@ -727,7 +727,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR zval *tmp; if ((tmp = zend_hash_index_find(Z_ARRVAL_P(value), 0)) != NULL && Z_TYPE_P(tmp) == IS_LONG) { if (Z_LVAL_P(tmp) == PDO_FETCH_INTO || Z_LVAL_P(tmp) == PDO_FETCH_CLASS) { - pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "FETCH_INTO and FETCH_CLASS are not yet supported as default fetch modes"); return FAILURE; } } @@ -736,7 +736,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR } convert_to_long(value); if (Z_LVAL_P(value) == PDO_FETCH_USE_DEFAULT) { - pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "invalid fetch mode type"); return FAILURE; } dbh->default_fetch_type = Z_LVAL_P(value); @@ -756,31 +756,31 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR if (dbh->is_persistent) { pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); return FAILURE; } if (Z_TYPE_P(value) != IS_ARRAY || (item = zend_hash_index_find(Z_ARRVAL_P(value), 0)) == NULL || Z_TYPE_P(item) != IS_STRING - || (pce = zend_lookup_class(Z_STR_P(item) TSRMLS_CC)) == NULL + || (pce = zend_lookup_class(Z_STR_P(item))) == NULL ) { pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " "the classname must be a string specifying an existing class" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); return FAILURE; } - if (!instanceof_function(pce, pdo_dbstmt_ce TSRMLS_CC)) { + if (!instanceof_function(pce, pdo_dbstmt_ce)) { pdo_raise_impl_error(dbh, NULL, "HY000", - "user-supplied statement class must be derived from PDOStatement" TSRMLS_CC); + "user-supplied statement class must be derived from PDOStatement"); PDO_HANDLE_DBH_ERR(); return FAILURE; } if (pce->constructor && !(pce->constructor->common.fn_flags & (ZEND_ACC_PRIVATE|ZEND_ACC_PROTECTED))) { pdo_raise_impl_error(dbh, NULL, "HY000", - "user-supplied statement class cannot have a public constructor" TSRMLS_CC); + "user-supplied statement class cannot have a public constructor"); PDO_HANDLE_DBH_ERR(); return FAILURE; } @@ -794,7 +794,7 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR pdo_raise_impl_error(dbh, NULL, "HY000", "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " "ctor_args must be an array" - TSRMLS_CC); + ); PDO_HANDLE_DBH_ERR(); return FAILURE; } @@ -812,15 +812,15 @@ static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value TSR } PDO_DBH_CLEAR_ERR(); - if (dbh->methods->set_attribute(dbh, attr, value TSRMLS_CC)) { + if (dbh->methods->set_attribute(dbh, attr, value)) { return SUCCESS; } 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(), 0, "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); + pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support setting attributes"); } else { PDO_HANDLE_DBH_ERR(); } @@ -836,14 +836,14 @@ static PHP_METHOD(PDO, setAttribute) zend_long attr; zval *value; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "lz", &attr, &value)) { RETURN_FALSE; } PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; - if (pdo_dbh_attribute_set(dbh, attr, value TSRMLS_CC) != FAILURE) { + if (pdo_dbh_attribute_set(dbh, attr, value) != FAILURE) { RETURN_TRUE; } RETURN_FALSE; @@ -857,7 +857,7 @@ static PHP_METHOD(PDO, getAttribute) pdo_dbh_t *dbh = Z_PDO_DBH_P(getThis()); zend_long attr; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &attr)) { RETURN_FALSE; } @@ -896,17 +896,17 @@ static PHP_METHOD(PDO, getAttribute) } if (!dbh->methods->get_attribute) { - pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support getting attributes" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support getting attributes"); RETURN_FALSE; } - switch (dbh->methods->get_attribute(dbh, attr, return_value TSRMLS_CC)) { + switch (dbh->methods->get_attribute(dbh, attr, return_value)) { case -1: PDO_HANDLE_DBH_ERR(); RETURN_FALSE; case 0: - pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support that attribute" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support that attribute"); RETURN_FALSE; default: @@ -924,17 +924,17 @@ static PHP_METHOD(PDO, exec) size_t statement_len; zend_long ret; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &statement, &statement_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &statement, &statement_len)) { RETURN_FALSE; } if (!statement_len) { - pdo_raise_impl_error(dbh, NULL, "HY000", "trying to execute an empty query" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "HY000", "trying to execute an empty query"); RETURN_FALSE; } PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; - ret = dbh->methods->doer(dbh, statement, statement_len TSRMLS_CC); + ret = dbh->methods->doer(dbh, statement, statement_len); if(ret == -1) { PDO_HANDLE_DBH_ERR(); RETURN_FALSE; @@ -952,19 +952,19 @@ static PHP_METHOD(PDO, lastInsertId) char *name = NULL; size_t namelen; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &name, &namelen)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &name, &namelen)) { RETURN_FALSE; } PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; if (!dbh->methods->last_id) { - pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support lastInsertId()"); RETURN_FALSE; } else { int id_len; char *id; - id = dbh->methods->last_id(dbh, name, (unsigned int *)&id_len TSRMLS_CC); + id = dbh->methods->last_id(dbh, name, (unsigned int *)&id_len); if (!id) { PDO_HANDLE_DBH_ERR(); RETURN_FALSE; @@ -1029,7 +1029,7 @@ static PHP_METHOD(PDO, errorInfo) } if (dbh->methods->fetch_err) { - dbh->methods->fetch_err(dbh, dbh->query_stmt, return_value TSRMLS_CC); + dbh->methods->fetch_err(dbh, dbh->query_stmt, return_value); } /** @@ -1062,11 +1062,11 @@ static PHP_METHOD(PDO, query) /* Return a meaningful error when no parameters were passed */ if (!ZEND_NUM_ARGS()) { - zend_parse_parameters(0 TSRMLS_CC, "z|z", NULL, NULL); + zend_parse_parameters(0, "z|z", NULL, NULL); RETURN_FALSE; } - if (FAILURE == zend_parse_parameters(1 TSRMLS_CC, "s", &statement, + if (FAILURE == zend_parse_parameters(1, "s", &statement, &statement_len)) { RETURN_FALSE; } @@ -1074,8 +1074,8 @@ static PHP_METHOD(PDO, query) PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; - if (!pdo_stmt_instantiate(dbh, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args TSRMLS_CC)) { - pdo_raise_impl_error(dbh, NULL, "HY000", "failed to instantiate user supplied statement class" TSRMLS_CC); + if (!pdo_stmt_instantiate(dbh, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args)) { + pdo_raise_impl_error(dbh, NULL, "HY000", "failed to instantiate user supplied statement class"); return; } stmt = Z_PDO_STMT_P(return_value); @@ -1094,22 +1094,22 @@ static PHP_METHOD(PDO, query) /* we haven't created a lazy object yet */ ZVAL_UNDEF(&stmt->lazy_object_ref); - if (dbh->methods->preparer(dbh, statement, statement_len, stmt, NULL TSRMLS_CC)) { + if (dbh->methods->preparer(dbh, statement, statement_len, stmt, NULL)) { PDO_STMT_CLEAR_ERR(); if (ZEND_NUM_ARGS() == 1 || SUCCESS == pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, 1)) { /* now execute the statement */ PDO_STMT_CLEAR_ERR(); - if (stmt->methods->executer(stmt TSRMLS_CC)) { + if (stmt->methods->executer(stmt)) { int ret = 1; if (!stmt->executed) { if (stmt->dbh->alloc_own_columns) { - ret = pdo_stmt_describe_columns(stmt TSRMLS_CC); + ret = pdo_stmt_describe_columns(stmt); } stmt->executed = 1; } if (ret) { - pdo_stmt_construct(execute_data, stmt, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args TSRMLS_CC); + pdo_stmt_construct(execute_data, stmt, return_value, dbh->def_stmt_ce, &dbh->def_stmt_ctor_args); return; } } @@ -1138,18 +1138,18 @@ static PHP_METHOD(PDO, quote) char *qstr; int qlen; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, ¶mtype)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, ¶mtype)) { RETURN_FALSE; } PDO_DBH_CLEAR_ERR(); PDO_CONSTRUCT_CHECK; if (!dbh->methods->quoter) { - pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support quoting" TSRMLS_CC); + pdo_raise_impl_error(dbh, NULL, "IM001", "driver does not support quoting"); RETURN_FALSE; } - if (dbh->methods->quoter(dbh, str, str_len, &qstr, &qlen, paramtype TSRMLS_CC)) { + if (dbh->methods->quoter(dbh, str, str_len, &qstr, &qlen, paramtype)) { RETVAL_STRINGL(qstr, qlen); efree(qstr); return; @@ -1163,7 +1163,7 @@ static PHP_METHOD(PDO, quote) Prevents use of a PDO instance that has been unserialized */ static PHP_METHOD(PDO, __wakeup) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "You cannot serialize or unserialize PDO instances"); + zend_throw_exception_ex(php_pdo_get_exception(), 0, "You cannot serialize or unserialize PDO instances"); } /* }}} */ @@ -1171,7 +1171,7 @@ static PHP_METHOD(PDO, __wakeup) Prevents serialization of a PDO instance */ static PHP_METHOD(PDO, __sleep) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "You cannot serialize or unserialize PDO instances"); + zend_throw_exception_ex(php_pdo_get_exception(), 0, "You cannot serialize or unserialize PDO instances"); } /* }}} */ @@ -1264,7 +1264,7 @@ static void cls_method_dtor(zval *el) /* {{{ */ { /* }}} */ /* {{{ overloaded object handlers for PDO class */ -int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC) +int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind) { const zend_function_entry *funcs; zend_function func; @@ -1276,13 +1276,13 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC) if (!dbh || !dbh->methods || !dbh->methods->get_driver_methods) { return 0; } - funcs = dbh->methods->get_driver_methods(dbh, kind TSRMLS_CC); + funcs = dbh->methods->get_driver_methods(dbh, kind); if (!funcs) { return 0; } if (!(dbh->cls_methods[kind] = pemalloc(sizeof(HashTable), dbh->is_persistent))) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory while allocating PDO methods."); + php_error_docref(NULL, E_ERROR, "out of memory while allocating PDO methods."); } zend_hash_init_ex(dbh->cls_methods[kind], 8, NULL, cls_method_dtor, dbh->is_persistent, 0); @@ -1329,7 +1329,7 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind TSRMLS_DC) return 1; } -static union _zend_function *dbh_method_get(zend_object **object, zend_string *method_name, const zval *key TSRMLS_DC) +static union _zend_function *dbh_method_get(zend_object **object, zend_string *method_name, const zval *key) { zend_function *fbc = NULL; pdo_dbh_object_t *dbh_obj = php_pdo_dbh_fetch_object(*object); @@ -1338,12 +1338,12 @@ static union _zend_function *dbh_method_get(zend_object **object, zend_string *m lc_method_name = zend_string_init(method_name->val, method_name->len, 0); zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len); - if ((fbc = std_object_handlers.get_method(object, method_name, key TSRMLS_CC)) == NULL) { + if ((fbc = std_object_handlers.get_method(object, method_name, key)) == NULL) { /* not a pre-defined method, nor a user-defined method; check * the driver specific methods */ if (!dbh_obj->inner->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH]) { if (!pdo_hash_methods(dbh_obj, - PDO_DBH_DRIVER_METHOD_KIND_DBH TSRMLS_CC) + PDO_DBH_DRIVER_METHOD_KIND_DBH) || !dbh_obj->inner->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_DBH]) { goto out; } @@ -1357,20 +1357,20 @@ out: return fbc; } -static int dbh_compare(zval *object1, zval *object2 TSRMLS_DC) +static int dbh_compare(zval *object1, zval *object2) { return -1; } static zend_object_handlers pdo_dbh_object_handlers; -static void pdo_dbh_free_storage(zend_object *std TSRMLS_DC); +static void pdo_dbh_free_storage(zend_object *std); -void pdo_dbh_init(TSRMLS_D) +void pdo_dbh_init(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "PDO", pdo_dbh_functions); - pdo_dbh_ce = zend_register_internal_class(&ce TSRMLS_CC); + pdo_dbh_ce = zend_register_internal_class(&ce); pdo_dbh_ce->create_object = pdo_dbh_new; memcpy(&pdo_dbh_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); @@ -1478,7 +1478,7 @@ void pdo_dbh_init(TSRMLS_D) } -static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent TSRMLS_DC) +static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent) { int i; @@ -1492,7 +1492,7 @@ static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent TSRMLS_DC) } if (dbh->methods) { - dbh->methods->closer(dbh TSRMLS_CC); + dbh->methods->closer(dbh); } if (dbh->data_source) { @@ -1523,27 +1523,27 @@ static void dbh_free(pdo_dbh_t *dbh, zend_bool free_persistent TSRMLS_DC) pefree(dbh, dbh->is_persistent); } -static void pdo_dbh_free_storage(zend_object *std TSRMLS_DC) +static void pdo_dbh_free_storage(zend_object *std) { pdo_dbh_t *dbh = php_pdo_dbh_fetch_inner(std); if (dbh->in_txn && dbh->methods && dbh->methods->rollback) { - dbh->methods->rollback(dbh TSRMLS_CC); + dbh->methods->rollback(dbh); dbh->in_txn = 0; } if (dbh->is_persistent && dbh->methods && dbh->methods->persistent_shutdown) { - dbh->methods->persistent_shutdown(dbh TSRMLS_CC); + dbh->methods->persistent_shutdown(dbh); } - zend_object_std_dtor(std TSRMLS_CC); - dbh_free(dbh, 0 TSRMLS_CC); + zend_object_std_dtor(std); + dbh_free(dbh, 0); } -zend_object *pdo_dbh_new(zend_class_entry *ce TSRMLS_DC) +zend_object *pdo_dbh_new(zend_class_entry *ce) { pdo_dbh_object_t *dbh; dbh = ecalloc(1, sizeof(pdo_dbh_object_t) + sizeof(zval) * (ce->default_properties_count - 1)); - zend_object_std_init(&dbh->std, ce TSRMLS_CC); + zend_object_std_init(&dbh->std, ce); object_properties_init(&dbh->std, ce); rebuild_object_properties(&dbh->std); dbh->inner = ecalloc(1, sizeof(pdo_dbh_t)); @@ -1560,7 +1560,7 @@ ZEND_RSRC_DTOR_FUNC(php_pdo_pdbh_dtor) /* {{{ */ { if (res->ptr) { pdo_dbh_t *dbh = (pdo_dbh_t*)res->ptr; - dbh_free(dbh, 1 TSRMLS_CC); + dbh_free(dbh, 1); res->ptr = NULL; } } diff --git a/ext/pdo/pdo_sql_parser.c b/ext/pdo/pdo_sql_parser.c index 9dd7305723..be65a927dd 100644 --- a/ext/pdo/pdo_sql_parser.c +++ b/ext/pdo/pdo_sql_parser.c @@ -419,7 +419,7 @@ static void free_param_name(zval *el) { } PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len TSRMLS_DC) + char **outquery, int *outquery_len) { Scanner s; char *ptr, *newbuffer; @@ -473,7 +473,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, /* did the query make sense to me? */ if (query_type == (PDO_PLACEHOLDER_NAMED|PDO_PLACEHOLDER_POSITIONAL)) { /* they mixed both types; punt */ - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters"); ret = -1; goto clean_up; } @@ -497,7 +497,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, /* Do we have placeholders but no bound params */ if (bindno && !params && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound"); ret = -1; goto clean_up; } @@ -516,7 +516,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, goto safe; } } - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens"); ret = -1; goto clean_up; } @@ -537,7 +537,7 @@ safe: if (param == NULL) { /* parameter was not defined */ ret = -1; - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined"); goto clean_up; } if (stmt->dbh->methods->quoter) { @@ -556,7 +556,7 @@ safe: buf = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0); if (!stmt->dbh->methods->quoter(stmt->dbh, buf->val, buf->len, &plc->quoted, &plc->qlen, - param->param_type TSRMLS_CC)) { + param->param_type)) { /* bork */ ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); @@ -569,7 +569,7 @@ safe: zend_string_release(buf); } } else { - pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource"); ret = -1; goto clean_up; } @@ -600,7 +600,7 @@ safe: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, - param->param_type TSRMLS_CC)) { + param->param_type)) { /* bork */ ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); @@ -740,7 +740,7 @@ clean_up: #if 0 int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery, - int *outquery_len TSRMLS_DC) + int *outquery_len) { Scanner s; char *ptr; @@ -805,7 +805,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; @@ -841,7 +841,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re index 79e167ba1d..847f69ac18 100644 --- a/ext/pdo/pdo_sql_parser.re +++ b/ext/pdo/pdo_sql_parser.re @@ -81,7 +81,7 @@ static void free_param_name(zval *el) { } PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len TSRMLS_DC) + char **outquery, int *outquery_len) { Scanner s; char *ptr, *newbuffer; @@ -135,7 +135,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, /* did the query make sense to me? */ if (query_type == (PDO_PLACEHOLDER_NAMED|PDO_PLACEHOLDER_POSITIONAL)) { /* they mixed both types; punt */ - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters"); ret = -1; goto clean_up; } @@ -159,7 +159,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, /* Do we have placeholders but no bound params */ if (bindno && !params && stmt->supports_placeholders == PDO_PLACEHOLDER_NONE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "no parameters were bound"); ret = -1; goto clean_up; } @@ -178,7 +178,7 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, goto safe; } } - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "number of bound variables does not match number of tokens"); ret = -1; goto clean_up; } @@ -199,7 +199,7 @@ safe: if (param == NULL) { /* parameter was not defined */ ret = -1; - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined"); goto clean_up; } if (stmt->dbh->methods->quoter) { @@ -218,7 +218,7 @@ safe: buf = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0); if (!stmt->dbh->methods->quoter(stmt->dbh, buf->val, buf->len, &plc->quoted, &plc->qlen, - param->param_type TSRMLS_CC)) { + param->param_type)) { /* bork */ ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); @@ -231,7 +231,7 @@ safe: zend_string_release(buf); } } else { - pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY105", "Expected a stream resource"); ret = -1; goto clean_up; } @@ -262,7 +262,7 @@ safe: convert_to_string(&tmp_param); if (!stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL(tmp_param), Z_STRLEN(tmp_param), &plc->quoted, &plc->qlen, - param->param_type TSRMLS_CC)) { + param->param_type)) { /* bork */ ret = -1; strncpy(stmt->error_code, stmt->dbh->error_code, 6); @@ -402,7 +402,7 @@ clean_up: #if 0 int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char **outquery, - int *outquery_len TSRMLS_DC) + int *outquery_len) { Scanner s; char *ptr; @@ -467,7 +467,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; @@ -503,7 +503,7 @@ int old_pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, char /* quote the bind value if necessary */ if(stmt->dbh->methods->quoter(stmt->dbh, Z_STRVAL_P(param->parameter), - Z_STRLEN_P(param->parameter), "edstr, "edstrlen TSRMLS_CC)) + Z_STRLEN_P(param->parameter), "edstr, "edstrlen)) { memcpy(ptr, quotedstr, quotedstrlen); ptr += quotedstrlen; diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 1491c80cfd..e4daca7b87 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -115,11 +115,11 @@ ZEND_END_ARG_INFO() static PHP_FUNCTION(dbstmt_constructor) /* {{{ */ { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "You should not create a PDOStatement manually"); + php_error_docref(NULL, E_ERROR, "You should not create a PDOStatement manually"); } /* }}} */ -static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_param_data *param TSRMLS_DC) /* {{{ */ +static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_param_data *param) /* {{{ */ { if (stmt->bound_param_map) { /* rewriting :name to ? style. @@ -141,7 +141,7 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa param->name = zend_string_init(name, strlen(name), 0); return 1; } - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined"); return 0; } @@ -151,13 +151,13 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa continue; } if (param->paramno >= 0) { - pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO refuses to handle repeating the same :named parameter for multiple positions with this driver, as it might be unsafe to do so. Consider using a separate name for each parameter instead" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO refuses to handle repeating the same :named parameter for multiple positions with this driver, as it might be unsafe to do so. Consider using a separate name for each parameter instead"); return -1; } param->paramno = position; return 1; } ZEND_HASH_FOREACH_END(); - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined"); return 0; } return 1; @@ -165,7 +165,7 @@ static inline int rewrite_name_to_position(pdo_stmt_t *stmt, struct pdo_bound_pa /* }}} */ /* trigger callback hook for parameters */ -static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_type TSRMLS_DC) /* {{{ */ +static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_type) /* {{{ */ { int ret = 1, is_param = 1; struct pdo_bound_param_data *param; @@ -180,7 +180,7 @@ static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_typ iterate: if (ht) { ZEND_HASH_FOREACH_PTR(ht, param) { - if (!stmt->methods->param_hook(stmt, param, event_type TSRMLS_CC)) { + if (!stmt->methods->param_hook(stmt, param, event_type)) { ret = 0; break; } @@ -196,14 +196,14 @@ iterate: } /* }}} */ -int pdo_stmt_describe_columns(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ +int pdo_stmt_describe_columns(pdo_stmt_t *stmt) /* {{{ */ { int col; stmt->columns = ecalloc(stmt->column_count, sizeof(struct pdo_column_data)); for (col = 0; col < stmt->column_count; col++) { - if (!stmt->methods->describer(stmt, col TSRMLS_CC)) { + if (!stmt->methods->describer(stmt, col)) { return 0; } @@ -254,12 +254,12 @@ int pdo_stmt_describe_columns(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } /* }}} */ -static void get_lazy_object(pdo_stmt_t *stmt, zval *return_value TSRMLS_DC) /* {{{ */ +static void get_lazy_object(pdo_stmt_t *stmt, zval *return_value) /* {{{ */ { if (Z_ISUNDEF(stmt->lazy_object_ref)) { pdo_row_t *row = ecalloc(1, sizeof(pdo_row_t)); row->stmt = stmt; - zend_object_std_init(&row->std, pdo_row_ce TSRMLS_CC); + zend_object_std_init(&row->std, pdo_row_ce); ZVAL_OBJ(&stmt->lazy_object_ref, &row->std); row->std.handlers = &pdo_row_object_handlers; stmt->std.gc.refcount++; @@ -274,8 +274,7 @@ static void param_dtor(zval *el) /* {{{ */ /* tell the driver that it is going away */ if (param->stmt->methods->param_hook) { - TSRMLS_FETCH(); - param->stmt->methods->param_hook(param->stmt, param, PDO_PARAM_EVT_FREE TSRMLS_CC); + param->stmt->methods->param_hook(param->stmt, param, PDO_PARAM_EVT_FREE); } if (param->name) { @@ -293,7 +292,7 @@ static void param_dtor(zval *el) /* {{{ */ } /* }}} */ -static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_stmt_t *stmt, int is_param TSRMLS_DC) /* {{{ */ +static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_stmt_t *stmt, int is_param) /* {{{ */ { HashTable *hash; zval *parameter; @@ -356,7 +355,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s if (param->paramno == -1) { char *tmp; spprintf(&tmp, 0, "Did not find column name '%s' in the defined columns; it will not be bound", param->name->val); - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", tmp TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", tmp); efree(tmp); } } @@ -372,7 +371,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s } } - if (is_param && !rewrite_name_to_position(stmt, param TSRMLS_CC)) { + if (is_param && !rewrite_name_to_position(stmt, param)) { if (param->name) { zend_string_release(param->name); param->name = NULL; @@ -386,7 +385,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s * at this time. */ if (stmt->methods->param_hook) { if (!stmt->methods->param_hook(stmt, param, PDO_PARAM_EVT_NORMALIZE - TSRMLS_CC)) { + )) { if (param->name) { zend_string_release(param->name); param->name = NULL; @@ -412,7 +411,7 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s /* tell the driver we just created a parameter */ if (stmt->methods->param_hook) { if (!stmt->methods->param_hook(stmt, pparam, PDO_PARAM_EVT_ALLOC - TSRMLS_CC)) { + )) { /* undo storage allocation; the hash will free the parameter * name if required */ if (pparam->name) { @@ -437,7 +436,7 @@ static PHP_METHOD(PDOStatement, execute) int ret = 1; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &input_params)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &input_params)) { RETURN_FALSE; } @@ -466,7 +465,7 @@ static PHP_METHOD(PDOStatement, execute) /* we're okay to be zero based here */ /* num_index is unsignend if (num_index < 0) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", NULL TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", NULL); RETURN_FALSE; } */ @@ -476,7 +475,7 @@ static PHP_METHOD(PDOStatement, execute) param.param_type = PDO_PARAM_STR; ZVAL_COPY(¶m.parameter, tmp); - if (!really_register_bound_param(¶m, stmt, 1 TSRMLS_CC)) { + if (!really_register_bound_param(¶m, stmt, 1)) { if (!Z_ISUNDEF(param.parameter)) { zval_ptr_dtor(¶m.parameter); } @@ -492,7 +491,7 @@ static PHP_METHOD(PDOStatement, execute) */ ret = pdo_parse_params(stmt, stmt->query_string, stmt->query_stringlen, - &stmt->active_query_string, &stmt->active_query_stringlen TSRMLS_CC); + &stmt->active_query_string, &stmt->active_query_stringlen); if (ret == 0) { /* no changes were made */ @@ -504,11 +503,11 @@ static PHP_METHOD(PDOStatement, execute) PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } - } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) { + } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } - if (stmt->methods->executer(stmt TSRMLS_CC)) { + if (stmt->methods->executer(stmt)) { if (stmt->active_query_string && stmt->active_query_string != stmt->query_string) { efree(stmt->active_query_string); } @@ -519,13 +518,13 @@ static PHP_METHOD(PDOStatement, execute) if (stmt->dbh->alloc_own_columns && !stmt->columns) { /* for "big boy" drivers, we need to allocate memory to fetch * the results into, so lets do that now */ - ret = pdo_stmt_describe_columns(stmt TSRMLS_CC); + ret = pdo_stmt_describe_columns(stmt); } stmt->executed = 1; } - if (ret && !dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_POST TSRMLS_CC)) { + if (ret && !dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_POST)) { RETURN_FALSE; } @@ -540,7 +539,7 @@ static PHP_METHOD(PDOStatement, execute) } /* }}} */ -static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *type_override TSRMLS_DC) /* {{{ */ +static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *type_override) /* {{{ */ { struct pdo_column_data *col; char *value = NULL; @@ -555,7 +554,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ value = NULL; value_len = 0; - stmt->methods->get_col(stmt, colno, &value, &value_len, &caller_frees TSRMLS_CC); + stmt->methods->get_col(stmt, colno, &value, &value_len, &caller_frees); switch (type) { case PDO_PARAM_ZVAL: @@ -674,26 +673,26 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ } /* }}} */ -static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset, int do_bind TSRMLS_DC) /* {{{ */ +static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset, int do_bind) /* {{{ */ { if (!stmt->executed) { return 0; } - if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_PRE TSRMLS_CC)) { + if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_PRE)) { return 0; } - if (!stmt->methods->fetcher(stmt, ori, offset TSRMLS_CC)) { + if (!stmt->methods->fetcher(stmt, ori, offset)) { return 0; } /* some drivers might need to describe the columns now */ - if (!stmt->columns && !pdo_stmt_describe_columns(stmt TSRMLS_CC)) { + if (!stmt->columns && !pdo_stmt_describe_columns(stmt)) { return 0; } - if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_POST TSRMLS_CC)) { + if (!dispatch_param_event(stmt, PDO_PARAM_EVT_FETCH_POST)) { return 0; } @@ -712,7 +711,7 @@ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zen zval_dtor(Z_REFVAL(param->parameter)); /* set new value */ - fetch_value(stmt, Z_REFVAL(param->parameter), param->paramno, (int *)¶m->param_type TSRMLS_CC); + fetch_value(stmt, Z_REFVAL(param->parameter), param->paramno, (int *)¶m->param_type); /* TODO: some smart thing that avoids duplicating the value in the * general loop below. For now, if you're binding output columns, @@ -726,7 +725,7 @@ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zen } /* }}} */ -static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ +static int do_fetch_class_prepare(pdo_stmt_t *stmt) /* {{{ */ { zend_class_entry *ce = stmt->fetch.cls.ce; zend_fcall_info *fci = &stmt->fetch.cls.fci; @@ -748,7 +747,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ fci->params = NULL; fci->no_separation = 1; - zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args TSRMLS_CC); + zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args); fcc->initialized = 1; fcc->function_handler = ce->constructor; @@ -756,7 +755,7 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ fcc->called_scope = ce; return 1; } else if (!Z_ISUNDEF(stmt->fetch.cls.ctor_args)) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not have a constructor, use NULL for the ctor_params parameter, or simply omit it" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied class does not have a constructor, use NULL for the ctor_params parameter, or simply omit it"); return 0; } else { return 1; /* no ctor no args is also ok */ @@ -764,16 +763,16 @@ static int do_fetch_class_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } /* }}} */ -static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args TSRMLS_DC) /* {{{ */ +static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fci, zend_fcall_info_cache * fcc, int num_args) /* {{{ */ { char *is_callable_error = NULL; - if (zend_fcall_info_init(callable, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == FAILURE) { + if (zend_fcall_info_init(callable, 0, fci, fcc, NULL, &is_callable_error) == FAILURE) { if (is_callable_error) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", is_callable_error TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", is_callable_error); efree(is_callable_error); } else { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function must be a valid callback"); } return 0; } @@ -789,12 +788,12 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * } /* }}} */ -static int do_fetch_func_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ +static int do_fetch_func_prepare(pdo_stmt_t *stmt) /* {{{ */ { zend_fcall_info *fci = &stmt->fetch.cls.fci; zend_fcall_info_cache *fcc = &stmt->fetch.cls.fcc; - if (!make_callable_ex(stmt, &stmt->fetch.func.function, fci, fcc, stmt->column_count TSRMLS_CC)) { + if (!make_callable_ex(stmt, &stmt->fetch.func.function, fci, fcc, stmt->column_count)) { return 0; } else { stmt->fetch.func.values = safe_emalloc(sizeof(zval), stmt->column_count, 0); @@ -803,7 +802,7 @@ static int do_fetch_func_prepare(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ } /* }}} */ -static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) /* {{{ */ +static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */ { /* fci.size is used to check if it is valid */ if (stmt->fetch.cls.fci.size && stmt->fetch.cls.fci.params) { @@ -832,7 +831,7 @@ static int do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs TSRMLS_DC) / /* perform a fetch. If do_bind is true, update any bound columns. * If return_value is not null, store values into it according to HOW. */ -static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all TSRMLS_DC) /* {{{ */ +static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all) /* {{{ */ { int flags, idx, old_arg_count = 0; zend_class_entry *ce = NULL, *old_ce = NULL; @@ -845,7 +844,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ flags = how & PDO_FETCH_FLAGS; how = how & ~PDO_FETCH_FLAGS; - if (!do_fetch_common(stmt, ori, offset, do_bind TSRMLS_CC)) { + if (!do_fetch_common(stmt, ori, offset, do_bind)) { return 0; } @@ -864,7 +863,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ int i = 0; if (how == PDO_FETCH_LAZY) { - get_lazy_object(stmt, return_value TSRMLS_CC); + get_lazy_object(stmt, return_value); return 1; } @@ -886,7 +885,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_KEY_PAIR: if (stmt->column_count != 2) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns." TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns."); return 0; } if (!return_all) { @@ -897,11 +896,11 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_COLUMN: if (colno >= 0 && colno < stmt->column_count) { if (flags == PDO_FETCH_GROUP && stmt->fetch.column == -1) { - fetch_value(stmt, return_value, 1, NULL TSRMLS_CC); + fetch_value(stmt, return_value, 1, NULL); } else if (flags == PDO_FETCH_GROUP && colno) { - fetch_value(stmt, return_value, 0, NULL TSRMLS_CC); + fetch_value(stmt, return_value, 0, NULL); } else { - fetch_value(stmt, return_value, colno, NULL TSRMLS_CC); + fetch_value(stmt, return_value, colno, NULL); } if (!return_all) { return 1; @@ -909,7 +908,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ break; } } else { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid column index" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid column index"); } return 0; @@ -925,30 +924,30 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ old_ce = stmt->fetch.cls.ce; ZVAL_COPY_VALUE(&old_ctor_args, &stmt->fetch.cls.ctor_args); old_arg_count = stmt->fetch.cls.fci.param_count; - do_fetch_opt_finish(stmt, 0 TSRMLS_CC); + do_fetch_opt_finish(stmt, 0); - fetch_value(stmt, &val, i++, NULL TSRMLS_CC); + fetch_value(stmt, &val, i++, NULL); if (Z_TYPE(val) != IS_NULL) { convert_to_string(&val); - if ((cep = zend_lookup_class(Z_STR(val) TSRMLS_CC)) == NULL) { + if ((cep = zend_lookup_class(Z_STR(val))) == NULL) { stmt->fetch.cls.ce = ZEND_STANDARD_CLASS_DEF_PTR; } else { stmt->fetch.cls.ce = cep; } } - do_fetch_class_prepare(stmt TSRMLS_CC); + do_fetch_class_prepare(stmt); zval_dtor(&val); } ce = stmt->fetch.cls.ce; if (!ce) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch class specified" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch class specified"); return 0; } if ((flags & PDO_FETCH_SERIALIZE) == 0) { object_init_ex(return_value, ce); if (!stmt->fetch.cls.fci.size) { - if (!do_fetch_class_prepare(stmt TSRMLS_CC)) + if (!do_fetch_class_prepare(stmt)) { return 0; } @@ -956,8 +955,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ if (ce->constructor && (flags & PDO_FETCH_PROPS_LATE)) { stmt->fetch.cls.fci.object = Z_OBJ_P(return_value); stmt->fetch.cls.fcc.object = Z_OBJ_P(return_value); - if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC); + if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc) == FAILURE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor"); return 0; } else { if (!Z_ISUNDEF(stmt->fetch.cls.retval)) { @@ -971,7 +970,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_INTO: if (Z_ISUNDEF(stmt->fetch.into)) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch-into object specified." TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch-into object specified."); return 0; break; } @@ -985,11 +984,11 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_FUNC: if (Z_ISUNDEF(stmt->fetch.func.function)) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "No fetch function specified"); return 0; } if (!stmt->fetch.func.fci.size) { - if (!do_fetch_func_prepare(stmt TSRMLS_CC)) + if (!do_fetch_func_prepare(stmt)) { return 0; } @@ -1006,9 +1005,9 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ //??? //ZVAL_NULL(&grp_val); if (flags == PDO_FETCH_GROUP && how == PDO_FETCH_COLUMN && stmt->fetch.column > 0) { - fetch_value(stmt, &grp_val, colno, NULL TSRMLS_CC); + fetch_value(stmt, &grp_val, colno, NULL); } else { - fetch_value(stmt, &grp_val, i, NULL TSRMLS_CC); + fetch_value(stmt, &grp_val, i, NULL); } convert_to_string(&grp_val); if (how == PDO_FETCH_COLUMN) { @@ -1020,7 +1019,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ for (idx = 0; i < stmt->column_count; i++, idx++) { zval val; - fetch_value(stmt, &val, i, NULL TSRMLS_CC); + fetch_value(stmt, &val, i, NULL); switch (how) { case PDO_FETCH_ASSOC: @@ -1030,7 +1029,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_KEY_PAIR: { zval tmp; - fetch_value(stmt, &tmp, ++i, NULL TSRMLS_CC); + fetch_value(stmt, &tmp, ++i, NULL); if (Z_TYPE(val) == IS_LONG) { zend_hash_index_update((return_all ? Z_ARRVAL_P(return_all) : Z_ARRVAL_P(return_value)), Z_LVAL(val), &tmp); @@ -1095,7 +1094,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_INTO: zend_update_property(NULL, return_value, stmt->columns[i].name, stmt->columns[i].namelen, - &val TSRMLS_CC); + &val); zval_ptr_dtor(&val); break; @@ -1103,15 +1102,15 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ if ((flags & PDO_FETCH_SERIALIZE) == 0 || idx) { zend_update_property(ce, return_value, stmt->columns[i].name, stmt->columns[i].namelen, - &val TSRMLS_CC); + &val); zval_ptr_dtor(&val); } else { #ifdef MBO_0 php_unserialize_data_t var_hash; PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL TSRMLS_CC) == FAILURE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data" TSRMLS_CC); + if (php_var_unserialize(return_value, (const unsigned char**)&Z_STRVAL(val), Z_STRVAL(val)+Z_STRLEN(val), NULL) == FAILURE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize data"); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return 0; } @@ -1119,11 +1118,11 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ #endif if (!ce->unserialize) { zval_ptr_dtor(&val); - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class"); return 0; - } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL TSRMLS_CC) == FAILURE) { + } else if (ce->unserialize(return_value, ce, (unsigned char *)(Z_TYPE(val) == IS_STRING ? Z_STRVAL(val) : ""), Z_TYPE(val) == IS_STRING ? Z_STRLEN(val) : 0, NULL) == FAILURE) { zval_ptr_dtor(&val); - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "cannot unserialize class"); zval_dtor(return_value); ZVAL_NULL(return_value); return 0; @@ -1140,7 +1139,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ default: zval_ptr_dtor(&val); - pdo_raise_impl_error(stmt->dbh, stmt, "22003", "mode is out of range" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "22003", "mode is out of range"); return 0; break; } @@ -1151,8 +1150,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ if (ce->constructor && !(flags & (PDO_FETCH_PROPS_LATE | PDO_FETCH_SERIALIZE))) { stmt->fetch.cls.fci.object = Z_OBJ_P(return_value); stmt->fetch.cls.fcc.object = Z_OBJ_P(return_value); - if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc TSRMLS_CC) == FAILURE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor" TSRMLS_CC); + if (zend_call_function(&stmt->fetch.cls.fci, &stmt->fetch.cls.fcc) == FAILURE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call class constructor"); return 0; } else { if (!Z_ISUNDEF(stmt->fetch.cls.retval)) { @@ -1161,7 +1160,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } } if (flags & PDO_FETCH_CLASSTYPE) { - do_fetch_opt_finish(stmt, 0 TSRMLS_CC); + do_fetch_opt_finish(stmt, 0); stmt->fetch.cls.ce = old_ce; ZVAL_COPY_VALUE(&stmt->fetch.cls.ctor_args, &old_ctor_args); stmt->fetch.cls.fci.param_count = old_arg_count; @@ -1171,8 +1170,8 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ case PDO_FETCH_FUNC: stmt->fetch.func.fci.param_count = idx; stmt->fetch.func.fci.retval = &retval; - if (zend_call_function(&stmt->fetch.func.fci, &stmt->fetch.func.fcc TSRMLS_CC) == FAILURE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call user-supplied function" TSRMLS_CC); + if (zend_call_function(&stmt->fetch.func.fci, &stmt->fetch.func.fcc) == FAILURE) { + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not call user-supplied function"); return 0; } else { if (return_all) { @@ -1213,14 +1212,14 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } /* }}} */ -static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all TSRMLS_DC) /* {{{ */ +static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all) /* {{{ */ { int flags = mode & PDO_FETCH_FLAGS; mode = mode & ~PDO_FETCH_FLAGS; if (mode < 0 || mode > PDO_FETCH__MAX) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode"); return 0; } @@ -1232,29 +1231,29 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, zend_long mode, int fetch_all switch(mode) { case PDO_FETCH_FUNC: if (!fetch_all) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only allowed in PDOStatement::fetchAll()" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only allowed in PDOStatement::fetchAll()"); return 0; } return 1; case PDO_FETCH_LAZY: if (fetch_all) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll()" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll()"); return 0; } /* fall through */ default: if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only be used together with PDO::FETCH_CLASS" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only be used together with PDO::FETCH_CLASS"); return 0; } if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can only be used together with PDO::FETCH_CLASS" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can only be used together with PDO::FETCH_CLASS"); return 0; } if (mode >= PDO_FETCH__MAX) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "invalid fetch mode"); return 0; } /* no break; */ @@ -1274,18 +1273,18 @@ static PHP_METHOD(PDOStatement, fetch) zend_long off = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lll", &how, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|lll", &how, &ori, &off)) { RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); - if (!pdo_stmt_verify_mode(stmt, how, 0 TSRMLS_CC)) { + if (!pdo_stmt_verify_mode(stmt, how, 0)) { RETURN_FALSE; } - if (!do_fetch(stmt, TRUE, return_value, how, ori, off, 0 TSRMLS_CC)) { + if (!do_fetch(stmt, TRUE, return_value, how, ori, off, 0)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } @@ -1306,13 +1305,13 @@ static PHP_METHOD(PDOStatement, fetchObject) PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|S!a", &class_name, &ctor_args)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!a", &class_name, &ctor_args)) { RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); - if (!pdo_stmt_verify_mode(stmt, how, 0 TSRMLS_CC)) { + if (!pdo_stmt_verify_mode(stmt, how, 0)) { RETURN_FALSE; } @@ -1320,7 +1319,7 @@ static PHP_METHOD(PDOStatement, fetchObject) ZVAL_COPY_VALUE(&old_ctor_args, &stmt->fetch.cls.ctor_args); old_arg_count = stmt->fetch.cls.fci.param_count; - do_fetch_opt_finish(stmt, 0 TSRMLS_CC); + do_fetch_opt_finish(stmt, 0); if (ctor_args) { if (Z_TYPE_P(ctor_args) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(ctor_args))) { @@ -1330,23 +1329,23 @@ static PHP_METHOD(PDOStatement, fetchObject) } } if (class_name && !error) { - stmt->fetch.cls.ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + stmt->fetch.cls.ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO); if (!stmt->fetch.cls.ce) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Could not find user-supplied class" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Could not find user-supplied class"); error = 1; } } else if (!error) { stmt->fetch.cls.ce = zend_standard_class_def; } - if (!error && !do_fetch(stmt, TRUE, return_value, how, ori, off, 0 TSRMLS_CC)) { + if (!error && !do_fetch(stmt, TRUE, return_value, how, ori, off, 0)) { error = 1; } if (error) { PDO_HANDLE_STMT_ERR(); } - do_fetch_opt_finish(stmt, 1 TSRMLS_CC); + do_fetch_opt_finish(stmt, 1); stmt->fetch.cls.ce = old_ce; ZVAL_COPY_VALUE(&stmt->fetch.cls.ctor_args, &old_ctor_args); @@ -1364,18 +1363,18 @@ static PHP_METHOD(PDOStatement, fetchColumn) zend_long col_n = 0; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &col_n)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &col_n)) { RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); - if (!do_fetch_common(stmt, PDO_FETCH_ORI_NEXT, 0, TRUE TSRMLS_CC)) { + if (!do_fetch_common(stmt, PDO_FETCH_ORI_NEXT, 0, TRUE)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } - fetch_value(stmt, return_value, col_n, NULL TSRMLS_CC); + fetch_value(stmt, return_value, col_n, NULL); } /* }}} */ @@ -1391,11 +1390,11 @@ static PHP_METHOD(PDOStatement, fetchAll) int error = 0, flags, old_arg_count; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lzz", &how, &arg2, &ctor_args)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|lzz", &how, &arg2, &ctor_args)) { RETURN_FALSE; } - if (!pdo_stmt_verify_mode(stmt, how, 1 TSRMLS_CC)) { + if (!pdo_stmt_verify_mode(stmt, how, 1)) { RETURN_FALSE; } @@ -1403,7 +1402,7 @@ static PHP_METHOD(PDOStatement, fetchAll) ZVAL_COPY_VALUE(&old_ctor_args, &stmt->fetch.cls.ctor_args); old_arg_count = stmt->fetch.cls.fci.param_count; - do_fetch_opt_finish(stmt, 0 TSRMLS_CC); + do_fetch_opt_finish(stmt, 0); switch(how & ~PDO_FETCH_FLAGS) { case PDO_FETCH_CLASS: @@ -1414,7 +1413,7 @@ static PHP_METHOD(PDOStatement, fetchAll) break; case 3: if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "ctor_args must be either NULL or an array" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "ctor_args must be either NULL or an array"); error = 1; break; } @@ -1429,20 +1428,20 @@ static PHP_METHOD(PDOStatement, fetchAll) ZVAL_UNDEF(&stmt->fetch.cls.ctor_args); } if (Z_TYPE_P(arg2) != IS_STRING) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid class name (should be a string)" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Invalid class name (should be a string)"); error = 1; break; } else { - stmt->fetch.cls.ce = zend_fetch_class(Z_STR_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + stmt->fetch.cls.ce = zend_fetch_class(Z_STR_P(arg2), ZEND_FETCH_CLASS_AUTO); if (!stmt->fetch.cls.ce) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not find user-specified class" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not find user-specified class"); error = 1; break; } } } if (!error) { - do_fetch_class_prepare(stmt TSRMLS_CC); + do_fetch_class_prepare(stmt); } break; @@ -1450,13 +1449,13 @@ static PHP_METHOD(PDOStatement, fetchAll) switch (ZEND_NUM_ARGS()) { case 0: case 1: - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "no fetch function specified" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "no fetch function specified"); error = 1; break; case 3: case 2: ZVAL_COPY_VALUE(&stmt->fetch.func.function, arg2); - if (do_fetch_func_prepare(stmt TSRMLS_CC) == 0) { + if (do_fetch_func_prepare(stmt) == 0) { error = 1; } break; @@ -1474,14 +1473,14 @@ static PHP_METHOD(PDOStatement, fetchAll) stmt->fetch.column = Z_LVAL_P(arg2); break; case 3: - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN"); error = 1; } break; default: if (ZEND_NUM_ARGS() > 1) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Extraneous additional parameters" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Extraneous additional parameters"); error = 1; } } @@ -1503,7 +1502,7 @@ static PHP_METHOD(PDOStatement, fetchAll) } else { return_all = 0; } - if (!do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)) { + if (!do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all)) { error = 2; } } @@ -1511,18 +1510,18 @@ static PHP_METHOD(PDOStatement, fetchAll) if ((how & PDO_FETCH_GROUP)) { do { //??? MAKE_STD_ZVAL(data); - } while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)); + } while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all)); } else if (how == PDO_FETCH_KEY_PAIR || (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR)) { - while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)); + while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all)); } else { array_init(return_value); do { add_next_index_zval(return_value, &data); - } while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, 0 TSRMLS_CC)); + } while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, 0)); } } - do_fetch_opt_finish(stmt, 0 TSRMLS_CC); + do_fetch_opt_finish(stmt, 0); stmt->fetch.cls.ce = old_ce; ZVAL_COPY_VALUE(&stmt->fetch.cls.ctor_args, &old_ctor_args); @@ -1550,10 +1549,10 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, param.paramno = -1; - if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, + if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|llz!", ¶m.paramno, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz|llz!", ¶m.name, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|llz!", ¶m.name, ¶meter, ¶m_type, ¶m.max_value_len, ¶m.driver_params)) { return 0; @@ -1565,12 +1564,12 @@ static int register_bound_param(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ } else if (!param.name) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based"); return 0; } ZVAL_COPY(¶m.parameter, parameter); - if (!really_register_bound_param(¶m, stmt, is_param TSRMLS_CC)) { + if (!really_register_bound_param(¶m, stmt, is_param)) { if (!Z_ISUNDEF(param.parameter)) { zval_ptr_dtor(&(param.parameter)); } @@ -1590,9 +1589,9 @@ static PHP_METHOD(PDOStatement, bindValue) param.paramno = -1; - if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, + if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz/|l", ¶m.paramno, ¶meter, ¶m_type)) { - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz/|l", ¶m.name, + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz/|l", ¶m.name, ¶meter, ¶m_type)) { RETURN_FALSE; } @@ -1603,12 +1602,12 @@ static PHP_METHOD(PDOStatement, bindValue) if (param.paramno > 0) { --param.paramno; /* make it zero-based internally */ } else if (!param.name) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "Columns/Parameters are 1-based"); RETURN_FALSE; } ZVAL_COPY(¶m.parameter, parameter); - if (!really_register_bound_param(¶m, stmt, TRUE TSRMLS_CC)) { + if (!really_register_bound_param(¶m, stmt, TRUE)) { if (!Z_ISUNDEF(param.parameter)) { zval_ptr_dtor(&(param.parameter)); ZVAL_UNDEF(¶m.parameter); @@ -1683,7 +1682,7 @@ static PHP_METHOD(PDOStatement, errorInfo) add_next_index_string(return_value, stmt->error_code); if (stmt->dbh->methods->fetch_err) { - stmt->dbh->methods->fetch_err(stmt->dbh, stmt, return_value TSRMLS_CC); + stmt->dbh->methods->fetch_err(stmt->dbh, stmt, return_value); } error_count = zend_hash_num_elements(Z_ARRVAL_P(return_value)); @@ -1707,7 +1706,7 @@ static PHP_METHOD(PDOStatement, setAttribute) zval *value = NULL; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz!", &attr, &value)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "lz!", &attr, &value)) { RETURN_FALSE; } @@ -1716,13 +1715,13 @@ static PHP_METHOD(PDOStatement, setAttribute) } PDO_STMT_CLEAR_ERR(); - if (stmt->methods->set_attribute(stmt, attr, value TSRMLS_CC)) { + if (stmt->methods->set_attribute(stmt, attr, value)) { RETURN_TRUE; } fail: if (!stmt->methods->set_attribute) { - pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "This driver doesn't support setting attributes" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "This driver doesn't support setting attributes"); } else { PDO_HANDLE_STMT_ERR(); } @@ -1748,21 +1747,21 @@ static PHP_METHOD(PDOStatement, getAttribute) zend_long attr; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &attr)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &attr)) { RETURN_FALSE; } if (!stmt->methods->get_attribute) { if (!generic_stmt_attr_get(stmt, return_value, attr)) { pdo_raise_impl_error(stmt->dbh, stmt, "IM001", - "This driver doesn't support getting attributes" TSRMLS_CC); + "This driver doesn't support getting attributes"); RETURN_FALSE; } return; } PDO_STMT_CLEAR_ERR(); - switch (stmt->methods->get_attribute(stmt, attr, return_value TSRMLS_CC)) { + switch (stmt->methods->get_attribute(stmt, attr, return_value)) { case -1: PDO_HANDLE_STMT_ERR(); RETURN_FALSE; @@ -1771,7 +1770,7 @@ static PHP_METHOD(PDOStatement, getAttribute) if (!generic_stmt_attr_get(stmt, return_value, attr)) { /* XXX: should do something better here */ pdo_raise_impl_error(stmt->dbh, stmt, "IM001", - "driver doesn't support getting that attribute" TSRMLS_CC); + "driver doesn't support getting that attribute"); RETURN_FALSE; } return; @@ -1802,21 +1801,21 @@ static PHP_METHOD(PDOStatement, getColumnMeta) struct pdo_column_data *col; PHP_STMT_GET_OBJ; - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &colno)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &colno)) { RETURN_FALSE; } if(colno < 0) { - pdo_raise_impl_error(stmt->dbh, stmt, "42P10", "column number must be non-negative" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "42P10", "column number must be non-negative"); RETURN_FALSE; } if (!stmt->methods->get_column_meta) { - pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver doesn't support meta data" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver doesn't support meta data"); RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); - if (FAILURE == stmt->methods->get_column_meta(stmt, colno, return_value TSRMLS_CC)) { + if (FAILURE == stmt->methods->get_column_meta(stmt, colno, return_value)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } @@ -1844,7 +1843,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in zend_class_entry *cep; int retval; - do_fetch_opt_finish(stmt, 1 TSRMLS_CC); + do_fetch_opt_finish(stmt, 1); switch (stmt->default_fetch_type) { case PDO_FETCH_INTO: @@ -1869,13 +1868,13 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in if (SUCCESS == retval) { if (Z_TYPE(args[skip]) != IS_LONG) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer"); retval = FAILURE; } else { mode = Z_LVAL(args[skip]); flags = mode & PDO_FETCH_FLAGS; - retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC); + retval = pdo_stmt_verify_mode(stmt, mode, 0); } } @@ -1897,7 +1896,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_NAMED: case PDO_FETCH_KEY_PAIR: if (argc != 1) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode doesn't allow any extra arguments" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode doesn't allow any extra arguments"); } else { retval = SUCCESS; } @@ -1905,9 +1904,9 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_COLUMN: if (argc != 2) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the colno argument"); } else if (Z_TYPE(args[skip+1]) != IS_LONG) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "colno must be an integer"); } else { stmt->fetch.column = Z_LVAL(args[skip+1]); retval = SUCCESS; @@ -1918,20 +1917,20 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in /* Gets its class name from 1st column */ if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) { if (argc != 1) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode doesn't allow any extra arguments" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode doesn't allow any extra arguments"); } else { stmt->fetch.cls.ce = NULL; retval = SUCCESS; } } else { if (argc < 2) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the classname argument" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the classname argument"); } else if (argc > 3) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "too many arguments" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "too many arguments"); } else if (Z_TYPE(args[skip+1]) != IS_STRING) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "classname must be a string" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "classname must be a string"); } else { - cep = zend_lookup_class(Z_STR(args[skip+1]) TSRMLS_CC); + cep = zend_lookup_class(Z_STR(args[skip+1])); if (cep) { retval = SUCCESS; stmt->fetch.cls.ce = cep; @@ -1943,12 +1942,12 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in ZVAL_UNDEF(&stmt->fetch.cls.ctor_args); #ifdef ilia_0 /* we'll only need this when we have persistent statements, if ever */ if (stmt->dbh->is_persistent) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP might crash if you don't call $stmt->setFetchMode() to reset to defaults on this persistent statement. This will be fixed in a later release"); + php_error_docref(NULL, E_WARNING, "PHP might crash if you don't call $stmt->setFetchMode() to reset to defaults on this persistent statement. This will be fixed in a later release"); } #endif if (argc == 3) { if (Z_TYPE(args[skip+2]) != IS_NULL && Z_TYPE(args[skip+2]) != IS_ARRAY) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "ctor_args must be either NULL or an array" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "ctor_args must be either NULL or an array"); retval = FAILURE; } else if (Z_TYPE(args[skip+2]) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL(args[skip+2]))) { ZVAL_DUP(&stmt->fetch.cls.ctor_args, &args[skip+2]); @@ -1956,7 +1955,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in } if (SUCCESS == retval) { - do_fetch_class_prepare(stmt TSRMLS_CC); + do_fetch_class_prepare(stmt); } } @@ -1964,9 +1963,9 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in case PDO_FETCH_INTO: if (argc != 2) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the object parameter" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "fetch mode requires the object parameter"); } else if (Z_TYPE(args[skip+1]) != IS_OBJECT) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "object must be an object" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "object must be an object"); } else { retval = SUCCESS; } @@ -1974,7 +1973,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in if (SUCCESS == retval) { #ifdef ilia_0 /* we'll only need this when we have persistent statements, if ever */ if (stmt->dbh->is_persistent) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP might crash if you don't call $stmt->setFetchMode() to reset to defaults on this persistent statement. This will be fixed in a later release"); + php_error_docref(NULL, E_WARNING, "PHP might crash if you don't call $stmt->setFetchMode() to reset to defaults on this persistent statement. This will be fixed in a later release"); } #endif ZVAL_COPY(&stmt->fetch.into, &args[skip+1]); @@ -1983,7 +1982,7 @@ int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, in break; default: - pdo_raise_impl_error(stmt->dbh, stmt, "22003", "Invalid fetch mode specified" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "22003", "Invalid fetch mode specified"); } if (SUCCESS == retval) { @@ -2018,7 +2017,7 @@ static PHP_METHOD(PDOStatement, setFetchMode) /* {{{ proto bool PDOStatement::nextRowset() Advances to the next rowset in a multi-rowset statement handle. Returns true if it succeeded, false otherwise */ -static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) +static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt) { /* un-describe */ if (stmt->columns) { @@ -2033,13 +2032,13 @@ static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) stmt->column_count = 0; } - if (!stmt->methods->next_rowset(stmt TSRMLS_CC)) { + if (!stmt->methods->next_rowset(stmt)) { /* Set the executed flag to 0 to reallocate columns on next execute */ stmt->executed = 0; return 0; } - pdo_stmt_describe_columns(stmt TSRMLS_CC); + pdo_stmt_describe_columns(stmt); return 1; } @@ -2049,13 +2048,13 @@ static PHP_METHOD(PDOStatement, nextRowset) PHP_STMT_GET_OBJ; if (!stmt->methods->next_rowset) { - pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver does not support multiple rowsets" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver does not support multiple rowsets"); RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); - if (!pdo_stmt_do_next_rowset(stmt TSRMLS_CC)) { + if (!pdo_stmt_do_next_rowset(stmt)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } @@ -2073,13 +2072,13 @@ static PHP_METHOD(PDOStatement, closeCursor) if (!stmt->methods->cursor_closer) { /* emulate it by fetching and discarding rows */ do { - while (stmt->methods->fetcher(stmt, PDO_FETCH_ORI_NEXT, 0 TSRMLS_CC)) + while (stmt->methods->fetcher(stmt, PDO_FETCH_ORI_NEXT, 0)) ; if (!stmt->methods->next_rowset) { break; } - if (!pdo_stmt_do_next_rowset(stmt TSRMLS_CC)) { + if (!pdo_stmt_do_next_rowset(stmt)) { break; } @@ -2090,7 +2089,7 @@ static PHP_METHOD(PDOStatement, closeCursor) PDO_STMT_CLEAR_ERR(); - if (!stmt->methods->cursor_closer(stmt TSRMLS_CC)) { + if (!stmt->methods->cursor_closer(stmt)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } @@ -2111,11 +2110,11 @@ static PHP_METHOD(PDOStatement, debugDumpParams) RETURN_FALSE; } - php_stream_printf(out TSRMLS_CC, "SQL: [%d] %.*s\n", + php_stream_printf(out, "SQL: [%d] %.*s\n", stmt->query_stringlen, stmt->query_stringlen, stmt->query_string); - php_stream_printf(out TSRMLS_CC, "Params: %d\n", + php_stream_printf(out, "Params: %d\n", stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0); if (stmt->bound_params) { @@ -2123,12 +2122,12 @@ static PHP_METHOD(PDOStatement, debugDumpParams) zend_string *key = NULL; ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) { if (key) { - php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", key->len, key->len, key->val); + php_stream_printf(out, "Key: Name: [%d] %.*s\n", key->len, key->len, key->val); } else { - php_stream_printf(out TSRMLS_CC, "Key: Position #%pd:\n", num); + php_stream_printf(out, "Key: Position #%pd:\n", num); } - php_stream_printf(out TSRMLS_CC, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n", + php_stream_printf(out, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n", param->paramno, param->name? param->name->len : 0, param->name? param->name->len : 0, param->name ? param->name->val : "", param->is_param, @@ -2145,7 +2144,7 @@ static PHP_METHOD(PDOStatement, debugDumpParams) Prevents use of a PDOStatement instance that has been unserialized */ static PHP_METHOD(PDOStatement, __wakeup) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "You cannot serialize or unserialize PDOStatement instances"); + zend_throw_exception_ex(php_pdo_get_exception(), 0, "You cannot serialize or unserialize PDOStatement instances"); } /* }}} */ @@ -2153,7 +2152,7 @@ static PHP_METHOD(PDOStatement, __wakeup) Prevents serialization of a PDOStatement instance */ static PHP_METHOD(PDOStatement, __sleep) { - zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "You cannot serialize or unserialize PDOStatement instances"); + zend_throw_exception_ex(php_pdo_get_exception(), 0, "You cannot serialize or unserialize PDOStatement instances"); } /* }}} */ @@ -2183,33 +2182,33 @@ const zend_function_entry pdo_dbstmt_functions[] = { }; /* {{{ overloaded handlers for PDOStatement class */ -static void dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) +static void dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot) { pdo_stmt_t *stmt = Z_PDO_STMT_P(object); convert_to_string(member); if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only"); } else { - std_object_handlers.write_property(object, member, value, cache_slot TSRMLS_CC); + std_object_handlers.write_property(object, member, value, cache_slot); } } -static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot TSRMLS_DC) +static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot) { pdo_stmt_t *stmt = Z_PDO_STMT_P(object); convert_to_string(member); if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only"); } else { - std_object_handlers.unset_property(object, member, cache_slot TSRMLS_CC); + std_object_handlers.unset_property(object, member, cache_slot); } } -static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_string *method_name, const zval *key TSRMLS_DC) +static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_string *method_name, const zval *key) { zend_function *fbc = NULL; zend_string *lc_method_name; @@ -2228,7 +2227,7 @@ static union _zend_function *dbstmt_method_get(zend_object **object_pp, zend_str * the driver specific methods */ if (!stmt->dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_STMT]) { if (!pdo_hash_methods(Z_PDO_OBJECT_P(&stmt->database_object_handle), - PDO_DBH_DRIVER_METHOD_KIND_STMT TSRMLS_CC) + PDO_DBH_DRIVER_METHOD_KIND_STMT) || !stmt->dbh->cls_methods[PDO_DBH_DRIVER_METHOD_KIND_STMT]) { goto out; } @@ -2245,40 +2244,40 @@ out: return fbc; } -static int dbstmt_compare(zval *object1, zval *object2 TSRMLS_DC) +static int dbstmt_compare(zval *object1, zval *object2) { return -1; } -static zend_object *dbstmt_clone_obj(zval *zobject TSRMLS_DC) +static zend_object *dbstmt_clone_obj(zval *zobject) { pdo_stmt_t *stmt; pdo_stmt_t *old_stmt; stmt = ecalloc(1, sizeof(pdo_stmt_t) + sizeof(zval) * (Z_OBJCE_P(zobject)->default_properties_count - 1)); - zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject) TSRMLS_CC); + zend_object_std_init(&stmt->std, Z_OBJCE_P(zobject)); object_properties_init(&stmt->std, Z_OBJCE_P(zobject)); old_stmt = Z_PDO_STMT_P(zobject); - zend_objects_clone_members(&stmt->std, &old_stmt->std TSRMLS_CC); + zend_objects_clone_members(&stmt->std, &old_stmt->std); return &stmt->std; } zend_object_handlers pdo_dbstmt_object_handlers; -static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC); +static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data); -void pdo_stmt_init(TSRMLS_D) +void pdo_stmt_init(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "PDOStatement", pdo_dbstmt_functions); - pdo_dbstmt_ce = zend_register_internal_class(&ce TSRMLS_CC); + pdo_dbstmt_ce = zend_register_internal_class(&ce); pdo_dbstmt_ce->get_iterator = pdo_stmt_iter_get; pdo_dbstmt_ce->create_object = pdo_dbstmt_new; - zend_class_implements(pdo_dbstmt_ce TSRMLS_CC, 1, zend_ce_traversable); - zend_declare_property_null(pdo_dbstmt_ce, "queryString", sizeof("queryString")-1, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_class_implements(pdo_dbstmt_ce, 1, zend_ce_traversable); + zend_declare_property_null(pdo_dbstmt_ce, "queryString", sizeof("queryString")-1, ZEND_ACC_PUBLIC); memcpy(&pdo_dbstmt_object_handlers, &std_object_handlers, sizeof(zend_object_handlers)); pdo_dbstmt_object_handlers.offset = XtOffsetOf(pdo_stmt_t, std); @@ -2291,13 +2290,13 @@ void pdo_stmt_init(TSRMLS_D) pdo_dbstmt_object_handlers.clone_obj = dbstmt_clone_obj; INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions); - pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC); + pdo_row_ce = zend_register_internal_class(&ce); pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */ pdo_row_ce->create_object = pdo_row_new; pdo_row_ce->serialize = pdo_row_serialize; } -static void free_statement(pdo_stmt_t *stmt TSRMLS_DC) +static void free_statement(pdo_stmt_t *stmt) { if (stmt->bound_params) { zend_hash_destroy(stmt->bound_params); @@ -2316,7 +2315,7 @@ static void free_statement(pdo_stmt_t *stmt TSRMLS_DC) } if (stmt->methods && stmt->methods->dtor) { - stmt->methods->dtor(stmt TSRMLS_CC); + stmt->methods->dtor(stmt); } if (stmt->query_string) { efree(stmt->query_string); @@ -2340,26 +2339,26 @@ static void free_statement(pdo_stmt_t *stmt TSRMLS_DC) ZVAL_UNDEF(&stmt->fetch.into); } - do_fetch_opt_finish(stmt, 1 TSRMLS_CC); + do_fetch_opt_finish(stmt, 1); if (!Z_ISUNDEF(stmt->database_object_handle)) { zval_ptr_dtor(&stmt->database_object_handle); } - zend_object_std_dtor(&stmt->std TSRMLS_CC); + zend_object_std_dtor(&stmt->std); } -void pdo_dbstmt_free_storage(zend_object *std TSRMLS_DC) +void pdo_dbstmt_free_storage(zend_object *std) { pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(std); - free_statement(stmt TSRMLS_CC); + free_statement(stmt); } -zend_object *pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC) +zend_object *pdo_dbstmt_new(zend_class_entry *ce) { pdo_stmt_t *stmt; stmt = ecalloc(1, sizeof(pdo_stmt_t) + sizeof(zval) * (ce->default_properties_count - 1)); - zend_object_std_init(&stmt->std, ce TSRMLS_CC); + zend_object_std_init(&stmt->std, ce); object_properties_init(&stmt->std, ce); stmt->std.handlers = &pdo_dbstmt_object_handlers; @@ -2376,7 +2375,7 @@ struct php_pdo_iterator { zval fetch_ahead; }; -static void pdo_stmt_iter_dtor(zend_object_iterator *iter TSRMLS_DC) +static void pdo_stmt_iter_dtor(zend_object_iterator *iter) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter; @@ -2387,14 +2386,14 @@ static void pdo_stmt_iter_dtor(zend_object_iterator *iter TSRMLS_DC) } } -static int pdo_stmt_iter_valid(zend_object_iterator *iter TSRMLS_DC) +static int pdo_stmt_iter_valid(zend_object_iterator *iter) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter; return Z_ISUNDEF(I->fetch_ahead) ? FAILURE : SUCCESS; } -static zval *pdo_stmt_iter_get_data(zend_object_iterator *iter TSRMLS_DC) +static zval *pdo_stmt_iter_get_data(zend_object_iterator *iter) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter; @@ -2406,7 +2405,7 @@ static zval *pdo_stmt_iter_get_data(zend_object_iterator *iter TSRMLS_DC) return &I->fetch_ahead; } -static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC) +static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter; @@ -2417,7 +2416,7 @@ static void pdo_stmt_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_D } } -static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC) +static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter; pdo_stmt_t *stmt = Z_PDO_STMT_P(&I->iter.data); /* for PDO_HANDLE_STMT_ERR() */ @@ -2427,7 +2426,7 @@ static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC) } if (!do_fetch(stmt, TRUE, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT, - PDO_FETCH_ORI_NEXT, 0, 0 TSRMLS_CC)) { + PDO_FETCH_ORI_NEXT, 0, 0)) { PDO_HANDLE_STMT_ERR(); I->key = (ulong)-1; @@ -2448,7 +2447,7 @@ static zend_object_iterator_funcs pdo_stmt_iter_funcs = { NULL }; -zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) +zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int by_ref) { pdo_stmt_t *stmt = Z_PDO_STMT_P(object); struct php_pdo_iterator *I; @@ -2458,12 +2457,12 @@ zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int } I = ecalloc(1, sizeof(struct php_pdo_iterator)); - zend_iterator_init(&I->iter TSRMLS_CC); + zend_iterator_init(&I->iter); I->iter.funcs = &pdo_stmt_iter_funcs; ZVAL_COPY(&I->iter.data, object); if (!do_fetch(stmt, 1, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT, - PDO_FETCH_ORI_NEXT, 0, 0 TSRMLS_CC)) { + PDO_FETCH_ORI_NEXT, 0, 0)) { PDO_HANDLE_STMT_ERR(); I->key = (ulong)-1; ZVAL_UNDEF(&I->fetch_ahead); @@ -2480,7 +2479,7 @@ const zend_function_entry pdo_row_functions[] = { {NULL, NULL, NULL} }; -static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) +static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv) { pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); pdo_stmt_t *stmt = row->stmt; @@ -2492,12 +2491,12 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl if (stmt) { if (Z_TYPE_P(member) == IS_LONG) { if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) { - fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC); + fetch_value(stmt, rv, Z_LVAL_P(member), NULL); } } else if (Z_TYPE_P(member) == IS_STRING && is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) { if (lval >= 0 && lval < stmt->column_count) { - fetch_value(stmt, rv, lval, NULL TSRMLS_CC); + fetch_value(stmt, rv, lval, NULL); } } else { convert_to_string(member); @@ -2505,7 +2504,7 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl * numbers */ for (colno = 0; colno < stmt->column_count; colno++) { if (strcmp(stmt->columns[colno].name, Z_STRVAL_P(member)) == 0) { - fetch_value(stmt, rv, colno, NULL TSRMLS_CC); + fetch_value(stmt, rv, colno, NULL); //??? //Z_SET_REFCOUNT_P(rv, 0); //Z_UNSET_ISREF_P(rv); @@ -2515,7 +2514,7 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl if (strcmp(Z_STRVAL_P(member), "queryString") == 0) { ZVAL_OBJ(&zobj, &stmt->std); //zval_ptr_dtor(rv); - return std_object_handlers.read_property(&zobj, member, type, cache_slot, rv TSRMLS_CC); + return std_object_handlers.read_property(&zobj, member, type, cache_slot, rv); } } } @@ -2527,22 +2526,22 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl return rv; } -static zval *row_dim_read(zval *object, zval *member, int type, zval *rv TSRMLS_DC) +static zval *row_dim_read(zval *object, zval *member, int type, zval *rv) { - return row_prop_read(object, member, type, NULL, rv TSRMLS_CC); + return row_prop_read(object, member, type, NULL, rv); } -static void row_prop_write(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) +static void row_prop_write(zval *object, zval *member, zval *value, void **cache_slot) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "This PDORow is not from a writable result set"); + php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set"); } -static void row_dim_write(zval *object, zval *member, zval *value TSRMLS_DC) +static void row_dim_write(zval *object, zval *member, zval *value) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "This PDORow is not from a writable result set"); + php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set"); } -static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot TSRMLS_DC) +static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot) { pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); pdo_stmt_t *stmt = row->stmt; @@ -2572,22 +2571,22 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c return 0; } -static int row_dim_exists(zval *object, zval *member, int check_empty TSRMLS_DC) +static int row_dim_exists(zval *object, zval *member, int check_empty) { - return row_prop_exists(object, member, check_empty, NULL TSRMLS_CC); + return row_prop_exists(object, member, check_empty, NULL); } -static void row_prop_delete(zval *object, zval *offset, void **cache_slot TSRMLS_DC) +static void row_prop_delete(zval *object, zval *offset, void **cache_slot) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete properties from a PDORow"); + php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow"); } -static void row_dim_delete(zval *object, zval *offset TSRMLS_DC) +static void row_dim_delete(zval *object, zval *offset) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot delete properties from a PDORow"); + php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow"); } -static HashTable *row_get_properties(zval *object TSRMLS_DC) +static HashTable *row_get_properties(zval *object) { pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object); pdo_stmt_t *stmt = row->stmt; @@ -2602,7 +2601,7 @@ static HashTable *row_get_properties(zval *object TSRMLS_DC) } for (i = 0; i < stmt->column_count; i++) { zval val; - fetch_value(stmt, &val, i, NULL TSRMLS_CC); + fetch_value(stmt, &val, i, NULL); zend_hash_str_update(stmt->std.properties, stmt->columns[i].name, stmt->columns[i].namelen, &val); } @@ -2612,7 +2611,7 @@ static HashTable *row_get_properties(zval *object TSRMLS_DC) static union _zend_function *row_method_get( zend_object **object_pp, - zend_string *method_name, const zval *key TSRMLS_DC) + zend_string *method_name, const zval *key) { zend_function *fbc; zend_string *lc_method_name; @@ -2634,7 +2633,7 @@ static int row_call_method(zend_string *method, zend_object *object, INTERNAL_FU return FAILURE; } -static union _zend_function *row_get_ctor(zend_object *object TSRMLS_DC) +static union _zend_function *row_get_ctor(zend_object *object) { static zend_internal_function ctor = {0}; @@ -2647,12 +2646,12 @@ static union _zend_function *row_get_ctor(zend_object *object TSRMLS_DC) return (union _zend_function*)&ctor; } -static zend_string *row_get_classname(const zend_object *object TSRMLS_DC) +static zend_string *row_get_classname(const zend_object *object) { return zend_string_init("PDORow", sizeof("PDORow") - 1, 0); } -static int row_compare(zval *object1, zval *object2 TSRMLS_DC) +static int row_compare(zval *object1, zval *object2) { return -1; } @@ -2683,7 +2682,7 @@ zend_object_handlers pdo_row_object_handlers = { NULL }; -void pdo_row_free_storage(zend_object *std TSRMLS_DC) +void pdo_row_free_storage(zend_object *std) { pdo_row_t *row = (pdo_row_t *)std; if (row->stmt) { @@ -2692,18 +2691,18 @@ void pdo_row_free_storage(zend_object *std TSRMLS_DC) } } -zend_object *pdo_row_new(zend_class_entry *ce TSRMLS_DC) +zend_object *pdo_row_new(zend_class_entry *ce) { pdo_row_t *row = ecalloc(1, sizeof(pdo_row_t)); - zend_object_std_init(&row->std, ce TSRMLS_CC); + zend_object_std_init(&row->std, ce); row->std.handlers = &pdo_row_object_handlers; return &row->std; } -static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data TSRMLS_DC) +static int pdo_row_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "PDORow instances may not be serialized"); + php_error_docref(NULL, E_WARNING, "PDORow instances may not be serialized"); return FAILURE; } /* }}} */ diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h index ce5b3a229d..956f7544e2 100644 --- a/ext/pdo/php_pdo.h +++ b/ext/pdo/php_pdo.h @@ -59,20 +59,20 @@ ZEND_END_MODULE_GLOBALS(pdo) #endif #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \ - zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); + zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value); #define REGISTER_PDO_CONST_LONG(const_name, value) { \ zend_class_entry **pce; \ if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \ - zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (zend_long)value TSRMLS_CC); \ + zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (zend_long)value); \ } \ #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \ - zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC); + zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1); #define PDO_CONSTRUCT_CHECK \ if (!dbh->driver) { \ - pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called" TSRMLS_CC); \ + pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called"); \ return; \ } \ diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index de9780e226..6f2a01aa30 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -37,7 +37,7 @@ typedef unsigned __int64 pdo_uint64_t; typedef long long int pdo_int64_t; typedef unsigned long long int pdo_uint64_t; #endif -PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64 TSRMLS_DC); +PDO_API char *php_pdo_int64_to_str(pdo_int64_t i64); #ifndef TRUE # define TRUE 1 @@ -194,7 +194,7 @@ enum pdo_null_handling { }; /* {{{ utils for reading attributes set as driver_options */ -static inline zend_long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, zend_long defval TSRMLS_DC) +static inline zend_long pdo_attr_lval(zval *options, enum pdo_attribute_type option_name, zend_long defval) { zval *v; @@ -204,7 +204,7 @@ static inline zend_long pdo_attr_lval(zval *options, enum pdo_attribute_type opt } return defval; } -static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type option_name, char *defval TSRMLS_DC) +static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type option_name, char *defval) { zval *v; @@ -234,33 +234,33 @@ typedef struct { * data in the db, otherwise you will crash PHP when persistent connections * are used. */ - int (*db_handle_factory)(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC); + int (*db_handle_factory)(pdo_dbh_t *dbh, zval *driver_options); } pdo_driver_t; /* {{{ methods for a database handle */ /* close or otherwise disconnect the database */ -typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh TSRMLS_DC); +typedef int (*pdo_dbh_close_func)(pdo_dbh_t *dbh); /* prepare a statement and stash driver specific portion into stmt */ -typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options TSRMLS_DC); +typedef int (*pdo_dbh_prepare_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len, pdo_stmt_t *stmt, zval *driver_options); /* execute a statement (that does not return a result set) */ -typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len TSRMLS_DC); +typedef zend_long (*pdo_dbh_do_func)(pdo_dbh_t *dbh, const char *sql, zend_long sql_len); /* quote a string */ -typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC); +typedef int (*pdo_dbh_quote_func)(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype); /* transaction related */ -typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh TSRMLS_DC); +typedef int (*pdo_dbh_txn_func)(pdo_dbh_t *dbh); /* setting of attributes */ -typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_set_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val); /* return last insert id. NULL indicates error condition, otherwise, the return value * MUST be an emalloc'd NULL terminated string. */ -typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC); +typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned int *len); /* fetch error information. if stmt is not null, fetch information pertaining * to the statement, otherwise fetch global error information. The driver @@ -268,20 +268,20 @@ typedef char *(*pdo_dbh_last_id_func)(pdo_dbh_t *dbh, const char *name, unsigned * - native error code * - string representation of the error code ... any other optional driver * specific data ... */ -typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC); +typedef int (*pdo_dbh_fetch_error_func)(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info); /* fetching of attributes */ -typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val TSRMLS_DC); +typedef int (*pdo_dbh_get_attr_func)(pdo_dbh_t *dbh, zend_long attr, zval *val); /* checking/pinging persistent connections; return SUCCESS if the connection * is still alive and ready to be used, FAILURE otherwise. * You may set this handler to NULL, which is equivalent to returning SUCCESS. */ -typedef int (*pdo_dbh_check_liveness_func)(pdo_dbh_t *dbh TSRMLS_DC); +typedef int (*pdo_dbh_check_liveness_func)(pdo_dbh_t *dbh); /* called at request end for each persistent dbh; this gives the driver * the opportunity to safely release resources that only have per-request * scope */ -typedef void (*pdo_dbh_request_shutdown)(pdo_dbh_t *dbh TSRMLS_DC); +typedef void (*pdo_dbh_request_shutdown)(pdo_dbh_t *dbh); /* for adding methods to the dbh or stmt objects pointer to a list of driver specific functions. The convention is @@ -295,7 +295,7 @@ enum { PDO_DBH_DRIVER_METHOD_KIND__MAX }; -typedef const zend_function_entry *(*pdo_dbh_get_driver_methods_func)(pdo_dbh_t *dbh, int kind TSRMLS_DC); +typedef const zend_function_entry *(*pdo_dbh_get_driver_methods_func)(pdo_dbh_t *dbh, int kind); struct pdo_dbh_methods { pdo_dbh_close_func closer; @@ -320,20 +320,20 @@ struct pdo_dbh_methods { /* {{{ methods for a statement handle */ /* free the statement handle */ -typedef int (*pdo_stmt_dtor_func)(pdo_stmt_t *stmt TSRMLS_DC); +typedef int (*pdo_stmt_dtor_func)(pdo_stmt_t *stmt); /* start the query */ -typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt TSRMLS_DC); +typedef int (*pdo_stmt_execute_func)(pdo_stmt_t *stmt); /* causes the next row in the set to be fetched; indicates if there are no * more rows. The ori and offset params modify which row should be returned, * if the stmt represents a scrollable cursor */ typedef int (*pdo_stmt_fetch_func)(pdo_stmt_t *stmt, - enum pdo_fetch_orientation ori, zend_long offset TSRMLS_DC); + enum pdo_fetch_orientation ori, zend_long offset); /* queries information about the type of a column, by index (0 based). * Driver should populate stmt->columns[colno] with appropriate info */ -typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC); +typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno); /* retrieves pointer and size of the value for a column. * Note that PDO expects the driver to manage the lifetime of this data; @@ -341,7 +341,7 @@ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC) * If the driver sets caller_frees, ptr should point to emalloc'd memory * and PDO will free it as soon as it is done using it. */ -typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees TSRMLS_DC); +typedef int (*pdo_stmt_get_col_data_func)(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees); /* hook for bound params */ enum pdo_param_event { @@ -354,13 +354,13 @@ enum pdo_param_event { PDO_PARAM_EVT_NORMALIZE }; -typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type TSRMLS_DC); +typedef int (*pdo_stmt_param_hook_func)(pdo_stmt_t *stmt, struct pdo_bound_param_data *param, enum pdo_param_event event_type); /* setting of attributes */ -typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_set_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val); /* fetching of attributes */ -typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_DC); +typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *val); /* retrieves meta data for a numbered column. * Returns SUCCESS/FAILURE. @@ -390,19 +390,19 @@ typedef int (*pdo_stmt_get_attr_func)(pdo_stmt_t *stmt, zend_long attr, zval *va * or * 'flags' => array('not_null', 'mysql:some_flag'); // to add data to an existing key */ -typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, zend_long colno, zval *return_value TSRMLS_DC); +typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, zend_long colno, zval *return_value); /* advances the statement to the next rowset of the batch. * If it returns 1, PDO will tear down its idea of columns * and meta data. If it returns 0, PDO will indicate an error * to the caller. */ -typedef int (*pdo_stmt_next_rowset_func)(pdo_stmt_t *stmt TSRMLS_DC); +typedef int (*pdo_stmt_next_rowset_func)(pdo_stmt_t *stmt); /* closes the active cursor on a statement, leaving the prepared * statement ready for re-execution. Useful to explicitly state * that you are done with a given rowset, without having to explicitly * fetch all the rows. */ -typedef int (*pdo_stmt_cursor_closer_func)(pdo_stmt_t *stmt TSRMLS_DC); +typedef int (*pdo_stmt_cursor_closer_func)(pdo_stmt_t *stmt); struct pdo_stmt_methods { pdo_stmt_dtor_func dtor; @@ -679,16 +679,16 @@ PDO_API zend_class_entry *php_pdo_get_dbh_ce(void); PDO_API zend_class_entry *php_pdo_get_exception(void); PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, - char **outquery, int *outquery_len TSRMLS_DC); + char **outquery, int *outquery_len); PDO_API void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, - const char *sqlstate, const char *supp TSRMLS_DC); + const char *sqlstate, const char *supp); -PDO_API void php_pdo_dbh_addref(pdo_dbh_t *dbh TSRMLS_DC); -PDO_API void php_pdo_dbh_delref(pdo_dbh_t *dbh TSRMLS_DC); +PDO_API void php_pdo_dbh_addref(pdo_dbh_t *dbh); +PDO_API void php_pdo_dbh_delref(pdo_dbh_t *dbh); -PDO_API void php_pdo_stmt_addref(pdo_stmt_t *stmt TSRMLS_DC); -PDO_API void php_pdo_stmt_delref(pdo_stmt_t *stmt TSRMLS_DC); +PDO_API void php_pdo_stmt_addref(pdo_stmt_t *stmt); +PDO_API void php_pdo_stmt_delref(pdo_stmt_t *stmt); #endif /* PHP_PDO_DRIVER_H */ diff --git a/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h index e89a2b8811..5320f54e2d 100644 --- a/ext/pdo/php_pdo_error.h +++ b/ext/pdo/php_pdo_error.h @@ -23,7 +23,7 @@ #include "php_pdo_driver.h" -PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC); +PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt); #define PDO_DBH_CLEAR_ERR() do { \ strlcpy(dbh->error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \ @@ -33,8 +33,8 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC); } \ } while (0) #define PDO_STMT_CLEAR_ERR() strcpy(stmt->error_code, PDO_ERR_NONE) -#define PDO_HANDLE_DBH_ERR() if (strcmp(dbh->error_code, PDO_ERR_NONE)) { pdo_handle_error(dbh, NULL TSRMLS_CC); } -#define PDO_HANDLE_STMT_ERR() if (strcmp(stmt->error_code, PDO_ERR_NONE)) { pdo_handle_error(stmt->dbh, stmt TSRMLS_CC); } +#define PDO_HANDLE_DBH_ERR() if (strcmp(dbh->error_code, PDO_ERR_NONE)) { pdo_handle_error(dbh, NULL); } +#define PDO_HANDLE_STMT_ERR() if (strcmp(stmt->error_code, PDO_ERR_NONE)) { pdo_handle_error(stmt->dbh, stmt); } #endif /* PHP_PDO_ERROR_H */ /* diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h index 23de705ec1..faade8d248 100644 --- a/ext/pdo/php_pdo_int.h +++ b/ext/pdo/php_pdo_int.h @@ -27,40 +27,40 @@ extern HashTable pdo_driver_hash; extern zend_class_entry *pdo_exception_ce; -PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC); +PDO_API zend_class_entry *php_pdo_get_exception_base(int root); int php_pdo_list_entry(void); -void pdo_dbh_init(TSRMLS_D); -void pdo_stmt_init(TSRMLS_D); +void pdo_dbh_init(void); +void pdo_stmt_init(void); -extern zend_object *pdo_dbh_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object *pdo_dbh_new(zend_class_entry *ce); extern const zend_function_entry pdo_dbh_functions[]; extern zend_class_entry *pdo_dbh_ce; extern ZEND_RSRC_DTOR_FUNC(php_pdo_pdbh_dtor); -extern zend_object *pdo_dbstmt_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object *pdo_dbstmt_new(zend_class_entry *ce); extern const zend_function_entry pdo_dbstmt_functions[]; extern zend_class_entry *pdo_dbstmt_ce; -void pdo_dbstmt_free_storage(zend_object *std TSRMLS_DC); -zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC); +void pdo_dbstmt_free_storage(zend_object *std); +zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int by_ref); extern zend_object_handlers pdo_dbstmt_object_handlers; -int pdo_stmt_describe_columns(pdo_stmt_t *stmt TSRMLS_DC); +int pdo_stmt_describe_columns(pdo_stmt_t *stmt); int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip_first_arg); -extern zend_object *pdo_row_new(zend_class_entry *ce TSRMLS_DC); +extern zend_object *pdo_row_new(zend_class_entry *ce); extern const zend_function_entry pdo_row_functions[]; extern zend_class_entry *pdo_row_ce; -void pdo_row_free_storage(zend_object *std TSRMLS_DC); +void pdo_row_free_storage(zend_object *std); extern zend_object_handlers pdo_row_object_handlers; -zend_object_iterator *php_pdo_dbstmt_iter_get(zend_class_entry *ce, zval *object TSRMLS_DC); +zend_object_iterator *php_pdo_dbstmt_iter_get(zend_class_entry *ce, zval *object); extern pdo_driver_t *pdo_find_driver(const char *name, int namelen); int pdo_sqlstate_init_error_table(void); void pdo_sqlstate_fini_error_table(void); const char *pdo_sqlstate_state_to_description(char *state); -int pdo_hash_methods(pdo_dbh_object_t *dbh, int kind TSRMLS_DC); +int pdo_hash_methods(pdo_dbh_object_t *dbh, int kind); /* |