这篇教程C++ zend_hash_move_forward_ex函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_move_forward_ex函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_move_forward_ex函数的具体用法?C++ zend_hash_move_forward_ex怎么用?C++ zend_hash_move_forward_ex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_move_forward_ex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PHP_METHODPHP_METHOD(Phalcon_Test, nice){ zval *v0 = NULL, *v1 = NULL, *v2 = NULL, *v3 = NULL; zval *a0 = NULL; zval *r0 = NULL, *r1 = NULL; zval *t0 = NULL; HashTable *ah0; HashPosition hp0; zval **hd; char *index; uint index_len; ulong num; int htype; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &v0) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(a0); array_init(a0); add_assoc_long_ex(a0, "hello1", strlen("hello1")+1, 1); add_assoc_long_ex(a0, "hello2", strlen("hello2")+1, 2); add_assoc_long_ex(a0, "hello3", strlen("hello3")+1, 3); PHALCON_CPY_WRT(v1, a0); if (Z_TYPE_P(v1) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument supplied for foreach()"); } else { ALLOC_HASHTABLE(ah0); zend_hash_init(ah0, 0, NULL, NULL, 0); zend_hash_copy(ah0, Z_ARRVAL_P(v1), NULL, NULL, sizeof(zval*)); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_2ebb_0: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_2ebb_0; } else { PHALCON_INIT_VAR(v3); htype = zend_hash_get_current_key_ex(ah0, &index, &index_len, &num, 0, &hp0); if (htype == HASH_KEY_IS_STRING) { ZVAL_STRINGL(v3, index, index_len-1, 1); } else { if (htype == HASH_KEY_IS_LONG) { ZVAL_LONG(v3, num); } } } PHALCON_INIT_VAR(v2); ZVAL_ZVAL(v2, *hd, 1, 0); PHALCON_INIT_VAR(r0); phalcon_array_fetch(&r0, v1, v3, PHALCON_NOISY_FETCH TSRMLS_CC); PHALCON_INIT_VAR(t0); ZVAL_LONG(t0, 100); PHALCON_INIT_VAR(r1); phalcon_add_function(r1, r0, t0 TSRMLS_CC); Z_ADDREF_P(r1); if (Z_REFCOUNT_P(v1) > 1) { zval *new_zv; Z_DELREF_P(v1); ALLOC_ZVAL(new_zv); INIT_PZVAL_COPY(new_zv, v1); v1 = new_zv; zval_copy_ctor(new_zv); } phalcon_array_update(v1, v3, r1 TSRMLS_CC); zend_hash_move_forward_ex(ah0, &hp0); goto fes_2ebb_0; fee_2ebb_0: zend_hash_destroy(ah0); efree(ah0); } PHALCON_CALL_FUNC_PARAMS_1_NORETURN("print_r", v1, 0x015); PHALCON_MM_RESTORE(); RETURN_NULL();}
开发者ID:xingskycn,项目名称:cphalcon,代码行数:77,
示例2: PHP_METHOD//.........这里部分代码省略......... ah0 = Z_ARRVAL_P(r3); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_52be_2: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_52be_2; } PHALCON_INIT_VAR(column); ZVAL_ZVAL(column, *hd, 1, 0); PHALCON_INIT_VAR(r4); PHALCON_CALL_METHOD(r4, column, "getname", PH_NO_CHECK); PHALCON_INIT_VAR(r5); PHALCON_CALL_SELF_PARAMS_1(r5, this_ptr, "getcolumndefinition", column); PHALCON_INIT_VAR(column_line); PHALCON_CONCAT_SVSV(column_line, "`", r4, "` ", r5); PHALCON_INIT_VAR(r6); PHALCON_CALL_METHOD(r6, column, "isnotnull", PH_NO_CHECK); if (zend_is_true(r6)) { PHALCON_INIT_VAR(t0); ZVAL_STRING(t0, " NOT NULL", 1); phalcon_concat_self(&column_line, t0 TSRMLS_CC); } PHALCON_INIT_VAR(r7); PHALCON_CALL_METHOD(r7, column, "isautoincrement", PH_NO_CHECK); if (zend_is_true(r7)) { PHALCON_INIT_VAR(t1); ZVAL_STRING(t1, " AUTO_INCREMENT", 1); phalcon_concat_self(&column_line, t1 TSRMLS_CC); } phalcon_array_append(&create_lines, column_line, PH_SEPARATE TSRMLS_CC); zend_hash_move_forward_ex(ah0, &hp0); goto fes_52be_2; fee_52be_2: eval_int = phalcon_array_isset_string(definition, SL("indexes")+1); if (eval_int) { PHALCON_ALLOC_ZVAL_MM(r8); phalcon_array_fetch_string(&r8, definition, SL("indexes"), PH_NOISY_CC); if (!phalcon_valid_foreach(r8 TSRMLS_CC)) { return; } ah1 = Z_ARRVAL_P(r8); zend_hash_internal_pointer_reset_ex(ah1, &hp1); fes_52be_3: if(zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) != SUCCESS){ goto fee_52be_3; } PHALCON_INIT_VAR(index); ZVAL_ZVAL(index, *hd, 1, 0); PHALCON_INIT_VAR(index_name); PHALCON_CALL_METHOD(index_name, index, "getname", PH_NO_CHECK); PHALCON_INIT_VAR(r9); PHALCON_CALL_METHOD(r9, index, "getcolumns", PH_NO_CHECK); PHALCON_INIT_VAR(column_list); PHALCON_CALL_SELF_PARAMS_1(column_list, this_ptr, "getcolumnlist", r9); if (PHALCON_COMPARE_STRING(index_name, "PRIMARY")) { PHALCON_INIT_VAR(r10); PHALCON_CONCAT_SVS(r10, "PRIMARY KEY (", column_list, ")"); phalcon_array_append(&create_lines, r10, PH_SEPARATE TSRMLS_CC);
开发者ID:codeanu,项目名称:cphalcon,代码行数:67,
示例3: PHP_METHOD/** * Executes a prepared statement binding * * @param PDOStatement $statement * @param array $placeholders * @param array $dataTypes * @return PDOStatement */PHP_METHOD(Phalcon_Db_Adapter_Pdo, _executePrepared){ zval *statement = NULL, *placeholders = NULL, *data_types = NULL; zval *one = NULL, *value = NULL, *wildcard = NULL, *parameter = NULL, *type = NULL, *cast_value = NULL; HashTable *ah0; HashPosition hp0; zval **hd; char *hash_index; uint hash_index_len; ulong hash_num; int hash_type; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &statement, &placeholders, &data_types) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(one); ZVAL_LONG(one, 1); if (!phalcon_valid_foreach(placeholders TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(placeholders); 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_INIT_VAR(wildcard); PHALCON_GET_FOREACH_KEY(wildcard, ah0, hp0); PHALCON_GET_FOREACH_VALUE(value); if (Z_TYPE_P(wildcard) == IS_LONG) { PHALCON_INIT_VAR(parameter); phalcon_add_function(parameter, wildcard, one TSRMLS_CC); } else { if (Z_TYPE_P(wildcard) == IS_STRING) { PHALCON_CPY_WRT(parameter, wildcard); } else { PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Invalid bind parameter"); return; } } if (Z_TYPE_P(data_types) == IS_ARRAY) { eval_int = phalcon_array_isset(data_types, wildcard); if (eval_int) { PHALCON_INIT_VAR(type); phalcon_array_fetch(&type, data_types, wildcard, PH_NOISY_CC); if (phalcon_compare_strict_long(type, 32 TSRMLS_CC)) { PHALCON_INIT_VAR(cast_value); PHALCON_CALL_FUNC_PARAMS_1(cast_value, "doubleval", value); PHALCON_INIT_VAR(type); ZVAL_LONG(type, 2); } else { PHALCON_CPY_WRT(cast_value, value); } Z_SET_ISREF_P(cast_value); PHALCON_CALL_METHOD_PARAMS_3_NORETURN(statement, "bindparam", parameter, cast_value, type, PH_NO_CHECK); Z_UNSET_ISREF_P(cast_value); } else { PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Invalid bind type parameter"); return; } } else { PHALCON_CALL_METHOD_PARAMS_2_NORETURN(statement, "bindparam", parameter, value, PH_NO_CHECK); } zend_hash_move_forward_ex(ah0, &hp0); goto ph_cycle_start_0; ph_cycle_end_0: PHALCON_CALL_METHOD_NORETURN(statement, "execute", PH_NO_CHECK); RETURN_CCTOR(statement);}
开发者ID:croustibat,项目名称:cphalcon,代码行数:94,
示例4: PHP_METHOD/** * Produce the routing parameters from the rewrite information */PHP_METHOD(Phalcon_Mvc_Router_Annotations, handle) { zend_bool _5$$6; HashTable *_3, *_9$$14, *_13$$16, *_17$$18; HashPosition _2, _8$$14, _12$$16, _16$$18; zephir_fcall_cache_entry *_7 = NULL, *_11 = NULL, *_19 = NULL, *_20 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *uri_param = NULL, *realUri = NULL, *annotationsService = NULL, *handlers = NULL, *controllerSuffix = NULL, *scope = NULL, *prefix = NULL, *dependencyInjector = NULL, *handler = NULL, *controllerName = NULL, *lowerControllerName = NULL, *namespaceName = NULL, *moduleName = NULL, *sufixed = NULL, *handlerAnnotations = NULL, *classAnnotations = NULL, *annotations = NULL, *annotation = NULL, *methodAnnotations = NULL, *method = NULL, *collection = NULL, *_0, *_1, **_4, *_6$$11 = NULL, **_10$$14, **_14$$16, *_15$$18 = NULL, **_18$$18; zval *uri = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &uri_param); if (!uri_param) { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } else { if (UNEXPECTED(Z_TYPE_P(uri_param) != IS_STRING && Z_TYPE_P(uri_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'uri' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(uri_param) == IS_STRING)) { zephir_get_strval(uri, uri_param); } else { ZEPHIR_INIT_VAR(uri); ZVAL_EMPTY_STRING(uri); } } if (!(!(!uri) && Z_STRLEN_P(uri))) { ZEPHIR_CALL_METHOD(&realUri, this_ptr, "getrewriteuri", NULL, 0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(realUri, uri); } _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_router_exception_ce, "A dependency injection container is required to access the 'annotations' service", "phalcon/mvc/router/annotations.zep", 104); return; } ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "annotations", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&annotationsService, dependencyInjector, "getshared", NULL, 0, _1); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(handlers); zephir_read_property_this(&handlers, this_ptr, SL("_handlers"), PH_NOISY_CC); ZEPHIR_OBS_VAR(controllerSuffix); zephir_read_property_this(&controllerSuffix, this_ptr, SL("_controllerSuffix"), PH_NOISY_CC); zephir_is_iterable(handlers, &_3, &_2, 0, 0, "phalcon/mvc/router/annotations.zep", 205); for ( ; zend_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zend_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(scope, _4); if (Z_TYPE_P(scope) != IS_ARRAY) { continue; } ZEPHIR_OBS_NVAR(prefix); zephir_array_fetch_long(&prefix, scope, 0, PH_NOISY, "phalcon/mvc/router/annotations.zep", 122 TSRMLS_CC); _5$$6 = !(ZEPHIR_IS_EMPTY(prefix)); if (_5$$6) { _5$$6 = !(zephir_start_with(realUri, prefix, NULL)); } if (_5$$6) { continue; } ZEPHIR_OBS_NVAR(handler); zephir_array_fetch_long(&handler, scope, 1, PH_NOISY, "phalcon/mvc/router/annotations.zep", 131 TSRMLS_CC); if (zephir_memnstr_str(handler, SL("//"), "phalcon/mvc/router/annotations.zep", 133)) { ZEPHIR_INIT_NVAR(controllerName); zephir_get_class_ns(controllerName, handler, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(namespaceName); zephir_get_ns_class(namespaceName, handler, 0 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(controllerName, handler); ZEPHIR_OBS_NVAR(namespaceName); zephir_fetch_property(&namespaceName, this_ptr, SL("_defaultNamespace"), PH_SILENT_CC); } zephir_update_property_this(getThis(), SL("_routePrefix"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); ZEPHIR_OBS_NVAR(moduleName); zephir_array_isset_long_fetch(&moduleName, scope, 2, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(sufixed); ZEPHIR_CONCAT_VV(sufixed, controllerName, controllerSuffix); if (Z_TYPE_P(namespaceName) != IS_NULL) { ZEPHIR_INIT_LNVAR(_6$$11); ZEPHIR_CONCAT_VSV(_6$$11, namespaceName, "//", sufixed); ZEPHIR_CPY_WRT(sufixed, _6$$11); } ZEPHIR_CALL_METHOD(&handlerAnnotations, annotationsService, "get", &_7, 0, sufixed); zephir_check_call_status(); if (Z_TYPE_P(handlerAnnotations) != IS_OBJECT) { continue; } ZEPHIR_CALL_METHOD(&classAnnotations, handlerAnnotations, "getclassannotations", NULL, 0);//.........这里部分代码省略.........
开发者ID:luomor,项目名称:cphalcon,代码行数:101,
示例5: pcntl_sigwaitinfostatic void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{{ */{ zval *user_set, **user_signo, *user_siginfo = NULL; long tv_sec = 0, tv_nsec = 0; sigset_t set; HashPosition pos; int signo; siginfo_t siginfo; struct timespec timeout; if (timedwait) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|zll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) { return; } } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|z", &user_set, &user_siginfo) == FAILURE) { return; } } if (sigemptyset(&set) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(user_set), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(user_set), (void **)&user_signo, &pos) == SUCCESS) { if (Z_TYPE_PP(user_signo) != IS_LONG) { SEPARATE_ZVAL(user_signo); convert_to_long_ex(user_signo); } signo = Z_LVAL_PP(user_signo); if (sigaddset(&set, signo) != 0) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); RETURN_FALSE; } zend_hash_move_forward_ex(Z_ARRVAL_P(user_set), &pos); } if (timedwait) { timeout.tv_sec = (time_t) tv_sec; timeout.tv_nsec = tv_nsec; signo = sigtimedwait(&set, &siginfo, &timeout); } else { signo = sigwaitinfo(&set, &siginfo); } if (signo == -1 && errno != EAGAIN) { PCNTL_G(last_error) = errno; php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", strerror(errno)); } /* * sigtimedwait and sigwaitinfo can return 0 on success on some * platforms, e.g. NetBSD */ if (!signo && siginfo.si_signo) { signo = siginfo.si_signo; } if (signo > 0 && user_siginfo) { if (Z_TYPE_P(user_siginfo) != IS_ARRAY) { zval_dtor(user_siginfo); array_init(user_siginfo); } else { zend_hash_clean(Z_ARRVAL_P(user_siginfo)); } add_assoc_long_ex(user_siginfo, "signo", sizeof("signo"), siginfo.si_signo); add_assoc_long_ex(user_siginfo, "errno", sizeof("errno"), siginfo.si_errno); add_assoc_long_ex(user_siginfo, "code", sizeof("code"), siginfo.si_code); switch(signo) {#ifdef SIGCHLD case SIGCHLD: add_assoc_long_ex(user_siginfo, "status", sizeof("status"), siginfo.si_status);# ifdef si_utime add_assoc_double_ex(user_siginfo, "utime", sizeof("utime"), siginfo.si_utime);# endif# ifdef si_stime add_assoc_double_ex(user_siginfo, "stime", sizeof("stime"), siginfo.si_stime);# endif add_assoc_long_ex(user_siginfo, "pid", sizeof("pid"), siginfo.si_pid); add_assoc_long_ex(user_siginfo, "uid", sizeof("uid"), siginfo.si_uid); break;#endif case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: add_assoc_double_ex(user_siginfo, "addr", sizeof("addr"), (long)siginfo.si_addr); break;#ifdef SIGPOLL case SIGPOLL: add_assoc_long_ex(user_siginfo, "band", sizeof("band"), siginfo.si_band);# ifdef si_fd add_assoc_long_ex(user_siginfo, "fd", sizeof("fd"), siginfo.si_fd);# endif break;#endif//.........这里部分代码省略.........
开发者ID:0,项目名称:php-src,代码行数:101,
示例6: PHP_METHOD//.........这里部分代码省略......... if (eval_int) { PHALCON_INIT_VAR(key); phalcon_array_fetch_string(&key, cache_options, SL("key"), PH_NOISY_CC); } } } if (Z_TYPE_P(key) == IS_NULL) { PHALCON_INIT_VAR(key); PHALCON_CALL_FUNC_PARAMS_1(key, "md5", view_path); } PHALCON_INIT_VAR(cached_view); PHALCON_CALL_METHOD_PARAMS_1(cached_view, cache, "start", key, PH_NO_CHECK); if (Z_TYPE_P(cached_view) != IS_NULL) { phalcon_update_property_zval(this_ptr, SL("_content"), cached_view TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_NULL(); } } PHALCON_INIT_VAR(is_fresh); PHALCON_CALL_METHOD(is_fresh, cache, "isfresh", PH_NO_CHECK); if (!zend_is_true(is_fresh)) { PHALCON_MM_RESTORE(); RETURN_NULL(); } } } if (!phalcon_valid_foreach(engines TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(engines); zend_hash_internal_pointer_reset_ex(ah0, &hp0); fes_ecde_1: if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){ goto fee_ecde_1; } PHALCON_INIT_VAR(extension); PHALCON_GET_FOREACH_KEY(extension, ah0, hp0); PHALCON_INIT_VAR(engine); ZVAL_ZVAL(engine, *hd, 1, 0); PHALCON_INIT_VAR(view_engine_path); PHALCON_CONCAT_VV(view_engine_path, views_dir_path, extension); if (phalcon_file_exists(view_engine_path TSRMLS_CC) == SUCCESS) { if (Z_TYPE_P(events_manager) == IS_OBJECT) { phalcon_update_property_zval(this_ptr, SL("_activeRenderPath"), view_engine_path TSRMLS_CC); PHALCON_INIT_VAR(event_name); ZVAL_STRING(event_name, "view:beforeRenderView", 1); PHALCON_INIT_VAR(status); PHALCON_CALL_METHOD_PARAMS_2(status, events_manager, "fire", event_name, this_ptr, PH_NO_CHECK); if (Z_TYPE_P(status) == IS_BOOL && !Z_BVAL_P(status)) { zend_hash_move_forward_ex(ah0, &hp0); goto fes_ecde_1; } } PHALCON_CALL_METHOD_PARAMS_3_NORETURN(engine, "render", view_engine_path, view_params, must_clean, PH_NO_CHECK); PHALCON_INIT_VAR(not_exists); ZVAL_BOOL(not_exists, 0); if (Z_TYPE_P(events_manager) == IS_OBJECT) { phalcon_update_property_zval(this_ptr, SL("_activeRenderPath"), view_engine_path TSRMLS_CC); PHALCON_INIT_VAR(event_name); ZVAL_STRING(event_name, "view:afterRenderView", 1); PHALCON_INIT_VAR(status); PHALCON_CALL_METHOD_PARAMS_2(status, events_manager, "fire", event_name, this_ptr, PH_NO_CHECK); if (Z_TYPE_P(status) == IS_BOOL && !Z_BVAL_P(status)) { zend_hash_move_forward_ex(ah0, &hp0); goto fes_ecde_1; } } goto fee_ecde_1; } zend_hash_move_forward_ex(ah0, &hp0); goto fes_ecde_1; fee_ecde_1: if (Z_TYPE_P(not_exists) == IS_BOOL && Z_BVAL_P(not_exists)) { if (!zend_is_true(silence)) { PHALCON_INIT_VAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "View '", views_dir_path, "' was not found in the views directory"); PHALCON_INIT_VAR(exception); object_init_ex(exception, phalcon_mvc_view_exception_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(exception, "__construct", exception_message, PH_CHECK); phalcon_throw_exception(exception TSRMLS_CC); return; } } PHALCON_MM_RESTORE();}
开发者ID:meibk,项目名称:cphalcon,代码行数:101,
示例7: PHP_METHOD//.........这里部分代码省略......... * Check the column type to get the correct Phalcon type */ if (phalcon_memnstr_str(column_type, SL("NUMBER") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 3, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_precision, PH_COPY | PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("scale"), &column_scale, PH_COPY | PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("INTEGER") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 0, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_precision, PH_COPY | PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_long(&definition, SL("bindType"), 1, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("VARCHAR2") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("FLOAT") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 7, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_bool(&definition, SL("isNumeric"), 1, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("scale"), &column_scale, PH_COPY | PH_SEPARATE TSRMLS_CC); phalcon_array_update_string_long(&definition, SL("bindType"), 32, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("TIMESTAMP") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 1, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("RAW") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("BLOB") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("CLOB") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("VARCHAR2") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 2, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE TSRMLS_CC); } else { if (phalcon_memnstr_str(column_type, SL("CHAR") TSRMLS_CC)) { phalcon_array_update_string_long(&definition, SL("type"), 5, PH_SEPARATE TSRMLS_CC); phalcon_array_update_string(&definition, SL("size"), &column_size, PH_COPY | PH_SEPARATE TSRMLS_CC); } else { phalcon_array_update_string_long(&definition, SL("type"), 6, PH_SEPARATE TSRMLS_CC); } } } } } } } } } } if (Z_TYPE_P(old_column) == IS_NULL) { phalcon_array_update_string_bool(&definition, SL("first"), 1, PH_SEPARATE TSRMLS_CC); } else { phalcon_array_update_string(&definition, SL("after"), &old_column, PH_COPY | PH_SEPARATE TSRMLS_CC); } /** * Check if the field is primary key */ PHALCON_OBS_NVAR(attribute); phalcon_array_fetch_long(&attribute, field, 6, PH_NOISY_CC); if (PHALCON_IS_STRING(attribute, "P")) { phalcon_array_update_string_bool(&definition, SL("primary"), 1, PH_SEPARATE TSRMLS_CC); } /** * Check if the column allows null values */ PHALCON_OBS_NVAR(attribute); phalcon_array_fetch_long(&attribute, field, 5, PH_NOISY_CC); if (PHALCON_IS_STRING(attribute, "N")) { phalcon_array_update_string_bool(&definition, SL("notNull"), 1, PH_SEPARATE TSRMLS_CC); } PHALCON_OBS_NVAR(column_name); phalcon_array_fetch_long(&column_name, field, 0, PH_NOISY_CC); /** * Create a Phalcon/Db/Column to abstract the column */ PHALCON_INIT_NVAR(column); object_init_ex(column, phalcon_db_column_ce); phalcon_call_method_p2_noret(column, "__construct", column_name, definition); phalcon_array_append(&columns, column, PH_SEPARATE TSRMLS_CC); PHALCON_CPY_WRT(old_column, column_name); zend_hash_move_forward_ex(ah0, &hp0); } RETURN_CTOR(columns);}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:101,
示例8: PHP_METHOD//.........这里部分代码省略......... if (PHALCON_IS_EMPTY(type)) { PHALCON_INIT_NVAR(type); ZVAL_STRING(type, "application/x-www-form-urlencoded", 1); } PHALCON_CALL_METHOD(NULL, header, "set", key, type); PHALCON_INIT_NVAR(constant); zend_get_constant(SL("CURLOPT_POSTFIELDS"), constant TSRMLS_CC); PHALCON_CALL_FUNCTION(NULL, "curl_setopt", curl, constant, data); } else if (phalcon_class_exists(SL("CURLFile"), 0 TSRMLS_CC)) { if (Z_TYPE_P(data) != IS_ARRAY) { PHALCON_INIT_NVAR(data); array_init(data); } if (Z_TYPE_P(files) == IS_ARRAY) { phalcon_is_iterable(files, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HVALUE(file); if (PHALCON_IS_NOT_EMPTY(file)) { curlfile_ce = zend_fetch_class(SL("CURLFile"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); PHALCON_INIT_NVAR(tmp); object_init_ex(tmp, curlfile_ce); PHALCON_CALL_METHOD(NULL, tmp, "__construct", file); phalcon_array_append(&data, tmp, PH_COPY); } zend_hash_move_forward_ex(ah0, &hp0); } } PHALCON_INIT_NVAR(constant); zend_get_constant(SL("CURLOPT_POSTFIELDS"), constant TSRMLS_CC); PHALCON_CALL_FUNCTION(NULL, "curl_setopt", curl, constant, data); } else { PHALCON_CALL_FUNCTION(&uniqid, "uniqid"); PHALCON_INIT_VAR(boundary); PHALCON_CONCAT_SV(boundary, "--------------", uniqid); PHALCON_INIT_VAR(body); if (Z_TYPE_P(data) == IS_ARRAY) { phalcon_is_iterable(data, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(key, ah0, hp0); PHALCON_GET_HVALUE(value); PHALCON_SCONCAT_SVS(body, "--", boundary, "/r/n"); PHALCON_SCONCAT_SVSVS(body, "Content-Disposition: form-data; name=/"", key, "/"/r/n/r/n", value, "/r/n"); zend_hash_move_forward_ex(ah0, &hp0); } } if (Z_TYPE_P(files) == IS_ARRAY) { phalcon_is_iterable(files, &ah1, &hp1, 0, 0); while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) {
开发者ID:Myleft,项目名称:cphalcon,代码行数:67,
示例9: php_stream_wrapper_log_error//.........这里部分代码省略......... NULL, &timeout, context, &errstr, NULL); if (stream) { php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 0, &timeout); } if (errstr) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", errstr); efree(errstr); errstr = NULL; } efree(transport_string); if (stream && use_proxy && use_ssl) { smart_str header = {0}; smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); smart_str_appends(&header, resource->host); smart_str_appendc(&header, ':'); smart_str_append_unsigned(&header, resource->port); smart_str_appendl(&header, " HTTP/1.0/r/n", sizeof(" HTTP/1.0/r/n")-1); /* check if we have Proxy-Authorization header */ if (context && php_stream_context_get_option(context, "http", "header", &tmpzval) == SUCCESS) { char *s, *p; if (Z_TYPE_PP(tmpzval) == IS_ARRAY) { HashPosition pos; zval **tmpheader = NULL; for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(tmpzval), &pos); SUCCESS == zend_hash_get_current_data_ex(Z_ARRVAL_PP(tmpzval), (void *)&tmpheader, &pos); zend_hash_move_forward_ex(Z_ARRVAL_PP(tmpzval), &pos)) { if (Z_TYPE_PP(tmpheader) == IS_STRING) { s = Z_STRVAL_PP(tmpheader); do { while (*s == ' ' || *s == '/t') s++; p = s; while (*p != 0 && *p != ':' && *p != '/r' && *p !='/n') p++; if (*p == ':') { p++; if (p - s == sizeof("Proxy-Authorization:") - 1 && zend_binary_strcasecmp(s, sizeof("Proxy-Authorization:") - 1, "Proxy-Authorization:", sizeof("Proxy-Authorization:") - 1) == 0) { while (*p != 0 && *p != '/r' && *p !='/n') p++; smart_str_appendl(&header, s, p - s); smart_str_appendl(&header, "/r/n", sizeof("/r/n")-1); goto finish; } else { while (*p != 0 && *p != '/r' && *p !='/n') p++; } } s = p; while (*s == '/r' || *s == '/n') s++; } while (*s != 0); } } } else if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { s = Z_STRVAL_PP(tmpzval); do { while (*s == ' ' || *s == '/t') s++; p = s; while (*p != 0 && *p != ':' && *p != '/r' && *p !='/n') p++; if (*p == ':') { p++;
开发者ID:m4ster-git,项目名称:nginx-on-heroku,代码行数:67,
示例10: PHP_METHOD/** * Lists table indexes * * @param string $table * @param string $schema * @return Phalcon/Db/Index[] */PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes){ zval *table, *schema = NULL, *dialect, *fetch_assoc, *sql; zval *describe, *indexes, *index = NULL, *key_name = NULL, *empty_arr = NULL; zval *sql_index_describe = NULL, *describe_index = NULL; zval *index_column = NULL, *column_name = NULL, *index_objects; zval *index_columns = NULL, *name = NULL; HashTable *ah0, *ah1, *ah2; HashPosition hp0, hp1, hp2; zval **hd; char *hash_index; uint hash_index_len; ulong hash_num; int hash_type; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &table, &schema) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!schema) { PHALCON_INIT_NVAR(schema); } PHALCON_INIT_VAR(dialect); phalcon_read_property(&dialect, this_ptr, SL("_dialect"), PH_NOISY_CC); PHALCON_INIT_VAR(fetch_assoc); phalcon_get_class_constant(fetch_assoc, phalcon_db_ce, SS("FETCH_ASSOC") TSRMLS_CC); PHALCON_INIT_VAR(sql); PHALCON_CALL_METHOD_PARAMS_2(sql, dialect, "describeindexes", table, schema, PH_NO_CHECK); PHALCON_INIT_VAR(describe); PHALCON_CALL_METHOD_PARAMS_2(describe, this_ptr, "fetchall", sql, fetch_assoc, PH_NO_CHECK); PHALCON_INIT_VAR(indexes); array_init(indexes); if (!phalcon_valid_foreach(describe TSRMLS_CC)) { return; } ah0 = Z_ARRVAL_P(describe); 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(index); PHALCON_INIT_NVAR(key_name); phalcon_array_fetch_string(&key_name, index, SL("name"), PH_NOISY_CC); eval_int = phalcon_array_isset(indexes, key_name); if (!eval_int) { PHALCON_INIT_NVAR(empty_arr); array_init(empty_arr); phalcon_array_update_zval(&indexes, key_name, &empty_arr, PH_COPY | PH_SEPARATE TSRMLS_CC); } PHALCON_INIT_NVAR(sql_index_describe); PHALCON_CALL_METHOD_PARAMS_1(sql_index_describe, dialect, "describeindex", key_name, PH_NO_CHECK); PHALCON_INIT_NVAR(describe_index); PHALCON_CALL_METHOD_PARAMS_2(describe_index, this_ptr, "fetchall", sql_index_describe, fetch_assoc, PH_NO_CHECK); if (!phalcon_valid_foreach(describe_index TSRMLS_CC)) { return; } ah1 = Z_ARRVAL_P(describe_index); zend_hash_internal_pointer_reset_ex(ah1, &hp1); ph_cycle_start_1: if (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) != SUCCESS) { goto ph_cycle_end_1; } PHALCON_GET_FOREACH_VALUE(index_column); PHALCON_INIT_NVAR(column_name); phalcon_array_fetch_string(&column_name, index_column, SL("name"), PH_NOISY_CC); phalcon_array_update_append_multi_2(&indexes, key_name, column_name, 0 TSRMLS_CC); zend_hash_move_forward_ex(ah1, &hp1); goto ph_cycle_start_1;//.........这里部分代码省略.........
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:101,
示例11: PHP_METHOD/** * Prepare an HTML string of information about a single variable. */PHP_METHOD(Phalcon_Debug_Dump, output){ zval *variable, *name = NULL, *tab = NULL, *space, *tmp = NULL, *new_tab = NULL; zval *output = NULL, *str = NULL, *type = NULL, *style = NULL, *count = NULL, *key = NULL, *value = NULL, *replace_pairs = NULL; zval *class_name = NULL, *objects, *detailed = NULL, *properties = NULL, *methods = NULL, *method = NULL; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 2, &variable, &name, &tab); if (!name) { name = PHALCON_GLOBAL(z_null); } else if (!PHALCON_IS_EMPTY(name)) { PHALCON_CONCAT_SVS(return_value, "var ", name, " "); } if (!tab) { tab = PHALCON_GLOBAL(z_one); } PHALCON_INIT_VAR(space); ZVAL_STRING(space, " ", 1); if (Z_TYPE_P(variable) == IS_ARRAY) { PHALCON_INIT_NVAR(str); ZVAL_STRING(str, "<b style =':style'>Array</b> (<span style =':style'>:count</span>) (/n", 1); PHALCON_INIT_NVAR(type); ZVAL_STRING(type, "arr", 1); PHALCON_CALL_SELF(&style, "getstyle", type); PHALCON_INIT_NVAR(count); ZVAL_LONG(count, phalcon_fast_count_int(variable TSRMLS_CC)); PHALCON_INIT_NVAR(replace_pairs); array_init(replace_pairs); phalcon_array_update_string(&replace_pairs, SL(":style"), style, PH_COPY); phalcon_array_update_string(&replace_pairs, SL(":count"), count, PH_COPY); PHALCON_INIT_NVAR(output); phalcon_strtr_array(output, str, replace_pairs TSRMLS_CC); phalcon_concat_self(&return_value, output TSRMLS_CC); phalcon_is_iterable(variable, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(key, ah0, hp0); PHALCON_GET_HVALUE(value); PHALCON_CALL_FUNCTION(&tmp, "str_repeat", space, tab); phalcon_concat_self(&return_value, tmp TSRMLS_CC); PHALCON_INIT_NVAR(str); ZVAL_STRING(str, "[<span style=':style'>:key</span>] => ", 1); PHALCON_INIT_NVAR(type); ZVAL_STRING(type, "arr", 1); PHALCON_CALL_SELF(&style, "getstyle", type); PHALCON_INIT_NVAR(replace_pairs); array_init(replace_pairs); phalcon_array_update_string(&replace_pairs, SL(":style"), style, PH_COPY); phalcon_array_update_string(&replace_pairs, SL(":key"), key, PH_COPY); PHALCON_INIT_NVAR(output); phalcon_strtr_array(output, str, replace_pairs TSRMLS_CC); phalcon_concat_self(&return_value, output TSRMLS_CC); if (PHALCON_IS_LONG(tab, 1) && !PHALCON_IS_EMPTY(name) && !phalcon_is_numeric(key) && PHALCON_IS_IDENTICAL(name, key)) { zend_hash_move_forward_ex(ah0, &hp0); continue; } else { PHALCON_INIT_NVAR(new_tab); ZVAL_LONG(new_tab, Z_LVAL_P(tab) + 1); PHALCON_CALL_SELF(&tmp, "output", value, PHALCON_GLOBAL(z_null), new_tab); PHALCON_SCONCAT_VS(return_value, tmp, "/n"); } zend_hash_move_forward_ex(ah0, &hp0); } PHALCON_INIT_NVAR(new_tab); ZVAL_LONG(new_tab, Z_LVAL_P(tab) - 1); PHALCON_CALL_FUNCTION(&tmp, "str_repeat", space, tab);//.........这里部分代码省略.........
开发者ID:Myleft,项目名称:cphalcon,代码行数:101,
示例12: PHP_METHOD/** * Phalcon/Config/Adapter/Ini constructor * * @param string $filePath */PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct){ zval *file_path, *process_sections, *ini_config; zval *exception_message, *config, *directives = NULL; zval *section = NULL, *value = NULL, *key = NULL, *directive_parts = NULL; HashTable *ah0, *ah1; HashPosition hp0, hp1; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &file_path); PHALCON_INIT_VAR(process_sections); ZVAL_BOOL(process_sections, 1); /** * Use the standard parse_ini_file */ PHALCON_INIT_VAR(ini_config); phalcon_call_func_p2(ini_config, "parse_ini_file", file_path, process_sections); /** * Check if the file had errors */ if (PHALCON_IS_FALSE(ini_config)) { PHALCON_INIT_VAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Configuration file ", file_path, " can't be loaded"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_config_exception_ce, exception_message); return; } PHALCON_INIT_VAR(config); array_init(config); phalcon_is_iterable(ini_config, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(section, ah0, hp0); PHALCON_GET_HVALUE(directives); if (unlikely(Z_TYPE_P(directives) != IS_ARRAY)) { Z_ADDREF_P(directives); if (phalcon_array_update_zval(&config, section, &directives, 0) != SUCCESS) { Z_DELREF_P(directives); } zend_hash_move_forward_ex(ah0, &hp0); continue; } phalcon_is_iterable(directives, &ah1, &hp1, 0, 0); if (zend_hash_num_elements(ah1) == 0) { Z_ADDREF_P(directives); phalcon_array_update_zval(&config, section, &directives, 0); zend_hash_move_forward_ex(ah0, &hp0); continue; } while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) { PHALCON_GET_HKEY(key, ah1, hp1); PHALCON_GET_HVALUE(value); if (phalcon_memnstr_str(key, SL("."))) { PHALCON_INIT_NVAR(directive_parts); phalcon_fast_explode_str(directive_parts, SL("."), key); phalcon_config_adapter_ini_update_zval_directive(&config, section, directive_parts, &value, 0 TSRMLS_CC); } else { phalcon_array_update_multi_2(&config, section, key, &value, 0); } zend_hash_move_forward_ex(ah1, &hp1); } zend_hash_move_forward_ex(ah0, &hp0); } /** * Calls the Phalcon/Config constructor */ PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon//Config//Adapter//Ini", "__construct", config); PHALCON_MM_RESTORE();}
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:91,
示例13: PHP_METHOD/** * Produces a recursive representation of an array * * @param array $argument * @return string */PHP_METHOD(Phalcon_Debug, _getArrayDump){ zval *argument, *n = NULL, *number_arguments, *one, *dump; zval *v = NULL, *k = NULL, *var_dump = NULL, *escaped_string = NULL, *next = NULL, *array_dump = NULL; zval *class_name = NULL, *joined_dump; HashTable *ah0; HashPosition hp0; zval **hd; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 1, &argument, &n); if (!n) { PHALCON_INIT_VAR(n); ZVAL_LONG(n, 0); } PHALCON_INIT_VAR(number_arguments); phalcon_fast_count(number_arguments, argument TSRMLS_CC); if (PHALCON_LT_LONG(n, 3)) { if (PHALCON_GT_LONG(number_arguments, 0)) { if (PHALCON_LT_LONG(number_arguments, 10)) { PHALCON_INIT_VAR(one); ZVAL_LONG(one, 1); PHALCON_INIT_VAR(dump); array_init(dump); phalcon_is_iterable(argument, &ah0, &hp0, 0, 0); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(k, ah0, hp0); PHALCON_GET_HVALUE(v); if (PHALCON_IS_SCALAR(v)) { if (PHALCON_IS_STRING(v, "")) { PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVS(var_dump, "[", k, "] => (empty string)"); } else { PHALCON_INIT_NVAR(escaped_string); phalcon_call_method_p1(escaped_string, this_ptr, "_escapestring", v); PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVSV(var_dump, "[", k, "] => ", escaped_string); } phalcon_array_append(&dump, var_dump, PH_SEPARATE); } else { if (Z_TYPE_P(v) == IS_ARRAY) { PHALCON_INIT_NVAR(next); phalcon_add_function(next, n, one TSRMLS_CC); PHALCON_INIT_NVAR(array_dump); phalcon_call_method_p2(array_dump, this_ptr, "_getarraydump", v, next); PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVSVS(var_dump, "[", k, "] => Array(", array_dump, ")"); phalcon_array_append(&dump, var_dump, PH_SEPARATE); zend_hash_move_forward_ex(ah0, &hp0); continue; } if (Z_TYPE_P(v) == IS_OBJECT) { PHALCON_INIT_NVAR(class_name); phalcon_get_class(class_name, v, 0 TSRMLS_CC); PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVSVS(var_dump, "[", k, "] => Object(", class_name, ")"); phalcon_array_append(&dump, var_dump, PH_SEPARATE); zend_hash_move_forward_ex(ah0, &hp0); continue; } if (Z_TYPE_P(v) == IS_NULL) { PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVS(var_dump, "[", k, "] => null"); phalcon_array_append(&dump, var_dump, PH_SEPARATE); zend_hash_move_forward_ex(ah0, &hp0); continue; } PHALCON_INIT_NVAR(var_dump); PHALCON_CONCAT_SVSV(var_dump, "[", k, "] => ", v); phalcon_array_append(&dump, var_dump, PH_SEPARATE); } zend_hash_move_forward_ex(ah0, &hp0); } PHALCON_INIT_VAR(joined_dump); phalcon_fast_join_str(joined_dump, SL(", "), dump TSRMLS_CC); RETURN_CTOR(joined_dump);//.........这里部分代码省略.........
开发者ID:Diego-Brocanelli,项目名称:cphalcon,代码行数:101,
示例14: PHP_METHOD/** * Listens for notifications from the models manager */PHP_METHOD(Phalcon_Mvc_Model_Behavior_Timestampable, notify) { HashTable *_2$$12; HashPosition _1$$12; zephir_fcall_cache_entry *_4 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *type_param = NULL, *model, *options = NULL, *timestamp = NULL, *singleField = NULL, *field = NULL, *generator = NULL, *format = NULL, *_0 = NULL, **_3$$12; zval *type = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &type_param, &model); if (UNEXPECTED(Z_TYPE_P(type_param) != IS_STRING && Z_TYPE_P(type_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'type' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (EXPECTED(Z_TYPE_P(type_param) == IS_STRING)) { zephir_get_strval(type, type_param); } else { ZEPHIR_INIT_VAR(type); ZVAL_EMPTY_STRING(type); } ZEPHIR_CALL_METHOD(&_0, this_ptr, "musttakeaction", NULL, 0, type); zephir_check_call_status(); if (!ZEPHIR_IS_TRUE_IDENTICAL(_0)) { RETURN_MM_NULL(); } ZEPHIR_CALL_METHOD(&options, this_ptr, "getoptions", NULL, 0, type); zephir_check_call_status(); if (Z_TYPE_P(options) == IS_ARRAY) { ZEPHIR_OBS_VAR(field); if (!(zephir_array_isset_string_fetch(&field, options, SS("field"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The option 'field' is required", "phalcon/mvc/model/behavior/timestampable.zep", 56); return; } ZEPHIR_INIT_VAR(timestamp); ZVAL_NULL(timestamp); ZEPHIR_OBS_VAR(format); if (zephir_array_isset_string_fetch(&format, options, SS("format"), 0 TSRMLS_CC)) { ZEPHIR_CALL_FUNCTION(×tamp, "date", NULL, 305, format); zephir_check_call_status(); } else { ZEPHIR_OBS_VAR(generator); if (zephir_array_isset_string_fetch(&generator, options, SS("generator"), 0 TSRMLS_CC)) { if (Z_TYPE_P(generator) == IS_OBJECT) { if (zephir_instance_of_ev(generator, zend_ce_closure TSRMLS_CC)) { ZEPHIR_INIT_NVAR(timestamp); ZEPHIR_CALL_USER_FUNC(timestamp, generator); zephir_check_call_status(); } } } } if (Z_TYPE_P(timestamp) == IS_NULL) { ZEPHIR_INIT_NVAR(timestamp); zephir_time(timestamp); } if (Z_TYPE_P(field) == IS_ARRAY) { zephir_is_iterable(field, &_2$$12, &_1$$12, 0, 0, "phalcon/mvc/model/behavior/timestampable.zep", 94); for ( ; zend_hash_get_current_data_ex(_2$$12, (void**) &_3$$12, &_1$$12) == SUCCESS ; zend_hash_move_forward_ex(_2$$12, &_1$$12) ) { ZEPHIR_GET_HVALUE(singleField, _3$$12); ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", &_4, 0, singleField, timestamp); zephir_check_call_status(); } } else { ZEPHIR_CALL_METHOD(NULL, model, "writeattribute", NULL, 0, field, timestamp); zephir_check_call_status(); } } ZEPHIR_MM_RESTORE();}
开发者ID:zamronypj,项目名称:cphalcon,代码行数:80,
示例15: PHP_METHOD//.........这里部分代码省略......... fes_0c08_1: if(zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) != SUCCESS){ goto fee_0c08_1; } PHALCON_INIT_VAR(extension); ZVAL_ZVAL(extension, *hd, 1, 0); PHALCON_INIT_VAR(r4); PHALCON_CONCAT_VVSV(r4, directory, file_name, ".", extension); PHALCON_INIT_VAR(path); phalcon_fast_str_replace(path, namespace_separator, ds, r4 TSRMLS_CC); if (zend_is_true(events_manager)) { phalcon_update_property_zval(this_ptr, SL("_checkedPath"), path TSRMLS_CC); PHALCON_INIT_VAR(c4); ZVAL_STRING(c4, "loader:beforeCheckPath", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(events_manager, "fire", c4, this_ptr, PH_NO_CHECK); } if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) { if (zend_is_true(events_manager)) { phalcon_update_property_zval(this_ptr, SL("_foundPath"), file_path TSRMLS_CC); PHALCON_INIT_VAR(c5); ZVAL_STRING(c5, "loader:pathFound", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(events_manager, "fire", c5, this_ptr, PH_NO_CHECK); } if (phalcon_require(path TSRMLS_CC) == FAILURE) { return; } PHALCON_MM_RESTORE(); RETURN_TRUE; } zend_hash_move_forward_ex(ah1, &hp1); goto fes_0c08_1; fee_0c08_1: if(0){} } } } zend_hash_move_forward_ex(ah0, &hp0); goto fes_0c08_0; fee_0c08_0: if(0){} } PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, SL("_directories"), PH_NOISY_CC); if (!phalcon_valid_foreach(t0 TSRMLS_CC)) { return; } ah2 = Z_ARRVAL_P(t0); zend_hash_internal_pointer_reset_ex(ah2, &hp2); fes_0c08_2: if(zend_hash_get_current_data_ex(ah2, (void**) &hd, &hp2) != SUCCESS){ goto fee_0c08_2; } PHALCON_INIT_VAR(directory); ZVAL_ZVAL(directory, *hd, 1, 0); if (!phalcon_valid_foreach(extensions TSRMLS_CC)) { return; }
开发者ID:codeanu,项目名称:cphalcon,代码行数:67,
示例16: PHP_METHOD//.........这里部分代码省略......... } PHALCON_INIT_VAR(use_empty); ZVAL_BOOL(use_empty, 0); if (phalcon_array_isset_string(params, SS("useEmpty"))) { if (!phalcon_array_isset_string(params, SS("emptyValue"))) { PHALCON_INIT_VAR(empty_value); ZVAL_STRING(empty_value, "", 1); } else { PHALCON_OBS_NVAR(empty_value); phalcon_array_fetch_string(&empty_value, params, SL("emptyValue"), PH_NOISY); phalcon_array_unset_string(¶ms, SS("emptyValue"), PH_SEPARATE); } if (!phalcon_array_isset_string(params, SS("emptyText"))) { PHALCON_INIT_VAR(empty_text); ZVAL_STRING(empty_text, "Choose...", 1); } else { PHALCON_OBS_NVAR(empty_text); phalcon_array_fetch_string(&empty_text, params, SL("emptyText"), PH_NOISY); phalcon_array_unset_string(¶ms, SS("emptyText"), PH_SEPARATE); } PHALCON_OBS_NVAR(use_empty); phalcon_array_fetch_string(&use_empty, params, SL("useEmpty"), PH_NOISY); phalcon_array_unset_string(¶ms, SS("useEmpty"), PH_SEPARATE); } PHALCON_INIT_VAR(code); ZVAL_STRING(code, "<select", 1); if (Z_TYPE_P(params) == IS_ARRAY) { phalcon_is_iterable(params, &ah0, &hp0, 0, 0); PHALCON_INIT_VAR(escaped); while (zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) == SUCCESS) { PHALCON_GET_HKEY(key, ah0, hp0); PHALCON_GET_HVALUE(avalue); if (Z_TYPE_P(key) != IS_LONG) { if (Z_TYPE_P(avalue) != IS_ARRAY) { phalcon_htmlspecialchars(escaped, avalue, NULL, NULL TSRMLS_CC); PHALCON_SCONCAT_SVSVS(code, " ", key, "=/"", escaped, "/""); zval_dtor(escaped); ZVAL_NULL(escaped); } } zend_hash_move_forward_ex(ah0, &hp0); } } PHALCON_SCONCAT_SV(code, ">", eol); PHALCON_INIT_VAR(close_option); PHALCON_CONCAT_SV(close_option, "</option>", eol); if (zend_is_true(use_empty)) { /** * Create an empty value */ PHALCON_SCONCAT_SVSVV(code, "/t<option value=/"", empty_value, "/">", empty_text, close_option); phalcon_array_unset_string(¶ms, SS("useEmpty"), PH_SEPARATE); } if (phalcon_array_isset_long(params, 1)) { PHALCON_OBS_VAR(options); phalcon_array_fetch_long(&options, params, 1, PH_NOISY); } else { PHALCON_CPY_WRT(options, data); } if (Z_TYPE_P(options) == IS_OBJECT) { /** * The options is a resultset */ if (!phalcon_array_isset_string(params, SS("using"))) { PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "The 'using' parameter is required"); return; } else { PHALCON_OBS_VAR(using); phalcon_array_fetch_string(&using, params, SL("using"), PH_NOISY); if (Z_TYPE_P(using) != IS_ARRAY) { if (Z_TYPE_P(using) != IS_OBJECT) { PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "The 'using' parameter should be an Array"); return; } } } /** * Create the SELECT's option from a resultset */ PHALCON_INIT_VAR(resultset_options); PHALCON_CALL_SELF_PARAMS_4(resultset_options, this_ptr, "_optionsfromresultset", options, using, value, close_option); phalcon_concat_self(&code, resultset_options TSRMLS_CC); } else { if (Z_TYPE_P(options) == IS_ARRAY) {
开发者ID:CreativeOutbreak,项目名称:cphalcon,代码行数:101,
示例17: PHP_METHOD//.........这里部分代码省略......... ah0 = Z_ARRVAL_P(reversed_routes); 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(route); PHALCON_INIT_VAR(methods); PHALCON_CALL_METHOD(methods, route, "gethttpmethods", PH_NO_CHECK); if (Z_TYPE_P(methods) != IS_NULL) { if (Z_TYPE_P(request) == IS_NULL) { PHALCON_INIT_VAR(dependency_injector); phalcon_read_property(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(dependency_injector) != IS_OBJECT) { PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_dispatcher_exception_ce, "A dependency injection container is required to access the 'request' service"); return; } PHALCON_INIT_VAR(service); ZVAL_STRING(service, "request", 1); PHALCON_INIT_VAR(request); PHALCON_CALL_METHOD_PARAMS_1(request, dependency_injector, "getshared", service, PH_NO_CHECK); } PHALCON_INIT_VAR(match_method); PHALCON_CALL_METHOD_PARAMS_1(match_method, request, "ismethod", methods, PH_NO_CHECK); if (PHALCON_IS_FALSE(match_method)) { zend_hash_move_forward_ex(ah0, &hp0); goto ph_cycle_start_0; } } PHALCON_INIT_VAR(pattern); PHALCON_CALL_METHOD(pattern, route, "getcompiledpattern", PH_NO_CHECK); PHALCON_INIT_VAR(have_parenthesis); phalcon_fast_strpos_str(have_parenthesis, pattern, SL("(") TSRMLS_CC); if (PHALCON_IS_NOT_FALSE(have_parenthesis)) { Z_SET_ISREF_P(matches); PHALCON_INIT_VAR(route_found); PHALCON_CALL_FUNC_PARAMS_3(route_found, "preg_match", pattern, real_uri, matches); Z_UNSET_ISREF_P(matches); } else { PHALCON_INIT_VAR(route_found); is_equal_function(route_found, pattern, real_uri TSRMLS_CC); } if (zend_is_true(route_found)) { PHALCON_INIT_VAR(paths); PHALCON_CALL_METHOD(paths, route, "getpaths", PH_NO_CHECK); PHALCON_CPY_WRT(parts, paths); if (Z_TYPE_P(matches) == IS_ARRAY) { if (!phalcon_valid_foreach(paths TSRMLS_CC)) { return; } ah1 = Z_ARRVAL_P(paths); zend_hash_internal_pointer_reset_ex(ah1, &hp1);
开发者ID:peterericchen,项目名称:cphalcon,代码行数:66,
示例18: PHP_METHOD//.........这里部分代码省略......... PHALCON_CONCAT_SVS(exception_message, "Column '", compose_field, "/" isn't part of the column map"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } } else { PHALCON_CPY_WRT(column_field, compose_field); } /** * Some database systems require that we pass the values using bind casting */ if (!phalcon_array_isset(bind_data_types, column_field)) { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Column '", column_field, "/" isn't part of the table columns"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } /** * The attribute could be "protected" so we read using "readattribute" */ PHALCON_CALL_METHOD(&value, record, "readattribute", compose_field); PHALCON_INIT_NVAR(compose_condition); PHALCON_CONCAT_SVSV(compose_condition, "[", compose_field, "] = ?", number); phalcon_array_append(&conditions, compose_condition, PH_SEPARATE); phalcon_array_append(&bind_params, value, PH_SEPARATE); PHALCON_OBS_NVAR(bind_type); phalcon_array_fetch(&bind_type, bind_data_types, column_field, PH_NOISY); phalcon_array_append(&bind_types, bind_type, PH_SEPARATE); phalcon_increment(number); zend_hash_move_forward_ex(ah0, &hp0); } } else { /** * The reversed column map is used in the case to get real column name */ if (Z_TYPE_P(column_map) == IS_ARRAY) { if (phalcon_array_isset(column_map, field)) { PHALCON_OBS_NVAR(column_field); phalcon_array_fetch(&column_field, column_map, field, PH_NOISY); } else { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Column '", field, "/" isn't part of the column map"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } } else { PHALCON_CPY_WRT(column_field, field); } /** * Some database systems require that we pass the values using bind casting */ if (!phalcon_array_isset(bind_data_types, column_field)) { PHALCON_INIT_NVAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "Column '", column_field, "/" isn't part of the table columns"); PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message); return; } /** * We're checking the uniqueness with only one field
开发者ID:100851766,项目名称:cphalcon,代码行数:67,
示例19: PHP_METHOD//.........这里部分代码省略......... PHALCON_CALL_METHOD(&attributes, resource, "getattributes"); /** * Prepare the parameters for the callback */ PHALCON_INIT_NVAR(parameters); array_init_size(parameters, 3); if (Z_TYPE_P(attributes) == IS_ARRAY) { phalcon_array_update_long(&attributes, 0, prefixed_path, PH_COPY); phalcon_array_append(¶meters, attributes, PH_COPY); } else { phalcon_array_append(¶meters, prefixed_path, PH_COPY); } phalcon_array_append(¶meters, local, PH_COPY); phalcon_array_append(¶meters, args, PH_COPY); /** * Call the callback to generate the HTML */ PHALCON_INIT_NVAR(html);/**/ PHALCON_CALL_USER_FUNC_ARRAY(html, callback, parameters); /** * Implicit output prints the content directly */ if (zend_is_true(use_implicit_output)) { zend_print_zval(html, 0); } else { phalcon_concat_self(&output, html TSRMLS_CC); } zend_hash_move_forward_ex(ah0, &hp0); continue; } if (zend_is_true(filter_needed)) { /** * Get the resource's content */ PHALCON_CALL_METHOD(&content, resource, "getcontent", complete_source_path); /** * Check if the resource must be filtered */ PHALCON_CALL_METHOD(&must_filter, resource, "getfilter"); /** * Only filter the resource if it's marked as 'filterable' */ if (zend_is_true(must_filter)) { phalcon_is_iterable(filters, &ah1, &hp1, 0, 0); while (zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) == SUCCESS) { PHALCON_GET_HVALUE(filter); /** * Filters must be valid objects */ if (Z_TYPE_P(filter) != IS_OBJECT) { PHALCON_THROW_EXCEPTION_STR(phalcon_assets_exception_ce, "Filter is invalid"); return;
开发者ID:Myleft,项目名称:cphalcon,代码行数:67,
示例20: PHP_METHOD//.........这里部分代码省略......... }else{ while (!(err = regexec(&re, strp, 1, subs, 0))) { if (subs[0].rm_so == 0 && subs[0].rm_eo) { //ignore empty string strp += subs[0].rm_eo; }else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) { }else{ size = subs[0].rm_so; add_next_index_stringl(path_array, strp, size, 1); strp += size; } } if (!err || err == REG_NOMATCH) { size = endp - strp; if(size>0) add_next_index_stringl(path_array, strp, size, 1); } regfree(&re); } efree(regex); //}}} int n_elems = zend_hash_num_elements(Z_ARRVAL_P(path_array)); if(zend_hash_index_find(Z_ARRVAL_P(path_array), 0, (void **)&token) != FAILURE) { zone = *token; } if(zend_hash_index_find(Z_ARRVAL_P(path_array), 1, (void **)&token) != FAILURE) { page = *token; } if(zend_hash_index_find(Z_ARRVAL_P(path_array), 2, (void **)&token) != FAILURE) { entry = *token; } } if(!zone){ zone = zend_read_static_property(slightphp_ce_ptr,"defaultZone",sizeof("defaultZone")-1,1 TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(path_array),&zone,sizeof(zval*),NULL); } if(!page){ page = zend_read_static_property(slightphp_ce_ptr,"defaultPage",sizeof("defaultPage")-1,1 TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(path_array),&page,sizeof(zval*),NULL); } if(!entry){ entry = zend_read_static_property(slightphp_ce_ptr,"defaultEntry",sizeof("defaultEntry")-1,1 TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(path_array),&entry,sizeof(zval*),NULL); } //{{{ zval *zoneAlias = zend_read_static_property(slightphp_ce_ptr,"zoneAlias",sizeof("zoneAlias")-1,1 TSRMLS_CC); if(zoneAlias && Z_TYPE_P(zoneAlias)==IS_ARRAY){ char *string_key;uint str_key_len;ulong num_key; HashPosition pos; zval **entry2; zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(zoneAlias), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(zoneAlias), (void **)&entry2, &pos) == SUCCESS) { if(strcmp(Z_STRVAL_PP(entry2) ,Z_STRVAL_P(zone))==0){ switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(zoneAlias), &string_key, &str_key_len, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: ZVAL_STRING(zone,string_key,1); break; } } zend_hash_move_forward_ex(Z_ARRVAL_P(zoneAlias), &pos); } if(entry2)zval_ptr_dtor(entry2); if(string_key)efree(string_key); } //if(zoneAlias)FREE_ZVAL(zoneAlias); //}}} if(!isPart){ zend_update_static_property(slightphp_ce_ptr,"zone",sizeof("zone")-1,zone TSRMLS_CC); zend_update_static_property(slightphp_ce_ptr,"page",sizeof("page")-1,page TSRMLS_CC); zend_update_static_property(slightphp_ce_ptr,"entry",sizeof("entry")-1,entry TSRMLS_CC); }else{ if( strcmp(Z_STRVAL_P(zone),Z_STRVAL_P(zend_read_static_property(slightphp_ce_ptr,"zone",sizeof("zone")-1,1 TSRMLS_CC)))==0 && strcmp(Z_STRVAL_P(page),Z_STRVAL_P(zend_read_static_property(slightphp_ce_ptr,"page",sizeof("page")-1,1 TSRMLS_CC)))==0 && strcmp(Z_STRVAL_P(entry),Z_STRVAL_P(zend_read_static_property(slightphp_ce_ptr,"entry",sizeof("entry")-1,1 TSRMLS_CC)))==0 ){ debug("part ignored [%s]",Z_STRVAL_P(path)); return; } } zval *appDir = zend_read_static_property(slightphp_ce_ptr,"appDir",sizeof("appDir")-1,1 TSRMLS_CC); zval *params[1]; params[0]=path_array; if(slightphp_load(appDir,zone,page TSRMLS_CC) == SUCCESS){ if(slightphp_run(zone,page,entry,return_value,1,params TSRMLS_CC)==SUCCESS){ if(path_array)FREE_ZVAL(path_array); RETURN_ZVAL(return_value,1,0); }; } if(path_array)FREE_ZVAL(path_array); RETURN_FALSE;}
开发者ID:IYism,项目名称:slightphp,代码行数:101,
注:本文中的zend_hash_move_forward_ex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_next_index_insert函数代码示例 C++ zend_hash_move_forward函数代码示例 |