37#define PHP_STMT_GET_OBJ \
38 pdo_stmt_t *stmt = Z_PDO_STMT_P(ZEND_THIS); \
40 zend_throw_error(NULL, "%s object is uninitialized", ZSTR_VAL(Z_OBJ(EX(This))->ce->name)); \
63 param->
name = zend_string_copy(
name);
72 if (!zend_string_equals(
name, param->
name)) {
78 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");
95 bool ret = 1, is_param = 1;
145 zend_string_release(orig_name);
210 pdo_stmt_reset_columns(stmt);
228static void param_dtor(
zval *el)
311 spprintf(&tmp, 0,
"Did not find column name '%s' in the defined columns; it will not be bound",
ZSTR_VAL(param->
name));
328 if (
is_param && !rewrite_name_to_position(
stmt, param)) {
412 memset(¶m, 0,
sizeof(param));
427 if (!really_register_bound_param(¶m,
stmt, 1)) {
454 }
else if (
ret == -1) {
506 zval_ptr_dtor_str(dest);
513 type_override = &pdo_param_str;
517 switch (*type_override) {
528 zval_ptr_dtor_nogc(dest);
535 zval_ptr_dtor_nogc(dest);
552 zval_ptr_dtor_str(dest);
653 char *is_callable_error =
NULL;
656 if (is_callable_error) {
658 efree(is_callable_error);
664 if (is_callable_error) {
666 efree(is_callable_error);
690static void do_fetch_opt_finish(
pdo_stmt_t *
stmt,
int free_ctor_agrs)
720 int flags, idx, old_arg_count = 0;
722 zval grp_val, *pgrp,
retval, old_ctor_args = {{0}, {0}, {0}};
813 do_fetch_opt_finish(
stmt, 0);
817 if (!try_convert_to_string(&
val)) {
827 do_fetch_class_prepare(
stmt);
828 zval_ptr_dtor_str(&
val);
842 if (!do_fetch_class_prepare(
stmt)) {
888 if (!do_fetch_func_prepare(
stmt))
899 fetch_value(
stmt, &grp_val, colno,
NULL);
901 fetch_value(
stmt, &grp_val, i,
NULL);
1020 zend_value_error(
"Fetch mode must be a bitmask of PDO::FETCH_* constants");
1041 do_fetch_opt_finish(
stmt, 0);
1085 zval_ptr_dtor_str(&grp_val);
1111 zend_value_error(
"Can only use PDO::FETCH_FUNC in PDOStatement::fetchAll()");
1163 if (!pdo_stmt_verify_mode(
stmt, how, 1,
false)) {
1179 zval old_ctor_args, *ctor_args =
NULL;
1195 do_fetch_opt_finish(
stmt, 0);
1197 if (ctor_args && zend_hash_num_elements(
Z_ARRVAL_P(ctor_args))) {
1212 do_fetch_opt_finish(
stmt, 1);
1249 zval old_ctor_args, *ctor_args =
NULL;
1252 int flags, old_arg_count;
1262 if (!pdo_stmt_verify_mode(
stmt, how, 1,
true)) {
1274 do_fetch_opt_finish(
stmt, 0);
1295 if (ctor_args && zend_hash_num_elements(
Z_ARRVAL_P(ctor_args)) > 0) {
1307 do_fetch_class_prepare(
stmt);
1315 zend_string_release(
func);
1325 if (do_fetch_func_prepare(
stmt) ==
false) {
1335 zend_string_release(
func);
1361 zend_string_release(
func);
1398 do_fetch_opt_finish(
stmt, 0);
1400 zend_array_release(current_ctor);
1427 memset(¶m, 0,
sizeof(param));
1444 zend_argument_must_not_be_empty_error(1);
1448 }
else if (param.
paramno > 0) {
1451 zend_argument_value_error(1,
"must be greater than or equal to 1");
1460 if (!really_register_bound_param(¶m,
stmt,
is_param)) {
1478 memset(¶m, 0,
sizeof(param));
1496 }
else if (param.
paramno > 0) {
1504 if (!really_register_bound_param(¶m,
stmt,
TRUE)) {
1557 int error_count_diff = 0;
1558 int error_expected_count = 3;
1574 if (error_expected_count > error_count) {
1577 error_count_diff = error_expected_count - error_count;
1578 for (current_index = 0; current_index < error_count_diff; current_index++) {
1639 "This driver doesn't support getting attributes");
1655 "driver doesn't support getting that attribute");
1714 zval *
args, uint32_t variadic_num_args)
1717 uint32_t arg1_arg_num = mode_arg_num + 1;
1718 uint32_t constructor_arg_num = mode_arg_num + 2;
1719 uint32_t total_num_args = mode_arg_num + variadic_num_args;
1736 if (!pdo_stmt_verify_mode(stmt,
mode, mode_arg_num,
false)) {
1750 if (variadic_num_args != 0) {
1754 zend_string_release(
func);
1760 if (variadic_num_args != 1) {
1764 zend_string_release(
func);
1784 if (variadic_num_args != 0) {
1788 zend_string_release(
func);
1794 if (variadic_num_args == 0) {
1798 zend_string_release(
func);
1802 if (variadic_num_args > 2) {
1806 zend_string_release(
func);
1820 if (variadic_num_args == 2) {
1833 if (constructor_args) {
1838 do_fetch_class_prepare(stmt);
1842 if (total_num_args != arg1_arg_num) {
1846 zend_string_release(
func);
1878 do_fetch_opt_finish(stmt, 1);
1891static bool pdo_stmt_do_next_rowset(
pdo_stmt_t *stmt)
1893 pdo_stmt_reset_columns(stmt);
1918 if (!pdo_stmt_do_next_rowset(stmt)) {
1942 if (!pdo_stmt_do_next_rowset(stmt)) {
2008 "name=[%zd] \"%.*s\"\n"
2060 lc_method_name = zend_string_tolower(method_name);
2062 if ((
fbc = zend_hash_find_ptr(&
object->ce->function_table, lc_method_name)) ==
NULL) {
2099 zend_get_gc_buffer_use(gc_buffer, gc_data, gc_count);
2105 if (
object->properties ==
NULL &&
object->ce->default_properties_count <= 1) {
2143 pdo_stmt_reset_columns(
stmt);
2150 do_fetch_opt_finish(
stmt, 1);
2211 return &
I->fetch_ahead;
2249 pdo_stmt_iter_valid,
2250 pdo_stmt_iter_get_data,
2251 pdo_stmt_iter_get_key,
2252 pdo_stmt_iter_move_forwards,
2273 I->iter.funcs = &pdo_stmt_iter_funcs;
2293 for (
int colno = 0; colno < stmt->
column_count; colno++) {
2295 fetch_value(stmt,
rv, colno,
NULL);
2304 if (column >= 0 && column < stmt->column_count) {
2305 fetch_value(stmt,
rv, column,
NULL);
2323 retval = row_read_column_number(stmt, lval,
rv);
2396 retval = row_read_column_number(stmt, lval, &tmp_val);
2398 retval = row_read_column_name(stmt,
name, &tmp_val);
2406 zval_ptr_dtor_nogc(
retval);
2426 zval *
retval = row_read_column_number(stmt, column, &tmp_val);
2432 zval_ptr_dtor_nogc(
retval);
2439 int result = row_prop_exists(
object, member, check_empty,
NULL);
2474 fetch_value(stmt, &
val, i,
NULL);
2494 cache_slot[0] = cache_slot[1] = cache_slot[2] =
NULL;
memset(ptr, 0, type->size)
hash(string $algo, string $data, bool $binary=false, array $options=[])
foreach($dp as $el) foreach( $dp as $el) if( $pass2< 2) echo ""
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
zend_class_entry * pdo_row_ce
zend_class_entry * pdo_dbstmt_ce
PDO_API zend_class_entry * php_pdo_get_exception(void)
void pdo_raise_impl_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, pdo_error_type sqlstate, const char *supp)
bool pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
void pdo_row_free_storage(zend_object *std)
zend_object_handlers pdo_dbstmt_object_handlers
zend_object_handlers pdo_row_object_handlers
zend_object * pdo_row_new(zend_class_entry *ce)
zend_object_iterator * pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int by_ref)
bool pdo_stmt_describe_columns(pdo_stmt_t *stmt)
PDO_API void php_pdo_stmt_set_column_count(pdo_stmt_t *stmt, int new_count)
bool pdo_stmt_setup_fetch_mode(pdo_stmt_t *stmt, zend_long mode, uint32_t mode_arg_num, zval *args, uint32_t variadic_num_args)
zend_object * pdo_dbstmt_new(zend_class_entry *ce)
PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt)
void pdo_dbstmt_free_storage(zend_object *std)
#define php_stream_memory_open(mode, str)
#define TEMP_STREAM_READONLY
PDO_API int pdo_parse_params(pdo_stmt_t *stmt, zend_string *inquery, zend_string **outquery)
#define PDO_FETCH_SERIALIZE
#define PDO_FETCH_CLASSTYPE
#define PDO_FETCH_PROPS_LATE
struct _pdo_stmt_t pdo_stmt_t
struct _pdo_row_t pdo_row_t
@ PDO_PARAM_EVT_FETCH_POST
@ PDO_PARAM_EVT_NORMALIZE
@ PDO_PARAM_EVT_FETCH_PRE
@ PDO_PARAM_EVT_EXEC_POST
@ PDO_DBH_DRIVER_METHOD_KIND_STMT
#define PDO_PARAM_TYPE(x)
#define Z_PDO_OBJECT_P(zv)
@ PDO_ATTR_EMULATE_PREPARES
#define PDO_STMT_CLEAR_ERR()
#define PDO_HANDLE_STMT_ERR()
unsigned char key[REFLECTION_KEY_LEN]
struct _php_stream php_stream
#define PHP_STREAM_COPY_ALL
#define php_stream_to_zval(stream, zval)
#define php_stream_printf
#define php_stream_close(stream)
#define php_stream_copy_to_mem(src, maxlen, persistent)
#define php_stream_open_wrapper(path, mode, options, opened)
#define php_stream_from_zval_no_verify(xstr, pzval)
#define php_stream_write(stream, buf, count)
HashTable * cls_methods[PDO_DBH_DRIVER_METHOD_KIND__MAX]
enum pdo_case_conversion native_case desired_case
unsigned alloc_own_columns
const struct pdo_dbh_methods * methods
const char * named_rewrite_template
zend_string * active_query_string
zend_string * query_string
struct _pdo_stmt_t::@000166265162112000164105002261207304326156154222::@025212024050336036211311351177267270061100211054 func
unsigned supports_placeholders
pdo_error_type error_code
const struct pdo_stmt_methods * methods
struct pdo_column_data * columns
struct _pdo_stmt_t::@000166265162112000164105002261207304326156154222::@331145212346317037010055150102225036053125106064 cls
zend_fcall_info_cache fcc
enum pdo_fetch_type default_fetch_type
zval database_object_handle
union _pdo_stmt_t::@000166265162112000164105002261207304326156154222 fetch
HashTable * bound_param_map
HashTable * bound_columns
zend_function * constructor
int(* unserialize)(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data)
zend_function * function_handler
zend_class_entry * called_scope
enum pdo_param_type param_type
pdo_dbh_fetch_error_func fetch_err
pdo_stmt_param_hook_func param_hook
pdo_stmt_fetch_func fetcher
pdo_stmt_cursor_closer_func cursor_closer
pdo_stmt_next_rowset_func next_rowset
pdo_stmt_get_col_data_func get_col
pdo_stmt_get_attr_func get_attribute
pdo_stmt_execute_func executer
pdo_stmt_describe_col_func describer
pdo_stmt_get_column_meta_func get_column_meta
pdo_stmt_set_attr_func set_attribute
zend_object_iterator iter
ZEND_API ZEND_COLD void zend_argument_count_error(const char *format,...)
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format,...)
ZEND_API zend_class_entry * zend_standard_class_def
ZEND_API ZEND_COLD void zend_type_error(const char *format,...)
ZEND_API ZEND_COLD void zend_value_error(const char *format,...)
#define INTERNAL_FUNCTION_PARAMETERS
#define ZEND_STANDARD_CLASS_DEF_PTR
#define INTERNAL_FUNCTION_PARAM_PASSTHRU
ZEND_API zend_result add_next_index_null(zval *arg)
ZEND_API const char * zend_zval_value_name(const zval *arg)
ZEND_API zend_result object_init_ex(zval *arg, zend_class_entry *class_type)
ZEND_API zend_result zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error)
ZEND_API zend_result zend_fcall_info_args_ex(zend_fcall_info *fci, zend_function *func, zval *args)
ZEND_API void zend_fcall_info_args_clear(zend_fcall_info *fci, bool free_mem)
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec,...)
ZEND_API void object_properties_init(zend_object *object, zend_class_entry *class_type)
ZEND_API ZEND_COLD void zend_argument_must_not_be_empty_error(uint32_t arg_num)
ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *format,...)
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format,...)
ZEND_API void zend_update_property_ex(zend_class_entry *scope, zend_object *object, zend_string *name, zval *value)
ZEND_API zend_result add_next_index_string(zval *arg, const char *str)
struct _zend_fcall_info_cache zend_fcall_info_cache
#define Z_PARAM_ARRAY_OR_NULL(dest)
#define Z_PARAM_CLASS_OR_NULL(dest)
#define ZEND_PARSE_PARAMETERS_END()
#define ZEND_PARSE_PARAMETERS_NONE()
#define array_init_size(arg, size)
#define zend_parse_parameters_none()
#define ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args)
#define Z_PARAM_LONG(dest)
struct _zend_fcall_info zend_fcall_info
#define Z_PARAM_STR_OR_LONG(dest_str, dest_long)
#define Z_PARAM_ARRAY(dest)
#define Z_PARAM_ZVAL_OR_NULL(dest)
#define Z_PARAM_ZVAL(dest)
ZEND_API zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache)
#define ZVAL_EMPTY_STRING(z)
#define ecalloc(nmemb, size)
#define FREE_HASHTABLE(ht)
#define safe_emalloc(nmemb, size, offset)
#define ALLOC_HASHTABLE(ht)
strncmp(string $string1, string $string2, int $length)
zend_string_release_ex(func->internal_function.function_name, 0)
#define ZEND_FETCH_CLASS_AUTO
#define OBJ_PROP_NUM(obj, num)
ZEND_API ZEND_COLD zend_object * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format,...)
ZEND_API zend_class_entry * zend_lookup_class(zend_string *name)
ZEND_API zend_class_entry * zend_fetch_class(zend_string *class_name, uint32_t fetch_type)
ZEND_API zend_string * get_active_function_or_method_name(void)
union _zend_function zend_function
ZEND_API zend_get_gc_buffer * zend_get_gc_buffer_create(void)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert_new(HashTable *ht, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_add(HashTable *ht, zend_ulong h, zval *pData)
ZEND_API zval *ZEND_FASTCALL zend_hash_next_index_insert(HashTable *ht, zval *pData)
ZEND_API zend_result ZEND_FASTCALL zend_hash_index_del(HashTable *ht, zend_ulong h)
ZEND_API zval *ZEND_FASTCALL zend_hash_index_update(HashTable *ht, zend_ulong h, zval *pData)
ZEND_API HashTable *ZEND_FASTCALL zend_array_dup(HashTable *source)
ZEND_API zval *ZEND_FASTCALL zend_hash_update(HashTable *ht, zend_string *key, zval *pData)
ZEND_API zend_result ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key)
ZEND_API zval *ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key)
#define zend_hash_init(ht, nSize, pHashFunction, pDestructor, persistent)
#define ZEND_HASH_FOREACH_PTR(ht, _ptr)
#define ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _val)
#define ZEND_HASH_FOREACH_END()
#define ZEND_HASH_FOREACH_KEY_PTR(ht, _h, _key, _ptr)
ZEND_API zend_class_entry * zend_ce_aggregate
ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj)
ZEND_API void zend_iterator_init(zend_object_iterator *iter)
struct _zend_object_iterator zend_object_iterator
struct _zend_object_iterator_funcs zend_object_iterator_funcs
struct _zend_string zend_string
ZEND_API zend_function * zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key)
ZEND_API int zend_objects_not_comparable(zval *o1, zval *o2)
ZEND_API HashTable * zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose)
ZEND_API HashTable * zend_std_get_properties(zend_object *zobj)
ZEND_API const zend_object_handlers std_object_handlers
ZEND_API zval * zend_std_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot)
ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void **cache_slot)
ZEND_API zval * zend_std_read_property(zend_object *zobj, zend_string *name, int type, void **cache_slot, zval *rv)
enum _zend_prop_purpose zend_prop_purpose
@ ZEND_PROP_PURPOSE_DEBUG
ZEND_API void ZEND_FASTCALL zend_object_std_init(zend_object *object, zend_class_entry *ce)
ZEND_API void zend_object_std_dtor(zend_object *object)
ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op)
ZEND_API uint8_t ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval)
ZEND_API void ZEND_FASTCALL convert_to_null(zval *op)
ZEND_API void ZEND_FASTCALL convert_to_long(zval *op)
#define convert_to_string(op)
#define ZEND_IGNORE_VALUE(x)
#define XtOffsetOf(s_type, field)
#define EMPTY_SWITCH_DEFAULT_CASE()
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
#define zend_string_equals_literal(str, literal)
#define Z_ISUNDEF_P(zval_p)
#define Z_ARRVAL_P(zval_p)
struct _zend_array HashTable
#define Z_ISNULL_P(zval_p)
#define Z_REFCOUNTED(zval)
#define Z_STRLEN_P(zval_p)
#define Z_TYPE_INFO(zval)
ZEND_RESULT_CODE zend_result
struct _zend_object_handlers zend_object_handlers
#define ZVAL_INTERNED_STR(z, s)
#define ZVAL_COPY_VALUE(z, v)
ZEND_API void zval_ptr_dtor(zval *zval_ptr)