这篇教程C++ zend_hash_get_current_data_ex函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_get_current_data_ex函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_get_current_data_ex函数的具体用法?C++ zend_hash_get_current_data_ex怎么用?C++ zend_hash_get_current_data_ex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_get_current_data_ex函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PHP_METHODPHP_METHOD(Test_Flow, testFor24) { HashTable *_3; HashPosition _2; zval *_0; zval *b; zval *a = NULL, *_1, **_4; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(b); ZVAL_EMPTY_STRING(b); ZEPHIR_INIT_VAR(_0); array_init_size(_0, 6); ZEPHIR_INIT_VAR(_1); ZVAL_LONG(_1, 'a'); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 'b'); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 'c'); zephir_array_fast_append(_0, _1); ZEPHIR_INIT_BNVAR(_1); ZVAL_LONG(_1, 'd'); zephir_array_fast_append(_0, _1); zephir_is_iterable(_0, &_3, &_2, 0, 0); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(a, _4); zephir_concat_self(&b, a TSRMLS_CC); } RETURN_CTOR(b);}
开发者ID:hobbit19,项目名称:zephir,代码行数:37,
示例2: MAKE_STD_ZVALstatic zval *phannot_ret_zval_list(zval *list_left, zval *right_list){ zval *ret; HashPosition pos; HashTable *list; MAKE_STD_ZVAL(ret); array_init(ret); if (list_left) { list = Z_ARRVAL_P(list_left); if (zend_hash_index_exists(list, 0)) { zend_hash_internal_pointer_reset_ex(list, &pos); for (;; zend_hash_move_forward_ex(list, &pos)) { zval ** item; if (zend_hash_get_current_data_ex(list, (void**) &item, &pos) == FAILURE) { break; } Z_ADDREF_PP(item); add_next_index_zval(ret, *item); } zval_ptr_dtor(&list_left); } else { add_next_index_zval(ret, list_left); } } add_next_index_zval(ret, right_list); return ret;}
开发者ID:Diego-Brocanelli,项目名称:cphalcon,代码行数:37,
示例3: PHP_METHOD/** * Restore a /Phalcon/Http/Response/Headers object */PHP_METHOD(Phalcon_Http_Response_Headers, __set_state) { HashTable *_1$$3; HashPosition _0$$3; zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *data_param = NULL, *headers = NULL, *key = NULL, *value = NULL, *dataHeaders = NULL, **_2$$3; zval *data = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &data_param); data = data_param; ZEPHIR_INIT_VAR(headers); object_init_ex(headers, phalcon_http_response_headers_ce); if (zephir_has_constructor(headers TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, headers, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_OBS_VAR(dataHeaders); if (zephir_array_isset_string_fetch(&dataHeaders, data, SS("_headers"), 0 TSRMLS_CC)) { zephir_is_iterable(dataHeaders, &_1$$3, &_0$$3, 0, 0, "phalcon/http/response/headers.zep", 126); for ( ; zend_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS ; zend_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HMKEY(key, _1$$3, _0$$3); ZEPHIR_GET_HVALUE(value, _2$$3); ZEPHIR_CALL_METHOD(NULL, headers, "set", &_3, 258, key, value); zephir_check_call_status(); } } RETURN_CCTOR(headers);}
开发者ID:adam-rocska,项目名称:cphalcon,代码行数:40,
示例4: PHP_METHOD/** * Sets the path for a domain * * <code> * // Set the directory path * $gettext->setDirectory("/path/to/the/messages"); * * // Set the domains and directories path * $gettext->setDirectory( * [ * "messages" => "/path/to/the/messages", * "another" => "/path/to/the/another", * ] * ); * </code> * * @param string|array directory The directory path or an array of directories and domains */PHP_METHOD(Phalcon_Translate_Adapter_Gettext, setDirectory) { HashTable *_1$$4; HashPosition _0$$4; zend_long ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *directory, *key = NULL, *value = NULL, **_2$$4, *_4$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &directory); if (ZEPHIR_IS_EMPTY(directory)) { RETURN_MM_NULL(); } zephir_update_property_this(getThis(), SL("_directory"), directory TSRMLS_CC); if (Z_TYPE_P(directory) == IS_ARRAY) { zephir_is_iterable(directory, &_1$$4, &_0$$4, 0, 0, "phalcon/translate/adapter/gettext.zep", 180); for ( ; zend_hash_get_current_data_ex(_1$$4, (void**) &_2$$4, &_0$$4) == SUCCESS ; zend_hash_move_forward_ex(_1$$4, &_0$$4) ) { ZEPHIR_GET_HMKEY(key, _1$$4, _0$$4); ZEPHIR_GET_HVALUE(value, _2$$4); ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 473, key, value); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(&_4$$6, this_ptr, "getdefaultdomain", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(NULL, "bindtextdomain", &_3, 473, _4$$6, directory); zephir_check_call_status(); } ZEPHIR_MM_RESTORE();}
开发者ID:luomor,项目名称:cphalcon,代码行数:55,
示例5: PHP_METHOD/** * Check if HTTP method match any of the passed methods * * @param string|array $methods * @return boolean */PHP_METHOD(Phalcon_Http_Request, isMethod){ zval *methods, *http_method, *is_equals, *method = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &methods); PHALCON_INIT_VAR(http_method); phalcon_call_method(http_method, this_ptr, "getmethod"); if (Z_TYPE_P(methods) == IS_STRING) { PHALCON_INIT_VAR(is_equals); is_equal_function(is_equals, methods, http_method TSRMLS_CC); RETURN_NCTOR(is_equals); } else { phalcon_is_iterable(methods, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(method); if (PHALCON_IS_EQUAL(method, http_method)) { RETURN_MM_TRUE; } zend_hash_move_forward_ex(ah0, &hp0); } } RETURN_MM_FALSE;}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:43,
示例6: PHP_METHODPHP_METHOD(Test_Flow, testFor2) { HashTable *_2; HashPosition _1; double c; zval *v = NULL, *k = NULL, *b, *_0, **_3; ZEPHIR_MM_GROW(); c = (double) (0); ZEPHIR_INIT_VAR(b); array_init_size(b, 5); ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, 1); zephir_array_fast_append(b, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 2); zephir_array_fast_append(b, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 3); zephir_array_fast_append(b, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_LONG(_0, 4); zephir_array_fast_append(b, _0); zephir_is_iterable(b, &_2, &_1, 0, 0); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(k, _2, _1); ZEPHIR_GET_HVALUE(v, _3); c += zephir_get_numberval(k); } RETURN_MM_DOUBLE(c);}
开发者ID:azrulharis,项目名称:zephir,代码行数:36,
示例7: PHP_METHOD/** * Returns the paths using positions as keys and names as values * * @return array */PHP_METHOD(Test_Router_Route, getReversedPaths) { HashTable *_2; HashPosition _1; zval *reversed, *path = NULL, *position = NULL, *_0, **_3; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(reversed); array_init(reversed); ZEPHIR_OBS_VAR(_0); zephir_read_property_this(&_0, this_ptr, SL("_paths"), PH_NOISY_CC); zephir_is_iterable(_0, &_2, &_1, 0, 0); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(path, _2, _1); ZEPHIR_GET_HVALUE(position, _3); zephir_array_update_zval(&reversed, position, &path, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(reversed);}
开发者ID:kissthink,项目名称:zephir,代码行数:29,
示例8: PHP_METHOD/** * Starts every backend * * @param int|string $keyName * @param long $lifetime * @return mixed */PHP_METHOD(Phalcon_Cache_Multiple, start){ zval *key_name, *lifetime = NULL, *backends, *backend = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &key_name, &lifetime) == FAILURE) { RETURN_MM_NULL(); } if (!lifetime) { PHALCON_INIT_VAR(lifetime); } PHALCON_OBS_VAR(backends); phalcon_read_property(&backends, this_ptr, SL("_backends"), PH_NOISY_CC); if (!phalcon_is_iterable(backends, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_FOREACH_VALUE(backend); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(backend, "start", key_name, lifetime); zend_hash_move_forward_ex(ah0, &hp0); } PHALCON_MM_RESTORE();}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:43,
示例9: validate_thrift_object//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.staticvoid validate_thrift_object(zval* object) { zend_class_entry* object_class_entry = Z_OBJCE_P(object); zval* is_validate = zend_read_static_property(object_class_entry, "isValidate", sizeof("isValidate")-1, false); zval* spec = zend_read_static_property(object_class_entry, "_TSPEC", sizeof("_TSPEC")-1, false); HashPosition key_ptr; zval* val_ptr; if (Z_TYPE_INFO_P(is_validate) == IS_TRUE) { for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(spec), &key_ptr); (val_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(spec), &key_ptr)) != nullptr; zend_hash_move_forward_ex(Z_ARRVAL_P(spec), &key_ptr)) { zend_ulong fieldno; if (zend_hash_get_current_key_ex(Z_ARRVAL_P(spec), nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) { throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA); return; } HashTable* fieldspec = Z_ARRVAL_P(val_ptr); // field name zval* zvarname = zend_hash_str_find(fieldspec, "var", sizeof("var")-1); char* varname = Z_STRVAL_P(zvarname); zval* is_required = zend_hash_str_find(fieldspec, "isRequired", sizeof("isRequired")-1); zval rv; zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv); if (Z_TYPE_INFO_P(is_required) == IS_TRUE && Z_TYPE_P(prop) == IS_NULL) { char errbuf[128]; snprintf(errbuf, 128, "Required field %s.%s is unset!", ZSTR_VAL(object_class_entry->name), varname); throw_tprotocolexception(errbuf, INVALID_DATA); } } }}
开发者ID:apupier,项目名称:fn,代码行数:37,
示例10: PHP_METHOD/** * Commmits active transactions within the manager * */PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, commit){ zval *transactions, *transaction = NULL, *connection = NULL; zval *is_under_transaction = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); PHALCON_OBS_VAR(transactions); phalcon_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); if (Z_TYPE_P(transactions) == IS_ARRAY) { phalcon_is_iterable(transactions, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(transaction); PHALCON_INIT_NVAR(connection); phalcon_call_method(connection, transaction, "getconnection"); PHALCON_INIT_NVAR(is_under_transaction); phalcon_call_method(is_under_transaction, connection, "isundertransaction"); if (zend_is_true(is_under_transaction)) { phalcon_call_method_noret(connection, "commit"); } zend_hash_move_forward_ex(ah0, &hp0); } } PHALCON_MM_RESTORE();}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:40,
示例11: PHP_METHOD/** * Prints the messages in the session flasher * * @param string $type * @param boolean $remove */PHP_METHOD(Phalcon_Flash_Session, output){ zval *remove = NULL, *messages, *message = NULL, *type = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 0, 1, &remove); if (!remove) { PHALCON_INIT_VAR(remove); ZVAL_BOOL(remove, 1); } PHALCON_INIT_VAR(messages); phalcon_call_method_p1(messages, this_ptr, "_getsessionmessages", remove); if (Z_TYPE_P(messages) == IS_ARRAY) { phalcon_is_iterable(messages, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(type, ah0, hp0); PHALCON_GET_HVALUE(message); phalcon_call_method_p2_noret(this_ptr, "outputmessage", type, message); zend_hash_move_forward_ex(ah0, &hp0); } } PHALCON_MM_RESTORE();}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:42,
示例12: PHP_METHOD/** * Sets a global formatter * * @param Phalcon/Logger/FormatterInterface $formatter */PHP_METHOD(Phalcon_Logger_Multiple, setFormatter){ zval *formatter, *loggers, *logger = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &formatter) == FAILURE) { RETURN_MM_NULL(); } PHALCON_OBS_VAR(loggers); phalcon_read_property_this(&loggers, this_ptr, SL("_loggers"), PH_NOISY_CC); if (Z_TYPE_P(loggers) == IS_ARRAY) { if (!phalcon_is_iterable(loggers, &ah0, &hp0, 0, 0 TSRMLS_CC)) { return; } while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_FOREACH_VALUE(logger); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(logger, "setformatter", formatter); zend_hash_move_forward_ex(ah0, &hp0); } } phalcon_update_property_this(this_ptr, SL("_formatter"), formatter TSRMLS_CC); PHALCON_MM_RESTORE();}
开发者ID:101010111100,项目名称:cphalcon,代码行数:41,
示例13: PHP_METHOD/** * Validate a set of data according to a set of rules * * @param array|object $data * @param object $entity * @return Phalcon/Validation/Message/Group */PHP_METHOD(Phalcon_Validation, validate){ zval *data = NULL, *entity = NULL, *validators, *messages = NULL, *status = NULL; zval *cancel_on_fail, *scope = NULL, *attribute = NULL, *validator = NULL; zval *must_cancel = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 0, 2, &data, &entity); if (!data) { PHALCON_INIT_VAR(data); } if (!entity) { PHALCON_INIT_VAR(entity); } PHALCON_OBS_VAR(validators); phalcon_read_property_this(&validators, this_ptr, SL("_validators"), PH_NOISY_CC); if (Z_TYPE_P(validators) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STR(phalcon_validation_exception_ce, "There are no validators to validate"); return; } /** * Clear pre-calculated values */ phalcon_update_property_null(this_ptr, SL("_values") TSRMLS_CC); /** * Implicitly creates a Phalcon/Validation/Message/Group object */ PHALCON_INIT_VAR(messages); object_init_ex(messages, phalcon_validation_message_group_ce); phalcon_call_method_noret(messages, "__construct"); /** * Validation classes can implement the 'beforeValidation' callback */ if (phalcon_method_exists_ex(this_ptr, SS("beforevalidation") TSRMLS_CC) == SUCCESS) { PHALCON_INIT_VAR(status); phalcon_call_method_p3(status, this_ptr, "beforevalidation", data, entity, messages); if (PHALCON_IS_FALSE(status)) { RETURN_CCTOR(status); } } phalcon_update_property_this(this_ptr, SL("_messages"), messages TSRMLS_CC); if (Z_TYPE_P(data) == IS_ARRAY) { phalcon_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC); } else { if (Z_TYPE_P(data) == IS_OBJECT) { phalcon_update_property_this(this_ptr, SL("_data"), data TSRMLS_CC); } } PHALCON_INIT_VAR(cancel_on_fail); ZVAL_STRING(cancel_on_fail, "cancelOnFail", 1); phalcon_is_iterable(validators, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(scope); if (Z_TYPE_P(scope) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STR(phalcon_validation_exception_ce, "The validator scope is not valid"); return; } PHALCON_OBS_NVAR(attribute); phalcon_array_fetch_long(&attribute, scope, 0, PH_NOISY_CC); PHALCON_OBS_NVAR(validator); phalcon_array_fetch_long(&validator, scope, 1, PH_NOISY_CC); if (Z_TYPE_P(validator) != IS_OBJECT) { PHALCON_THROW_EXCEPTION_STR(phalcon_validation_exception_ce, "One of the validators is not valid"); return; } PHALCON_INIT_NVAR(status); phalcon_call_method_p2(status, validator, "validate", this_ptr, attribute); /** * Check if the validation must be canceled if this validator fails */ if (PHALCON_IS_FALSE(status)) { //.........这里部分代码省略.........
开发者ID:RSivakov,项目名称:cphalcon,代码行数:101,
示例14: PHP_METHOD//.........这里部分代码省略......... PHALCON_INIT_VAR(identity_field); ZVAL_BOOL(identity_field, 0); PHALCON_INIT_VAR(columns); PHALCON_CALL_METHOD_PARAMS_2(columns, connection, "describecolumns", table, schema, PH_NO_CHECK); if (!phalcon_fast_count_ev(columns TSRMLS_CC)) { if (zend_is_true(schema)) { PHALCON_INIT_NVAR(complete_table); PHALCON_CONCAT_VSV(complete_table, schema, "/"./"", table); } else { PHALCON_CPY_WRT(complete_table, table); } PHALCON_INIT_NVAR(class_name); phalcon_get_class(class_name, model TSRMLS_CC); PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVSV(exception_message, "Cannot obtain table columns for the mapped source /"", complete_table, "/" used in model ", class_name); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } if (!phalcon_valid_foreach(columns TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(columns); zend_hash_internal_pointer_reset_ex(ah0, &hp0); ph_cycle_start_0: if (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS) { goto ph_cycle_end_0; } PHALCON_GET_FOREACH_VALUE(column); PHALCON_INIT_NVAR(field_name); PHALCON_CALL_METHOD(field_name, column, "getname", PH_NO_CHECK); phalcon_array_append(&attributes, field_name, PH_SEPARATE TSRMLS_CC); PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isprimary", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_append(&primary_keys, field_name, PH_SEPARATE TSRMLS_CC); } else { phalcon_array_append(&non_primary_keys, field_name, PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isnumeric", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_update_zval_bool(&numeric_typed, field_name, 1, PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isnotnull", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) { phalcon_array_append(¬_null, field_name, PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(feature); PHALCON_CALL_METHOD(feature, column, "isautoincrement", PH_NO_CHECK); if (PHALCON_IS_TRUE(feature)) {
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:67,
示例15: php_runkit_import_functions/* {{{ php_runkit_import_functions */static int php_runkit_import_functions(HashTable *function_table, long flags TSRMLS_DC){ HashPosition pos; int i, func_count = zend_hash_num_elements(function_table); zend_hash_internal_pointer_reset_ex(function_table, &pos); for(i = 0; i < func_count; i++) { zend_function *fe = NULL; char *key, *new_key; int key_len, new_key_len, type; long idx; zend_bool add_function = 1; zend_bool exists = 0; zend_hash_get_current_data_ex(function_table, (void**)&fe, &pos); new_key = fe->common.function_name; new_key_len = strlen(new_key) + 1; if (((type = zend_hash_get_current_key_ex(function_table, &key, &key_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) && fe && fe->type == ZEND_USER_FUNCTION) { if (type == HASH_KEY_IS_STRING) { new_key = key; new_key_len = key_len; exists = zend_hash_exists(EG(function_table), new_key, new_key_len); } else { exists = zend_hash_index_exists(EG(function_table), idx); } if (exists) { if (flags & PHP_RUNKIT_IMPORT_OVERRIDE) { if (type == HASH_KEY_IS_STRING) { if (zend_hash_del(EG(function_table), new_key, new_key_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Inconsistency cleaning up import environment"); return FAILURE; } } else { if (zend_hash_index_del(EG(function_table), idx) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Inconsistency cleaning up import environment"); return FAILURE; } } } else { add_function = 0; } } } if (add_function) { if (zend_hash_add(EG(function_table), new_key, new_key_len, fe, sizeof(zend_function), NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failure importing %s()", fe->common.function_name);#ifdef ZEND_ENGINE_2 destroy_zend_function(fe TSRMLS_CC);#else destroy_end_function(fe);#endif return FAILURE; } else { fe->op_array.static_variables = NULL; (*fe->op_array.refcount)++; } } zend_hash_move_forward_ex(function_table, &pos); } return SUCCESS;}
开发者ID:lltwox,项目名称:runkit,代码行数:70,
示例16: PHP_METHOD//.........这里部分代码省略......... } else { PHALCON_INIT_VAR(conditions); array_init(conditions); } PHALCON_INIT_VAR(fields); phalcon_array_fetch_string(&fields, relation, SL("fi"), PH_NOISY_CC); if (Z_TYPE_P(fields) != IS_ARRAY) { PHALCON_CPY_WRT(field, fields); PHALCON_INIT_VAR(value); PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field, PH_NO_CHECK); PHALCON_INIT_VAR(referenced_field); phalcon_array_fetch_string(&referenced_field, relation, SL("rf"), PH_NOISY_CC); PHALCON_INIT_VAR(condition); PHALCON_CONCAT_VS(condition, referenced_field, " = ?0"); phalcon_array_append(&conditions, condition, PH_SEPARATE TSRMLS_CC); phalcon_array_append(&placeholders, value, PH_SEPARATE TSRMLS_CC); } else { PHALCON_INIT_VAR(i); ZVAL_LONG(i, 0); PHALCON_INIT_VAR(referenced_fields); phalcon_array_fetch_string(&referenced_fields, relation, SL("rf"), PH_NOISY_CC); if (!phalcon_valid_foreach(fields TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(fields); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_74b5_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_74b5_0; } PHALCON_INIT_VAR(field); ZVAL_ZVAL(field, *hd, 1, 0); PHALCON_INIT_VAR(value); PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field, PH_NO_CHECK); PHALCON_INIT_VAR(referenced_field); phalcon_array_fetch(&referenced_field, referenced_fields, i, PH_NOISY_CC); PHALCON_INIT_VAR(condition); PHALCON_CONCAT_VSV(condition, referenced_field, " = ?", i); phalcon_array_append(&conditions, condition, PH_SEPARATE TSRMLS_CC); phalcon_array_append(&placeholders, value, PH_SEPARATE TSRMLS_CC); PHALCON_SEPARATE(i); increment_function(i); zend_hash_move_forward_ex(ah0, &hp0); goto fes_74b5_0; fee_74b5_0: if(0){} } PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, " AND ", 1); PHALCON_INIT_VAR(join_conditions); phalcon_fast_join(join_conditions, c0, conditions TSRMLS_CC); PHALCON_INIT_VAR(find_params); array_init(find_params);
开发者ID:digitalhydra,项目名称:cphalcon,代码行数:67,
示例17: PHP_METHOD/** * Commits the internal transaction * */PHP_METHOD(Phalcon_Logger_Adapter_File, commit){ zval *transaction = NULL, *file_handler = NULL, *quenue = NULL, *message = NULL; zval *message_str = NULL, *type = NULL, *time = NULL, *applied_format = NULL; zval *applied_eol = NULL; zval *t0 = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); PHALCON_INIT_VAR(transaction); phalcon_read_property(&transaction, this_ptr, SL("_transaction"), PH_NOISY_CC); if (!zend_is_true(transaction)) { PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "There is no active transaction"); return; } phalcon_update_property_bool(this_ptr, SL("_transaction"), 0 TSRMLS_CC); PHALCON_INIT_VAR(file_handler); phalcon_read_property(&file_handler, this_ptr, SL("_fileHandler"), PH_NOISY_CC); PHALCON_INIT_VAR(quenue); phalcon_read_property(&quenue, this_ptr, SL("_quenue"), PH_NOISY_CC); if (!phalcon_valid_foreach(quenue TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(quenue); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_654f_1: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_654f_1; } PHALCON_INIT_VAR(message); ZVAL_ZVAL(message, *hd, 1, 0); PHALCON_INIT_VAR(message_str); PHALCON_CALL_METHOD(message_str, message, "getmessage", PH_NO_CHECK); PHALCON_INIT_VAR(type); PHALCON_CALL_METHOD(type, message, "gettype", PH_NO_CHECK); PHALCON_INIT_VAR(time); PHALCON_CALL_METHOD(time, message, "gettime", PH_NO_CHECK); PHALCON_INIT_VAR(applied_format); PHALCON_CALL_METHOD_PARAMS_3(applied_format, this_ptr, "_applyformat", message_str, type, time, PH_NO_CHECK); PHALCON_INIT_VAR(t0); zend_get_constant(SL("PHP_EOL"), t0 TSRMLS_CC); PHALCON_INIT_VAR(applied_eol); PHALCON_CONCAT_VV(applied_eol, applied_format, t0); PHALCON_CALL_FUNC_PARAMS_2_NORETURN("fputs", file_handler, applied_eol); zend_hash_move_forward_ex(ah0, &hp0); goto fes_654f_1; fee_654f_1: if(0){} PHALCON_MM_RESTORE();}
开发者ID:awakmu,项目名称:cphalcon,代码行数:68,
示例18: PHP_METHOD/** * Create/Returns a new transaction or an existing one */PHP_METHOD(Phalcon_Mvc_Model_Transaction_Manager, getOrCreateTransaction) { HashTable *_2$$5; HashPosition _1$$5; zend_long ZEPHIR_LAST_CALL_STATUS; zval *autoBegin_param = NULL, *dependencyInjector = NULL, *transaction = NULL, *transactions = NULL, *_0, *_5, *_6, **_3$$5, *_4$$7 = NULL; zend_bool autoBegin; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &autoBegin_param); if (!autoBegin_param) { autoBegin = 1; } else { autoBegin = zephir_get_boolval(autoBegin_param); } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); ZEPHIR_CPY_WRT(dependencyInjector, _0); if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model/transaction/manager.zep", 188); return; } _0 = zephir_fetch_nproperty_this(this_ptr, SL("_number"), PH_NOISY_CC); if (zephir_is_true(_0)) { ZEPHIR_OBS_VAR(transactions); zephir_read_property_this(&transactions, this_ptr, SL("_transactions"), PH_NOISY_CC); if (Z_TYPE_P(transactions) == IS_ARRAY) { zephir_is_iterable(transactions, &_2$$5, &_1$$5, 0, 1, "phalcon/mvc/model/transaction/manager.zep", 200); for ( ; zend_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS ; zend_hash_move_backwards_ex(_2$$5, &_1$$5) ) { ZEPHIR_GET_HVALUE(transaction, _3$$5); if (Z_TYPE_P(transaction) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_4$$7); ZVAL_BOOL(_4$$7, 0); ZEPHIR_CALL_METHOD(NULL, transaction, "setisnewtransaction", NULL, 0, _4$$7); zephir_check_call_status(); RETURN_CCTOR(transaction); } } } } ZEPHIR_INIT_NVAR(transaction); object_init_ex(transaction, phalcon_mvc_model_transaction_ce); _5 = zephir_fetch_nproperty_this(this_ptr, SL("_service"), PH_NOISY_CC); ZEPHIR_INIT_VAR(_6); if (autoBegin) { ZVAL_BOOL(_6, 1); } else { ZVAL_BOOL(_6, 0); } ZEPHIR_CALL_METHOD(NULL, transaction, "__construct", NULL, 383, dependencyInjector, _6, _5); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, transaction, "settransactionmanager", NULL, 384, this_ptr); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_transactions"), transaction TSRMLS_CC); RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_number") TSRMLS_CC)); RETURN_CCTOR(transaction);}
开发者ID:zamronypj,项目名称:cphalcon,代码行数:66,
示例19: oauth_provider_parse_auth_headerstatic int oauth_provider_parse_auth_header(php_oauth_provider *sop, char *auth_header) /* {{{ */{ pcre_cache_entry *pce; zval subpats, return_value, *item_param, *current_param, *current_val; HashPosition hpos; zend_string *regex = zend_string_init(OAUTH_REGEX, sizeof(OAUTH_REGEX) - 1, 0); size_t decoded_len; if(!auth_header || strncasecmp(auth_header, "oauth", 4) || !sop) { return FAILURE; } /* pass "OAuth " */ auth_header += 5; if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) { zend_string_release(regex); return FAILURE; } zend_string_release(regex); ZVAL_NULL(&subpats); ZVAL_NULL(&return_value); php_pcre_match_impl( pce, auth_header, strlen(auth_header), &return_value, &subpats, 1, /* global */ 1, /* use flags */ 2, /* PREG_SET_ORDER */ 0 ); if (0 == Z_LVAL(return_value)) { return FAILURE; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL(subpats), &hpos); /* walk the oauth param names */ do { if ((item_param = zend_hash_get_current_data_ex(Z_ARRVAL(subpats), &hpos)) != NULL) { zval decoded_val; char *tmp; /* * item = array( * 1 => param name * 2 => quoted value * 3 => unquoted value (defined if matched) * ) */ current_param = zend_hash_index_find(Z_ARRVAL_P(item_param), 1); if ((current_val =zend_hash_index_find(Z_ARRVAL_P(item_param), 3)) == NULL) { current_val = zend_hash_index_find(Z_ARRVAL_P(item_param), 2); } tmp = estrndup(Z_STRVAL_P(current_val), Z_STRLEN_P(current_val)); decoded_len = php_url_decode(tmp, Z_STRLEN_P(current_val)); ZVAL_STRINGL(&decoded_val, tmp, decoded_len); if (oauth_provider_set_param_value(sop->oauth_params, Z_STRVAL_P(current_param), &decoded_val)==FAILURE) { return FAILURE; } Z_DELREF(decoded_val); } } while (SUCCESS==zend_hash_move_forward_ex(Z_ARRVAL(subpats), &hpos)); zval_ptr_dtor(&return_value); zval_ptr_dtor(&subpats); return SUCCESS;}
开发者ID:keyurdg,项目名称:pecl-web_services-oauth,代码行数:74,
示例20: PHP_METHOD/** * Internal validations, if it returns true, then skip the current validator */PHP_METHOD(Phalcon_Validation, preChecking) { HashTable *_1$$3, *_7$$9; HashPosition _0$$3, _6$$9; zephir_fcall_cache_entry *_3 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *field, *validator, *singleField = NULL, *allowEmpty = NULL, *emptyValue = NULL, *value = NULL, *result = NULL, **_2$$3, *_4$$6, *_5$$6, **_8$$9; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &field, &validator); if (Z_TYPE_P(field) == IS_ARRAY) { zephir_is_iterable(field, &_1$$3, &_0$$3, 0, 0, "phalcon/validation.zep", 590); for ( ; zend_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS ; zend_hash_move_forward_ex(_1$$3, &_0$$3) ) { ZEPHIR_GET_HVALUE(singleField, _2$$3); ZEPHIR_CALL_METHOD(&result, this_ptr, "prechecking", &_3, 469, singleField, validator); zephir_check_call_status(); if (zephir_is_true(result)) { RETURN_CCTOR(result); } } } else { ZEPHIR_INIT_VAR(_4$$6); ZVAL_STRING(_4$$6, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_VAR(_5$$6); ZVAL_BOOL(_5$$6, 0); ZEPHIR_CALL_METHOD(&allowEmpty, validator, "getoption", NULL, 0, _4$$6, _5$$6); zephir_check_temp_parameter(_4$$6); zephir_check_call_status(); if (zephir_is_true(allowEmpty)) { if ((zephir_method_exists_ex(validator, SS("isallowempty") TSRMLS_CC) == SUCCESS)) { ZEPHIR_RETURN_CALL_METHOD(validator, "isallowempty", NULL, 0, this_ptr, field); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_CALL_METHOD(&value, this_ptr, "getvalue", NULL, 0, field); zephir_check_call_status(); if (Z_TYPE_P(allowEmpty) == IS_ARRAY) { zephir_is_iterable(allowEmpty, &_7$$9, &_6$$9, 0, 0, "phalcon/validation.zep", 604); for ( ; zend_hash_get_current_data_ex(_7$$9, (void**) &_8$$9, &_6$$9) == SUCCESS ; zend_hash_move_forward_ex(_7$$9, &_6$$9) ) { ZEPHIR_GET_HVALUE(emptyValue, _8$$9); if (ZEPHIR_IS_IDENTICAL(emptyValue, value)) { RETURN_MM_BOOL(1); } } RETURN_MM_BOOL(0); } RETURN_MM_BOOL(ZEPHIR_IS_EMPTY(value)); } } RETURN_MM_BOOL(0);}
开发者ID:zamronypj,项目名称:cphalcon,代码行数:64,
示例21: msgpack_convert_object//.........这里部分代码省略......... int num; ht = HASH_OF(*value); ret = HASH_OF(return_value); num = zend_hash_num_elements(ht); if (num <= 0) { zval_ptr_dtor(value); break; } /* string - php_only mode? */ if (ht->nNumOfElements != ht->nNextFreeElement || ht->nNumOfElements != ret->nNumOfElements) { HashTable *properties = NULL; HashPosition prop_pos; ALLOC_HASHTABLE(var); zend_hash_init(var, num, NULL, NULL, 0); zend_hash_internal_pointer_reset_ex(ht, &pos); for (;; zend_hash_move_forward_ex(ht, &pos)) { key_type = zend_hash_get_current_key_ex( ht, &key, &key_len, &key_index, 0, &pos); if (key_type == HASH_KEY_NON_EXISTANT) { break; } if (zend_hash_get_current_data_ex( ht, (void *)&data, &pos) != SUCCESS) { continue; } if (key_type == HASH_KEY_IS_STRING) { zval *val; MSGPACK_CONVERT_COPY_ZVAL(val, data); if (msgpack_convert_string_to_properties( return_value, key, key_len, val, var) != SUCCESS) { zval_ptr_dtor(&val); MSGPACK_WARNING( "[msgpack] (%s) " "illegal offset type, skip this decoding", __FUNCTION__); } } } /* index */ properties = Z_OBJ_HT_P(return_value)->get_properties( return_value TSRMLS_CC); if (HASH_OF(tpl)) { properties = HASH_OF(tpl); } zend_hash_internal_pointer_reset_ex(properties, &prop_pos); zend_hash_internal_pointer_reset_ex(ht, &pos);
开发者ID:LoosKonstantin,项目名称:msgpack,代码行数:67,
示例22: msgpack_convert_arrayint msgpack_convert_array(zval *return_value, zval *tpl, zval **value){ TSRMLS_FETCH(); if (Z_TYPE_P(tpl) == IS_ARRAY) { char *key; uint key_len; int key_type; ulong key_index; zval **data, **arydata; HashPosition pos, valpos; HashTable *ht, *htval; int num; ht = HASH_OF(tpl); // TODO: maybe need to release memory? array_init(return_value); num = zend_hash_num_elements(ht); if (num <= 0) { MSGPACK_WARNING( "[msgpack] (%s) template array length is 0", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } /* string */ if (ht->nNumOfElements != ht->nNextFreeElement) { htval = HASH_OF(*value); if (!htval) { MSGPACK_WARNING( "[msgpack] (%s) input data is not array", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } zend_hash_internal_pointer_reset_ex(ht, &pos); zend_hash_internal_pointer_reset_ex(htval, &valpos); for (;; zend_hash_move_forward_ex(ht, &pos), zend_hash_move_forward_ex(htval, &valpos)) { key_type = zend_hash_get_current_key_ex( ht, &key, &key_len, &key_index, 0, &pos); if (key_type == HASH_KEY_NON_EXISTANT) { break; } if (zend_hash_get_current_data_ex( ht, (void *)&data, &pos) != SUCCESS) { continue; } if (key_type == HASH_KEY_IS_STRING) { int (*convert_function)(zval *, zval *, zval **) = NULL; zval **dataval, *val; switch (Z_TYPE_PP(data)) { case IS_ARRAY: convert_function = msgpack_convert_array; break; case IS_OBJECT: // case IS_STRING: convert_function = msgpack_convert_object; break; default: break; } if (zend_hash_get_current_data_ex( htval, (void *)&dataval, &valpos) != SUCCESS) { MSGPACK_WARNING( "[msgpack] (%s) can't get data", __FUNCTION__); zval_ptr_dtor(value); return FAILURE; } MSGPACK_CONVERT_COPY_ZVAL(val, dataval); if (convert_function) { zval *rv; ALLOC_INIT_ZVAL(rv); if (convert_function(rv, *data, &val) != SUCCESS) { zval_ptr_dtor(&val); return FAILURE; }//.........这里部分代码省略.........
开发者ID:LoosKonstantin,项目名称:msgpack,代码行数:101,
示例23: PHP_METHOD//.........这里部分代码省略......... /** * Internal functions links to the PHP documentation */ if (zend_is_true(is_internal)) { /** * Prepare function's name according to the conventions in the docs */ PHALCON_INIT_VAR(prepared_function_name); phalcon_fast_str_replace(prepared_function_name, underscore, minus, function_name); PHALCON_SCONCAT_SVSVS(html, "<span class=/"error-function/"><a target=/"_new/" href=/"http://php.net/manual/en/function.", prepared_function_name, ".php/">", function_name, "</a></span>"); } else { PHALCON_SCONCAT_SVS(html, "<span class=/"error-function/">", function_name, "</span>"); } } else { PHALCON_SCONCAT_SVS(html, "<span class=/"error-function/">", function_name, "</span>"); } } /** * Check for arguments in the function */ if (phalcon_array_isset_string(trace, SS("args"))) { PHALCON_OBS_VAR(trace_args); phalcon_array_fetch_string(&trace_args, trace, SL("args"), PH_NOISY); if (phalcon_fast_count_ev(trace_args TSRMLS_CC)) { PHALCON_INIT_VAR(arguments); array_init(arguments); phalcon_is_iterable(trace_args, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(argument); /** * Every argument is generated using _getVarDump */ PHALCON_INIT_NVAR(dumped_argument); phalcon_call_method_p1(dumped_argument, this_ptr, "_getvardump", argument); PHALCON_INIT_NVAR(span_argument); PHALCON_CONCAT_SVS(span_argument, "<span class=/"error-parameter/">", dumped_argument, "</span>"); /** * Append the HTML generated to the argument's list */ phalcon_array_append(&arguments, span_argument, PH_SEPARATE); zend_hash_move_forward_ex(ah0, &hp0); } /** * Join all the arguments */ PHALCON_INIT_VAR(joined_arguments); phalcon_fast_join_str(joined_arguments, SL(", "), arguments TSRMLS_CC); PHALCON_SCONCAT_SVS(html, "(", joined_arguments, ")"); } else { phalcon_concat_self_str(&html, SL("()") TSRMLS_CC); } } /**
开发者ID:Dinesh-Ramakrishnan,项目名称:cphalcon,代码行数:67,
示例24: PHP_METHOD/** * Builds a SELECT statement * * @param array $definition * @return string */PHP_METHOD(Phalcon_Db_Dialect_Oracle, select){ zval *definition, *escape_char = NULL, *columns, *selected_columns, *distinct; zval *column = NULL, *column_item = NULL, *column_sql = NULL, *columns_sql = NULL; zval *column_domain = NULL, *column_domain_sql = NULL, *column_alias = NULL; zval *column_alias_sql = NULL, *tables, *selected_tables; zval *table = NULL, *sql_table = NULL, *tables_sql = NULL, *sql, *joins; zval *join = NULL, *type = NULL, *sql_join = NULL, *join_conditions_array = NULL; zval *join_expressions = NULL, *join_condition = NULL, *join_expression = NULL; zval *join_conditions = NULL, *where_conditions; zval *where_expression = NULL, *group_items, *group_fields; zval *group_field = NULL, *group_expression = NULL, *group_sql; zval *group_clause, *having_conditions, *having_expression = NULL; zval *order_fields, *order_items, *order_item = NULL; zval *order_expression = NULL, *order_sql_item = NULL, *sql_order_type = NULL; zval *order_sql_item_type = NULL, *order_sql, *limit_value; zval *number, *offset, *tmp1 = NULL, *tmp2 = NULL; zval *z_one, *ini_range, *end_range = NULL, *sql_limit; HashTable *ah0, *ah1, *ah2, *ah3, *ah4, *ah5; HashPosition hp0, hp1, hp2, hp3, hp4, hp5; zval **hd; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &definition) == FAILURE) { RETURN_NULL(); } if (Z_TYPE_P(definition) != IS_ARRAY) { PHALCON_THROW_EXCEPTION_STRW(phalcon_db_exception_ce, "Invalid SELECT definition"); return; } if (!phalcon_array_isset_string(definition, SS("tables"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_db_exception_ce, "The index 'tables' is required in the definition array"); return; } if (!phalcon_array_isset_string(definition, SS("columns"))) { PHALCON_THROW_EXCEPTION_STRW(phalcon_db_exception_ce, "The index 'columns' is required in the definition array"); return; } PHALCON_MM_GROW(); if (PHALCON_GLOBAL(db).escape_identifiers) { PHALCON_OBS_VAR(escape_char); phalcon_read_property_this(&escape_char, this_ptr, SL("_escapeChar"), PH_NOISY TSRMLS_CC); } else { PHALCON_INIT_NVAR(escape_char); } PHALCON_OBS_VAR(columns); phalcon_array_fetch_string(&columns, definition, SL("columns"), PH_NOISY); if (Z_TYPE_P(columns) == IS_ARRAY) { PHALCON_INIT_VAR(selected_columns); array_init(selected_columns); phalcon_is_iterable(columns, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(column); /** * Escape column name */ PHALCON_OBS_NVAR(column_item); phalcon_array_fetch_long(&column_item, column, 0, PH_NOISY); if (Z_TYPE_P(column_item) == IS_ARRAY) { PHALCON_CALL_METHOD(&column_sql, this_ptr, "getsqlexpression", column_item, escape_char); } else if (PHALCON_IS_STRING(column_item, "*")) { PHALCON_CPY_WRT(column_sql, column_item); } else if (PHALCON_GLOBAL(db).escape_identifiers) { PHALCON_INIT_NVAR(column_sql); PHALCON_CONCAT_VVV(column_sql, escape_char, column_item, escape_char); } else { PHALCON_CPY_WRT(columns_sql, column_item); } /** * Escape column domain */ if (phalcon_array_isset_long(column, 1)) { PHALCON_OBS_NVAR(column_domain); phalcon_array_fetch_long(&column_domain, column, 1, PH_NOISY); if (zend_is_true(column_domain)) { if (PHALCON_GLOBAL(db).escape_identifiers) { PHALCON_INIT_NVAR(column_domain_sql); PHALCON_CONCAT_VVVSV(column_domain_sql, escape_char, column_domain, escape_char, ".", column_sql); } else { PHALCON_INIT_NVAR(column_domain_sql); PHALCON_CONCAT_VSV(column_domain_sql, column_domain, ".", column_sql); } } else {//.........这里部分代码省略.........
开发者ID:100851766,项目名称:cphalcon,代码行数:101,
示例25: ZEND_METHOD/* ArchiveWriter::finish {{{ **/ZEND_METHOD(ArchiveWriter, finish){ zval *this = getThis(); int resource_id; HashPosition pos; archive_file_t *arch; archive_entry_t **entry; int result, error_num; const char *error_string; mode_t mode; php_stream *stream; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, ce_ArchiveException, &error_handling TSRMLS_CC); if (!_archive_get_fd(this, &arch TSRMLS_CC)) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } if (zend_hash_sort(arch->entries, zend_qsort, _archive_pathname_compare, 0 TSRMLS_CC) == FAILURE) { RETURN_FALSE; } zend_hash_internal_pointer_reset_ex(arch->entries, &pos); while (zend_hash_get_current_data_ex(arch->entries, (void **)&entry, &pos) == SUCCESS) { mode = archive_entry_mode((*entry)->entry); if (S_ISREG(mode) && archive_entry_size((*entry)->entry) > 0) { if ((stream = php_stream_open_wrapper_ex((*entry)->filename, "r", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, NULL))) { char buf[PHP_ARCHIVE_BUF_LEN]; int header_written=0; int read_bytes; while ((read_bytes = php_stream_read(stream, buf, PHP_ARCHIVE_BUF_LEN))) { if (!header_written) { /* write header only after the first successful read */ result = archive_write_header(arch->arch, (*entry)->entry); if (result == ARCHIVE_FATAL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write entry header for file %s: fatal error", (*entry)->filename); zend_restore_error_handling(&error_handling TSRMLS_CC); return; } header_written = 1; } result = archive_write_data(arch->arch, buf, read_bytes); if (result <= 0) { error_num = archive_errno(arch->arch); error_string = archive_error_string(arch->arch); if (error_num && error_string) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write file %s to archive: error #%d, %s", (*entry)->filename, error_num, error_string); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write file %s: unknown error %d", (*entry)->filename, result); } php_stream_close(stream); zend_restore_error_handling(&error_handling TSRMLS_CC); return; } } php_stream_close(stream); } } else { result = archive_write_header(arch->arch, (*entry)->entry); if (result == ARCHIVE_FATAL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write entry header for file %s: fatal error", (*entry)->filename); zend_restore_error_handling(&error_handling TSRMLS_CC); return; } } zend_hash_move_forward_ex(arch->entries, &pos); } if ((resource_id = _archive_get_rsrc_id(this TSRMLS_CC))) { add_property_resource(this, "fd", 0); zend_list_delete(resource_id); zend_restore_error_handling(&error_handling TSRMLS_CC); RETURN_TRUE; } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to finish writing of archive file"); zend_restore_error_handling(&error_handling TSRMLS_CC);}
开发者ID:liuyu121,项目名称:pecl-file_formats-archive,代码行数:90,
示例26: _php_array_to_envp/* {{{ _php_array_to_envp */static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent TSRMLS_DC){ zval **element; php_process_env_t env; char *string_key, *data;#ifndef PHP_WIN32 char **ep;#endif char *p; uint string_length, cnt, l, sizeenv=0, el_len; ulong num_key; HashTable *target_hash; HashPosition pos; memset(&env, 0, sizeof(env)); if (!environment) { return env; } cnt = zend_hash_num_elements(Z_ARRVAL_P(environment)); if (cnt < 1) {#ifndef PHP_WIN32 env.envarray = (char **) pecalloc(1, sizeof(char *), is_persistent);#endif env.envp = (char *) pecalloc(4, 1, is_persistent); return env; } target_hash = HASH_OF(environment); if (!target_hash) { return env; } /* first, we have to get the size of all the elements in the hash */ for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(target_hash, &pos)) { if (Z_TYPE_PP(element) != IS_STRING) { zval tmp; MAKE_COPY_ZVAL(element, &tmp); convert_to_string(&tmp); el_len = Z_STRLEN(tmp); zval_dtor(&tmp); } else { el_len = Z_STRLEN_PP(element); } if (el_len == 0) { continue; } sizeenv += el_len+1; switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: if (string_length == 0) { continue; } sizeenv += string_length; break; } }#ifndef PHP_WIN32 ep = env.envarray = (char **) pecalloc(cnt + 1, sizeof(char *), is_persistent);#endif p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent); for (zend_hash_internal_pointer_reset_ex(target_hash, &pos); zend_hash_get_current_data_ex(target_hash, (void **) &element, &pos) == SUCCESS; zend_hash_move_forward_ex(target_hash, &pos)) { zval tmp; if (Z_TYPE_PP(element) != IS_STRING) { MAKE_COPY_ZVAL(element, &tmp); convert_to_string(&tmp); } else { tmp = **element; } el_len = Z_STRLEN(tmp); if (el_len == 0) { goto next_element; } data = Z_STRVAL(tmp); switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: if (string_length == 0) { goto next_element; } l = string_length + el_len + 1; memcpy(p, string_key, string_length);//.........这里部分代码省略.........
开发者ID:90youth,项目名称:php-src,代码行数:101,
示例27: PHP_METHOD/** * Returns an array of Phalcon/Db/Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); ?> * </code> * * @param string $table * @param string $schema * @return Phalcon/Db/Column[] */PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns){ zval *table, *schema = NULL, *dialect, *ztrue, *sql, *fetch_num; zval *describe, *old_column = NULL, *size_pattern, *columns; zval *field = NULL, *definition = NULL, *column_type = NULL, *matches = NULL; zval *pos = NULL, *match_one = NULL, *match_two = NULL, *attribute = NULL, *column_name = NULL; zval *column = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 1, &table, &schema); if (!schema) { PHALCON_INIT_VAR(schema); } PHALCON_OBS_VAR(dialect); phalcon_read_property_this(&dialect, this_ptr, SL("_dialect"), PH_NOISY_CC); PHALCON_INIT_VAR(ztrue); ZVAL_BOOL(ztrue, 1); /** * Get the SQL to describe a table */ PHALCON_INIT_VAR(sql); phalcon_call_method_p2(sql, dialect, "describecolumns", table, schema); /** * We're using FETCH_NUM to fetch the columns */ PHALCON_INIT_VAR(fetch_num); ZVAL_LONG(fetch_num, 3); /** * Get the describe */ PHALCON_INIT_VAR(describe); phalcon_call_method_p2(describe, this_ptr, "fetchall", sql, fetch_num); PHALCON_INIT_VAR(old_column); PHALCON_INIT_VAR(size_pattern); ZVAL_STRING(size_pattern, "#//(([0-9]++)(?:,//s*([0-9]++))?//)#", 1); PHALCON_INIT_VAR(columns); array_init(columns); /** * Field Indexes: 0:name, 1:type, 2:not null, 3:key, 4:default, 5:extra */ phalcon_is_iterable(describe, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(field); /** * By default the bind types is two */ PHALCON_INIT_NVAR(definition); array_init_size(definition, 1); add_assoc_long_ex(definition, SS("bindType"), 2); /** * By checking every column type we convert it to a Phalcon/Db/Column */ PHALCON_OBS_NVAR(column_type); phalcon_array_fetch_long(&column_type, field, 1, PH_NOISY); while (1) { /** * Enum are treated as char */ if (phalcon_memnstr_str(column_type, SL("enum"))) { phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE); break; } /** * Smallint/Bigint/Integers/Int are int */ if (phalcon_memnstr_str(column_type, SL("int"))) { phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE); phalcon_array_update_string(&definition, SL("isNumeric"), &ztrue, PH_COPY | PH_SEPARATE);//.........这里部分代码省略.........
开发者ID:Dinesh-Ramakrishnan,项目名称:cphalcon,代码行数:101,
注:本文中的zend_hash_get_current_data_ex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_get_current_key_ex函数代码示例 C++ zend_hash_get_current_data函数代码示例 |