本文整理汇总了C++中zephir_fetch_params函数的典型用法代码示例。如果您正苦于以下问题:C++ zephir_fetch_params函数的具体用法?C++ zephir_fetch_params怎么用?C++ zephir_fetch_params使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zephir_fetch_params函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* @param \Ouchbase\Entity entity
* @param bool concurrent If entity may have concurrent updates
* @throws \Ouchbase\Exception\EntityLogicException
* @return this
*/
PHP_METHOD(Ouchbase_Repository, refresh) {
zephir_fcall_cache_entry *_12 = NULL, *_14 = NULL, *_15 = NULL;
HashTable *_9;
HashPosition _8;
zval *_4;
int ZEPHIR_LAST_CALL_STATUS;
zend_bool concurrent;
zval *entity = NULL, *concurrent_param = NULL, *_0, *_1 = NULL, *_2, *_3 = NULL, *cas, *data = NULL, *dataWithCas = NULL, *_5 = NULL, *refreshed = NULL, *_6, *property = NULL, *propertyReflection = NULL, *_7 = NULL, **_10, *_11 = NULL, *_13 = NULL, *_16;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &entity, &concurrent_param);
ZEPHIR_SEPARATE_PARAM(entity);
if (!concurrent_param) {
concurrent = 0;
} else {
concurrent = zephir_get_boolval(concurrent_param);
}
if (!(zephir_instance_of_ev(entity, ouchbase_entity_ce TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_InvalidArgumentException, "Parameter 'entity' must be an instance of 'Ouchbase\\Entity'", "", 0);
return;
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(&_1, _0, "contains", NULL, entity);
zephir_check_call_status();
if (!(zephir_is_true(_1))) {
ZEPHIR_INIT_VAR(_2);
object_init_ex(_2, ouchbase_exception_entitylogicexception_ce);
ZEPHIR_INIT_VAR(_3);
ZVAL_STRING(_3, "was not persisted", 0);
ZEPHIR_CALL_METHOD(NULL, _2, "__construct", NULL, entity, _3);
zephir_check_temp_parameter(_3);
zephir_check_call_status();
zephir_throw_exception_debug(_2, "ouchbase/Repository.zep", 97 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
if (zephir_instance_of_ev(entity, ouchbase_entityproxy_ce TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&entity, entity, "_getobject", NULL);
zephir_check_call_status();
}
ZEPHIR_INIT_VAR(_4);
array_init_size(_4, 2);
ZEPHIR_CALL_METHOD(&_5, entity, "getid", NULL);
zephir_check_call_status();
zephir_array_fast_append(_4, _5);
ZEPHIR_INIT_NVAR(_3);
ZVAL_STRING(_3, "__getWithCas", 0);
ZEPHIR_CALL_METHOD(&dataWithCas, this_ptr, "executewithouttimeouts", NULL, _3, _4);
zephir_check_temp_parameter(_3);
zephir_check_call_status();
ZEPHIR_OBS_VAR(data);
zephir_array_fetch_string(&data, dataWithCas, SL("data"), PH_NOISY TSRMLS_CC);
ZEPHIR_OBS_VAR(cas);
zephir_array_fetch_string(&cas, dataWithCas, SL("cas"), PH_NOISY TSRMLS_CC);
if (!(zephir_is_true(data))) {
RETURN_THIS();
}
if (!(Z_TYPE_P(data) == IS_ARRAY)) {
ZEPHIR_INIT_NVAR(_3);
zephir_json_decode(_3, &(_3), data, zephir_get_intval(ZEPHIR_GLOBAL(global_true)) TSRMLS_CC);
ZEPHIR_CPY_WRT(data, _3);
}
ZEPHIR_CALL_METHOD(&refreshed, this_ptr, "toobject", NULL, data);
zephir_check_call_status();
_6 = zephir_fetch_nproperty_this(this_ptr, SL("im"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(NULL, _6, "updateoriginaldata", NULL, entity, data);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_5, this_ptr, "getclassreflection", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_7, _5, "getproperties", NULL);
zephir_check_call_status();
zephir_is_iterable(_7, &_9, &_8, 0, 0);
for (
; zephir_hash_get_current_data_ex(_9, (void**) &_10, &_8) == SUCCESS
; zephir_hash_move_forward_ex(_9, &_8)
) {
ZEPHIR_GET_HVALUE(property, _10);
ZEPHIR_CALL_METHOD(&_11, property, "getname", NULL);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&propertyReflection, this_ptr, "getpropertyreflection", &_12, _11);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_13, propertyReflection, "getvalue", &_14, refreshed);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, propertyReflection, "setvalue", &_15, entity, _13);
zephir_check_call_status();
}
if (concurrent) {
_16 = zephir_fetch_nproperty_this(this_ptr, SL("uow"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(NULL, _16, "persist", NULL, entity, cas);
zephir_check_call_status();
//.........这里部分代码省略.........
示例2: PHP_METHOD
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
PHP_METHOD(Xpl_ClassLoader, add) {
zend_bool prepend;
zval *prefix, *paths = NULL, *prepend_param = NULL, *firstChar = NULL, *prefixPaths = NULL, _4, _5, *_6, *_7, *_0$$5, *_1$$5, *_2$$6, *_3$$6, *_8$$9, *_9$$10;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 1, &prefix, &paths, &prepend_param);
ZEPHIR_SEPARATE_PARAM(paths);
if (!prepend_param) {
prepend = 0;
} else {
prepend = zephir_get_boolval(prepend_param);
}
if (Z_TYPE_P(paths) == IS_STRING) {
ZEPHIR_INIT_NVAR(paths);
zephir_create_array(paths, 1, 0 TSRMLS_CC);
zephir_array_fast_append(paths, paths);
}
if (Z_TYPE_P(prefix) != IS_STRING) {
if (prepend) {
ZEPHIR_INIT_VAR(_0$$5);
_1$$5 = zephir_fetch_nproperty_this(this_ptr, SL("fallbackDirsPsr0"), PH_NOISY_CC);
zephir_fast_array_merge(_0$$5, &(paths), &(_1$$5) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("fallbackDirsPsr0"), _0$$5 TSRMLS_CC);
} else {
ZEPHIR_INIT_VAR(_2$$6);
_3$$6 = zephir_fetch_nproperty_this(this_ptr, SL("fallbackDirsPsr0"), PH_NOISY_CC);
zephir_fast_array_merge(_2$$6, &(_3$$6), &(paths) TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("fallbackDirsPsr0"), _2$$6 TSRMLS_CC);
}
RETURN_MM_NULL();
}
ZEPHIR_SINIT_VAR(_4);
ZVAL_LONG(&_4, 0);
ZEPHIR_SINIT_VAR(_5);
ZVAL_LONG(&_5, 1);
ZEPHIR_INIT_VAR(firstChar);
zephir_substr(firstChar, prefix, 0 , 1 , 0);
ZEPHIR_OBS_VAR(prefixPaths);
_6 = zephir_fetch_nproperty_this(this_ptr, SL("prefixesPsr0"), PH_NOISY_CC);
zephir_array_fetch(&_7, _6, firstChar, PH_READONLY, "xpl/classloader.zep", 262 TSRMLS_CC);
if (!(zephir_array_isset_fetch(&prefixPaths, _7, prefix, 0 TSRMLS_CC))) {
ZEPHIR_CPY_WRT(prefixPaths, paths);
} else {
if (prepend) {
ZEPHIR_INIT_VAR(_8$$9);
zephir_fast_array_merge(_8$$9, &(paths), &(prefixPaths) TSRMLS_CC);
ZEPHIR_CPY_WRT(prefixPaths, _8$$9);
} else {
ZEPHIR_INIT_VAR(_9$$10);
zephir_fast_array_merge(_9$$10, &(prefixPaths), &(paths) TSRMLS_CC);
ZEPHIR_CPY_WRT(prefixPaths, _9$$10);
}
}
zephir_update_property_array_multi(this_ptr, SL("prefixesPsr0"), &prefixPaths TSRMLS_CC, SL("zz"), 2, firstChar, prefix);
ZEPHIR_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Removes padding @a padding_type from @a text
* If the function detects that the text was not padded, it will return it unmodified
*
* @param return_value Result, possibly unpadded
* @param text Message to be unpadded
* @param mode Encryption mode; unpadding is applied only in CBC or ECB mode
* @param block_size Cipher block size
* @param padding_type Padding scheme
*/
PHP_METHOD(Phalcon_Crypt, _cryptUnpadText) {
unsigned char _14, _16;
zephir_fcall_cache_entry *_6 = NULL, *_9 = NULL, *_11 = NULL;
zend_bool _0, _1, _2, _13, _15;
long length;
int blockSize, paddingType, i, paddingSize = 0, ord, ZEPHIR_LAST_CALL_STATUS;
zval *text_param = NULL, *mode_param = NULL, *blockSize_param = NULL, *paddingType_param = NULL, *padding = NULL, *last = NULL, _3 = zval_used_for_init, _4 = zval_used_for_init, *_5 = NULL, _7 = zval_used_for_init, *_8 = NULL, *_10 = NULL, *_12 = NULL;
zval *text = NULL, *mode = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 4, 0, &text_param, &mode_param, &blockSize_param, &paddingType_param);
zephir_get_strval(text, text_param);
if (unlikely(Z_TYPE_P(mode_param) != IS_STRING && Z_TYPE_P(mode_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'mode' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(mode_param) == IS_STRING)) {
zephir_get_strval(mode, mode_param);
} else {
ZEPHIR_INIT_VAR(mode);
ZVAL_EMPTY_STRING(mode);
}
if (unlikely(Z_TYPE_P(blockSize_param) != IS_LONG)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'blockSize' must be a long/integer") TSRMLS_CC);
RETURN_MM_NULL();
}
blockSize = Z_LVAL_P(blockSize_param);
if (unlikely(Z_TYPE_P(paddingType_param) != IS_LONG)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'paddingType' must be a long/integer") TSRMLS_CC);
RETURN_MM_NULL();
}
paddingType = Z_LVAL_P(paddingType_param);
length = zephir_fast_strlen_ev(text);
_0 = length > 0;
if (_0) {
_0 = (zephir_safe_mod_long_long(length, blockSize TSRMLS_CC) == 0);
}
_1 = _0;
if (_1) {
_2 = ZEPHIR_IS_STRING(mode, "cbc");
if (!(_2)) {
_2 = ZEPHIR_IS_STRING(mode, "ecb");
}
_1 = _2;
}
if (_1) {
do {
if (paddingType == 1) {
ZEPHIR_SINIT_VAR(_3);
ZVAL_LONG(&_3, (length - 1));
ZEPHIR_SINIT_VAR(_4);
ZVAL_LONG(&_4, 1);
ZEPHIR_INIT_VAR(last);
zephir_substr(last, text, zephir_get_intval(&_3), 1 , 0);
ZEPHIR_CALL_FUNCTION(&_5, "ord", &_6, 130, last);
zephir_check_call_status();
ord = zephir_get_intval(_5);
if (ord <= blockSize) {
paddingSize = ord;
ZEPHIR_SINIT_VAR(_7);
ZVAL_LONG(&_7, 0);
ZEPHIR_CALL_FUNCTION(&_8, "chr", &_9, 128, &_7);
zephir_check_call_status();
ZEPHIR_SINIT_NVAR(_7);
ZVAL_LONG(&_7, (paddingSize - 1));
ZEPHIR_CALL_FUNCTION(&_10, "str_repeat", &_11, 129, _8, &_7);
zephir_check_call_status();
ZEPHIR_INIT_VAR(padding);
ZEPHIR_CONCAT_VV(padding, _10, last);
ZEPHIR_SINIT_NVAR(_7);
ZVAL_LONG(&_7, (length - paddingSize));
ZEPHIR_INIT_VAR(_12);
zephir_substr(_12, text, zephir_get_intval(&_7), 0, ZEPHIR_SUBSTR_NO_LENGTH);
if (!ZEPHIR_IS_EQUAL(_12, padding)) {
paddingSize = 0;
}
}
break;
}
if (paddingType == 2) {
ZEPHIR_SINIT_NVAR(_3);
ZVAL_LONG(&_3, (length - 1));
ZEPHIR_SINIT_NVAR(_4);
//.........这里部分代码省略.........
示例4: PHP_METHOD
/**
* Converts bound parameters such as :name: or ?1 into PDO bind params ?
*
*<code>
* print_r($connection->convertBoundParams('SELECT * FROM robots WHERE name = :name:', array('Bender')));
*</code>
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams) {
HashTable *_3$$3;
HashPosition _2$$3;
int ZEPHIR_LAST_CALL_STATUS, setOrder = 0;
zval *params = NULL;
zval *sql_param = NULL, *params_param = NULL, *boundSql = NULL, *placeHolders = NULL, *bindPattern = NULL, *matches = NULL, *placeMatch = NULL, *value = NULL, *_0, *_1 = NULL, **_4$$3, *_7$$3, *_5$$4, *_6$$6;
zval *sql = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &sql_param, ¶ms_param);
if (unlikely(Z_TYPE_P(sql_param) != IS_STRING && Z_TYPE_P(sql_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sql' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(sql_param) == IS_STRING)) {
zephir_get_strval(sql, sql_param);
} else {
ZEPHIR_INIT_VAR(sql);
ZVAL_EMPTY_STRING(sql);
}
if (!params_param) {
ZEPHIR_INIT_VAR(params);
array_init(params);
} else {
zephir_get_arrval(params, params_param);
}
ZEPHIR_INIT_VAR(placeHolders);
array_init(placeHolders);
ZEPHIR_INIT_VAR(bindPattern);
ZVAL_STRING(bindPattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/", 1);
ZEPHIR_INIT_VAR(matches);
ZVAL_NULL(matches);
setOrder = 2;
ZEPHIR_INIT_VAR(_0);
ZVAL_LONG(_0, setOrder);
ZEPHIR_MAKE_REF(matches);
ZEPHIR_CALL_FUNCTION(&_1, "preg_match_all", NULL, 38, bindPattern, sql, matches, _0);
ZEPHIR_UNREF(matches);
zephir_check_call_status();
if (zephir_is_true(_1)) {
zephir_is_iterable(matches, &_3$$3, &_2$$3, 0, 0, "phalcon/db/adapter/pdo.zep", 483);
for (
; zephir_hash_get_current_data_ex(_3$$3, (void**) &_4$$3, &_2$$3) == SUCCESS
; zephir_hash_move_forward_ex(_3$$3, &_2$$3)
) {
ZEPHIR_GET_HVALUE(placeMatch, _4$$3);
ZEPHIR_OBS_NVAR(value);
zephir_array_fetch_long(&_5$$4, placeMatch, 1, PH_READONLY, "phalcon/db/adapter/pdo.zep", 470 TSRMLS_CC);
if (!(zephir_array_isset_fetch(&value, params, _5$$4, 0 TSRMLS_CC))) {
if (zephir_array_isset_long(placeMatch, 2)) {
ZEPHIR_OBS_NVAR(value);
zephir_array_fetch_long(&_6$$6, placeMatch, 2, PH_READONLY, "phalcon/db/adapter/pdo.zep", 472 TSRMLS_CC);
if (!(zephir_array_isset_fetch(&value, params, _6$$6, 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 473);
return;
}
} else {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 476);
return;
}
}
zephir_array_append(&placeHolders, value, PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 480);
}
ZEPHIR_INIT_VAR(_7$$3);
ZVAL_STRING(_7$$3, "?", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 39, bindPattern, _7$$3, sql);
zephir_check_temp_parameter(_7$$3);
zephir_check_call_status();
} else {
ZEPHIR_CPY_WRT(boundSql, sql);
}
zephir_create_array(return_value, 2, 0 TSRMLS_CC);
zephir_array_update_string(&return_value, SL("sql"), &boundSql, PH_COPY | PH_SEPARATE);
zephir_array_update_string(&return_value, SL("params"), &placeHolders, PH_COPY | PH_SEPARATE);
RETURN_MM();
}
示例5: PHP_METHOD
/**
*
* @param array rawData
* <code>
* rawData = ["service":"Demo", "method":"demo", "args": <ProtoBuffer>]
* </code>
* @return <ProtoBuffer>
* @throw \Exception
*
*/
PHP_METHOD(PhalconPlus_RPC_Server_AbstractServer, callByObject) {
zend_bool _3;
zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *rawData_param = NULL, *service = NULL, *method = NULL, *request, *response = NULL, *logId = NULL, *message = NULL, *_0 = NULL, *_1 = NULL, *_4, *_5 = NULL, *_6, *_7 = NULL, *_8 = NULL, *_9, *_10 = NULL;
zval *rawData = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &rawData_param);
zephir_get_arrval(rawData, rawData_param);
ZEPHIR_INIT_VAR(logId);
ZVAL_STRING(logId, "", 1);
ZEPHIR_INIT_VAR(message);
ZVAL_STRING(message, "", 1);
ZEPHIR_OBS_VAR(service);
if (!(zephir_array_isset_string_fetch(&service, rawData, SS("service"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_VAR(_0);
object_init_ex(_0, zend_exception_get_default(TSRMLS_C));
ZEPHIR_INIT_VAR(_1);
ZEPHIR_CONCAT_SVS(_1, "service ", service, " not exists");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_2, _1);
zephir_check_call_status();
zephir_throw_exception_debug(_0, "phalconplus/RPC/Server/AbstractServer.zep", 78 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_VAR(method);
if (!(zephir_array_isset_string_fetch(&method, rawData, SS("method"), 0 TSRMLS_CC))) {
ZEPHIR_INIT_NVAR(_0);
object_init_ex(_0, zend_exception_get_default(TSRMLS_C));
ZEPHIR_INIT_LNVAR(_1);
ZEPHIR_CONCAT_SVS(_1, "method ", method, " not exists");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_2, _1);
zephir_check_call_status();
zephir_throw_exception_debug(_0, "phalconplus/RPC/Server/AbstractServer.zep", 82 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_OBS_VAR(request);
if (!(zephir_array_isset_string_fetch(&request, rawData, SS("args"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "args not exists", "phalconplus/RPC/Server/AbstractServer.zep", 86);
return;
}
ZEPHIR_INIT_NVAR(_0);
zephir_fast_trim(_0, service, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
ZEPHIR_CPY_WRT(service, _0);
ZEPHIR_INIT_NVAR(_0);
zephir_fast_trim(_0, method, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC);
ZEPHIR_CPY_WRT(method, _0);
_3 = ZEPHIR_IS_EMPTY(service);
if (!(_3)) {
_3 = ZEPHIR_IS_EMPTY(method);
}
if (_3) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "service:method(args) must exists. All of them!!!", "phalconplus/RPC/Server/AbstractServer.zep", 93);
return;
}
ZEPHIR_OBS_NVAR(logId);
if (zephir_array_isset_string_fetch(&logId, rawData, SS("logId"), 0 TSRMLS_CC)) {
}
_4 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "logger", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_5, _4, "has", NULL, _0);
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (zephir_is_true(_5)) {
ZEPHIR_INIT_NVAR(_0);
zephir_json_encode(_0, &(_0), request, 0 TSRMLS_CC);
ZEPHIR_INIT_NVAR(message);
ZEPHIR_CONCAT_SVSVSVSV(message, "RPC Request - logId: ", logId, ", invoke: ", service, "::", method, ", args: ", _0);
_6 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_8);
ZVAL_STRING(_8, "logger", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_7, _6, "get", NULL, _8);
zephir_check_temp_parameter(_8);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, _7, "log", NULL, message);
zephir_check_call_status();
}
ZEPHIR_CALL_METHOD(&response, this_ptr, "callbyparams", NULL, service, method, request, rawData);
zephir_check_call_status();
_6 = zephir_fetch_nproperty_this(this_ptr, SL("di"), PH_NOISY_CC);
ZEPHIR_INIT_NVAR(_0);
ZVAL_STRING(_0, "logger", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_7, _6, "has", NULL, _0);
//.........这里部分代码省略.........
示例6: PHP_METHOD
/**
* Generates the SQL for LIMIT clause
*/
PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit) {
int limit = 0, offset;
zval *sqlQuery_param = NULL, *number, *_0$$4, *_1$$4, _2$$4, *_3$$3, *_4$$3, _5$$3, *_6$$5, _7$$5, _9$$6, _11$$7;
zval *sqlQuery = NULL, *_8, *_10$$6, *_12$$7;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number);
if (unlikely(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(sqlQuery_param) == IS_STRING)) {
zephir_get_strval(sqlQuery, sqlQuery_param);
} else {
ZEPHIR_INIT_VAR(sqlQuery);
ZVAL_EMPTY_STRING(sqlQuery);
}
offset = 0;
if (Z_TYPE_P(number) == IS_ARRAY) {
if (zephir_array_isset_long(number, 1)) {
ZEPHIR_INIT_VAR(_0$$4);
zephir_array_fetch_long(&_1$$4, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 51 TSRMLS_CC);
ZEPHIR_SINIT_VAR(_2$$4);
ZVAL_STRING(&_2$$4, "'", 0);
zephir_fast_trim(_0$$4, _1$$4, &_2$$4, ZEPHIR_TRIM_BOTH TSRMLS_CC);
offset = zephir_get_intval(_0$$4);
}
ZEPHIR_INIT_VAR(_3$$3);
zephir_array_fetch_long(&_4$$3, number, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 54 TSRMLS_CC);
ZEPHIR_SINIT_VAR(_5$$3);
ZVAL_STRING(&_5$$3, "'", 0);
zephir_fast_trim(_3$$3, _4$$3, &_5$$3, ZEPHIR_TRIM_BOTH TSRMLS_CC);
limit = (zephir_get_intval(_3$$3) + offset);
} else {
ZEPHIR_INIT_VAR(_6$$5);
ZEPHIR_SINIT_VAR(_7$$5);
ZVAL_STRING(&_7$$5, "'", 0);
zephir_fast_trim(_6$$5, number, &_7$$5, ZEPHIR_TRIM_BOTH TSRMLS_CC);
limit = zephir_get_intval(_6$$5);
}
ZEPHIR_INIT_VAR(_8);
ZEPHIR_CONCAT_SVS(_8, "SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (", sqlQuery, ") Z1");
ZEPHIR_CPY_WRT(sqlQuery, _8);
if (limit != 0) {
ZEPHIR_SINIT_VAR(_9$$6);
ZVAL_LONG(&_9$$6, limit);
ZEPHIR_INIT_VAR(_10$$6);
ZEPHIR_CONCAT_SV(_10$$6, " WHERE ROWNUM <= ", &_9$$6);
zephir_concat_self(&sqlQuery, _10$$6 TSRMLS_CC);
}
zephir_concat_self_str(&sqlQuery, ")", sizeof(")")-1 TSRMLS_CC);
if (offset != 0) {
ZEPHIR_SINIT_VAR(_11$$7);
ZVAL_LONG(&_11$$7, offset);
ZEPHIR_INIT_VAR(_12$$7);
ZEPHIR_CONCAT_SV(_12$$7, " WHERE PHALCON_RN >= ", &_11$$7);
zephir_concat_self(&sqlQuery, _12$$7 TSRMLS_CC);
}
RETURN_CTOR(sqlQuery);
}
示例7: PHP_METHOD
/**
* Executes the validation
*/
PHP_METHOD(Phalcon_Validation_Validator_Digit, validate) {
zend_bool _2;
int ZEPHIR_LAST_CALL_STATUS;
zval *field = NULL;
zval *validation, *field_param = NULL, *value = NULL, *message = NULL, *label = NULL, *replacePairs, *_0 = NULL, *_1 = NULL, *_3 = NULL, *_4 = NULL, *_5;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 2, 0, &validation, &field_param);
if (unlikely(Z_TYPE_P(field_param) != IS_STRING && Z_TYPE_P(field_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'field' must be a string") TSRMLS_CC);
RETURN_MM_NULL();
}
if (likely(Z_TYPE_P(field_param) == IS_STRING)) {
zephir_get_strval(field, field_param);
} else {
ZEPHIR_INIT_VAR(field);
ZVAL_EMPTY_STRING(field);
}
ZEPHIR_CALL_METHOD(&value, validation, "getvalue", NULL, 0, field);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_1);
ZVAL_STRING(_1, "allowEmpty", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "issetoption", NULL, 0, _1);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
_2 = zephir_is_true(_0);
if (_2) {
_2 = ZEPHIR_IS_EMPTY(value);
}
if (_2) {
RETURN_MM_BOOL(1);
}
ZEPHIR_CALL_FUNCTION(&_3, "ctype_digit", NULL, 434, value);
zephir_check_call_status();
if (!(zephir_is_true(_3))) {
ZEPHIR_INIT_NVAR(_1);
ZVAL_STRING(_1, "label", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&label, this_ptr, "getoption", NULL, 0, _1);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(label)) {
ZEPHIR_CALL_METHOD(&label, validation, "getlabel", NULL, 0, field);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_1);
ZVAL_STRING(_1, "message", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _1);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
ZEPHIR_INIT_VAR(replacePairs);
zephir_create_array(replacePairs, 1, 0 TSRMLS_CC);
zephir_array_update_string(&replacePairs, SL(":field"), &label, PH_COPY | PH_SEPARATE);
if (ZEPHIR_IS_EMPTY(message)) {
ZEPHIR_INIT_NVAR(_1);
ZVAL_STRING(_1, "Digit", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(&message, validation, "getdefaultmessage", NULL, 0, _1);
zephir_check_temp_parameter(_1);
zephir_check_call_status();
}
ZEPHIR_INIT_NVAR(_1);
object_init_ex(_1, phalcon_validation_message_ce);
ZEPHIR_CALL_FUNCTION(&_4, "strtr", NULL, 53, message, replacePairs);
zephir_check_call_status();
ZEPHIR_INIT_VAR(_5);
ZVAL_STRING(_5, "Digit", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 430, _4, field, _5);
zephir_check_temp_parameter(_5);
zephir_check_call_status();
ZEPHIR_CALL_METHOD(NULL, validation, "appendmessage", NULL, 0, _1);
zephir_check_call_status();
RETURN_MM_BOOL(0);
}
RETURN_MM_BOOL(1);
}
示例8: PHP_METHOD
/**
* Transforms an intermediate representation for a expression into a database system valid expression
*
* @param array expression
* @param string escapeChar
* @return string
*/
PHP_METHOD(Pdm_Db_AbstractDialect, getSqlExpression) {
zephir_fcall_cache_entry *_10 = NULL;
HashTable *_7, *_13;
HashPosition _6, _12;
int ZEPHIR_LAST_CALL_STATUS;
zval *escapeChar = NULL, *_1 = NULL;
zval *expression, *escapeChar_param = NULL, *type, *domain, *operator, *left = NULL, *right = NULL, *name = NULL, *sqlItems, *escapedName = NULL, *sqlArguments, *arguments, *argument = NULL, *item = NULL, *_0, *_2, *_3, *_4, *_5 = NULL, **_8, *_9 = NULL, *_11 = NULL, **_14, *_15, *_16;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
if (!escapeChar_param) {
ZEPHIR_INIT_VAR(escapeChar);
ZVAL_EMPTY_STRING(escapeChar);
} else {
zephir_get_strval(escapeChar, escapeChar_param);
}
if (ZEPHIR_GLOBAL(db).escape_identifiers) {
if (ZEPHIR_IS_STRING_IDENTICAL(escapeChar, "")) {
ZEPHIR_OBS_VAR(_0);
zephir_read_property_this(&_0, this_ptr, SL("escapeChar"), PH_NOISY_CC);
zephir_get_strval(_1, _0);
ZEPHIR_CPY_WRT(escapeChar, _1);
}
}
if (Z_TYPE_P(expression) != IS_ARRAY) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(pdm_db_exception_ce, "Invalid SQL expression", "pdm/db/abstractdialect.zep", 176);
return;
}
ZEPHIR_OBS_VAR(type);
if (!(zephir_array_isset_string_fetch(&type, expression, SS("type"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(pdm_db_exception_ce, "Invalid SQL expression", "pdm/db/abstractdialect.zep", 180);
return;
}
if (ZEPHIR_IS_STRING(type, "qualified")) {
ZEPHIR_OBS_VAR(name);
zephir_array_fetch_string(&name, expression, SL("name"), PH_NOISY TSRMLS_CC);
if (ZEPHIR_GLOBAL(db).escape_identifiers) {
ZEPHIR_INIT_VAR(escapedName);
ZEPHIR_CONCAT_VVV(escapedName, escapeChar, name, escapeChar);
} else {
ZEPHIR_CPY_WRT(escapedName, name);
}
ZEPHIR_OBS_VAR(domain);
if (zephir_array_isset_string_fetch(&domain, expression, SS("domain"), 0 TSRMLS_CC)) {
if (ZEPHIR_GLOBAL(db).escape_identifiers) {
ZEPHIR_CONCAT_VVVSV(return_value, escapeChar, domain, escapeChar, ".", escapedName);
RETURN_MM();
} else {
ZEPHIR_CONCAT_VSV(return_value, domain, ".", escapedName);
RETURN_MM();
}
}
RETURN_CCTOR(escapedName);
}
if (ZEPHIR_IS_STRING(type, "literal")) {
zephir_array_fetch_string(&_2, expression, SL("value"), PH_NOISY | PH_READONLY TSRMLS_CC);
RETURN_CTOR(_2);
}
if (ZEPHIR_IS_STRING(type, "binary-op")) {
zephir_array_fetch_string(&_2, expression, SL("left"), PH_NOISY | PH_READONLY TSRMLS_CC);
ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", NULL, _2, escapeChar);
zephir_check_call_status();
zephir_array_fetch_string(&_3, expression, SL("right"), PH_NOISY | PH_READONLY TSRMLS_CC);
ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", NULL, _3, escapeChar);
zephir_check_call_status();
zephir_array_fetch_string(&_4, expression, SL("op"), PH_NOISY | PH_READONLY TSRMLS_CC);
ZEPHIR_CONCAT_VSVSV(return_value, left, " ", _4, " ", right);
RETURN_MM();
}
if (ZEPHIR_IS_STRING(type, "unary-op")) {
ZEPHIR_OBS_VAR(operator);
zephir_array_fetch_string(&operator, expression, SL("op"), PH_NOISY TSRMLS_CC);
ZEPHIR_OBS_NVAR(left);
if (zephir_array_isset_string_fetch(&left, expression, SS("left"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&_5, this_ptr, "getsqlexpression", NULL, left, escapeChar);
zephir_check_call_status();
ZEPHIR_CONCAT_VV(return_value, _5, operator);
RETURN_MM();
}
ZEPHIR_OBS_NVAR(right);
if (zephir_array_isset_string_fetch(&right, expression, SS("right"), 0 TSRMLS_CC)) {
ZEPHIR_CALL_METHOD(&_5, this_ptr, "getsqlexpression", NULL, right, escapeChar);
zephir_check_call_status();
ZEPHIR_CONCAT_VV(return_value, _5, operator);
RETURN_MM();
}
}
if (ZEPHIR_IS_STRING(type, "placeholder")) {
zephir_array_fetch_string(&_2, expression, SL("value"), PH_NOISY | PH_READONLY TSRMLS_CC);
//.........这里部分代码省略.........
示例9: PHP_METHOD
/**
* Helper method for merge configs (forwarding nested config instance)
*
* @param Config config
* @param Config instance = null
*
* @return Config merged config
*/
PHP_METHOD(Phalcon_Config, _merge) {
zephir_fcall_cache_entry *_8 = NULL, *_9 = NULL;
zend_bool _4, _5;
HashTable *_2;
HashPosition _1;
int ZEPHIR_LAST_CALL_STATUS;
zval *config, *instance = NULL, *key = NULL, *value = NULL, *number = NULL, *_0 = NULL, **_3, *_6 = NULL, *_7 = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &config, &instance);
if (!instance) {
ZEPHIR_CPY_WRT(instance, ZEPHIR_GLOBAL(global_null));
} else {
ZEPHIR_SEPARATE_PARAM(instance);
}
if (Z_TYPE_P(instance) != IS_OBJECT) {
ZEPHIR_CPY_WRT(instance, this_ptr);
}
ZEPHIR_CALL_METHOD(&number, instance, "count", NULL, 0);
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&_0, "get_object_vars", NULL, 23, config);
zephir_check_call_status();
zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/config.zep", 239);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
) {
ZEPHIR_GET_HMKEY(key, _2, _1);
ZEPHIR_GET_HVALUE(value, _3);
_4 = zephir_isset_property_zval(instance, key TSRMLS_CC);
if (_4) {
_4 = Z_TYPE_P(value) == IS_OBJECT;
}
_5 = _4;
if (_5) {
ZEPHIR_OBS_NVAR(_6);
zephir_read_property_zval(&_6, instance, key, PH_NOISY_CC);
_5 = Z_TYPE_P(_6) == IS_OBJECT;
}
if (_5) {
ZEPHIR_OBS_NVAR(_7);
zephir_read_property_zval(&_7, instance, key, PH_NOISY_CC);
ZEPHIR_CALL_METHOD(NULL, this_ptr, "_merge", &_8, 22, value, _7);
zephir_check_call_status();
} else {
if (Z_TYPE_P(key) == IS_LONG) {
ZEPHIR_CALL_FUNCTION(&key, "strval", &_9, 20, number);
zephir_check_call_status();
ZEPHIR_SEPARATE(number);
zephir_increment(number);
}
zephir_update_property_zval_zval(instance, key, value TSRMLS_CC);
}
}
RETVAL_ZVAL(instance, 1, 0);
RETURN_MM();
}
示例10: PHP_METHOD
/**
* We have to cast values manually because parse_ini_file() has a poor implementation.
*
* @param mixed ini The array casted by `parse_ini_file`
*/
PHP_METHOD(Phalcon_Config_Adapter_Ini, _cast) {
zend_bool _5$$5, _6$$5, _8$$5, _9$$5;
HashTable *_1$$3;
HashPosition _0$$3;
zephir_fcall_cache_entry *_4 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
zval *ini, *key = NULL, *val = NULL, **_2$$3, *_3$$4 = NULL, *_7$$5, *_10$$5, *_11$$9, *_12$$9, _13$$9;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &ini);
ZEPHIR_SEPARATE_PARAM(ini);
if (Z_TYPE_P(ini) == IS_ARRAY) {
zephir_is_iterable(ini, &_1$$3, &_0$$3, 1, 0, "phalcon/config/adapter/ini.zep", 152);
for (
; zephir_hash_get_current_data_ex(_1$$3, (void**) &_2$$3, &_0$$3) == SUCCESS
; zephir_hash_move_forward_ex(_1$$3, &_0$$3)
) {
ZEPHIR_GET_HMKEY(key, _1$$3, _0$$3);
ZEPHIR_GET_HVALUE(val, _2$$3);
ZEPHIR_CALL_METHOD(&_3$$4, this_ptr, "_cast", &_4, 138, val);
zephir_check_call_status();
zephir_array_update_zval(&ini, key, &_3$$4, PH_COPY | PH_SEPARATE);
}
zend_hash_destroy(_1$$3);
FREE_HASHTABLE(_1$$3);
}
if (Z_TYPE_P(ini) == IS_STRING) {
_5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "true");
if (!(_5$$5)) {
_5$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "yes");
}
_6$$5 = _5$$5;
if (!(_6$$5)) {
ZEPHIR_INIT_VAR(_7$$5);
zephir_fast_strtolower(_7$$5, ini);
_6$$5 = ZEPHIR_IS_STRING_IDENTICAL(_7$$5, "on");
}
if (_6$$5) {
RETURN_MM_BOOL(1);
}
_8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "false");
if (!(_8$$5)) {
_8$$5 = ZEPHIR_IS_STRING_IDENTICAL(ini, "no");
}
_9$$5 = _8$$5;
if (!(_9$$5)) {
ZEPHIR_INIT_VAR(_10$$5);
zephir_fast_strtolower(_10$$5, ini);
_9$$5 = ZEPHIR_IS_STRING_IDENTICAL(_10$$5, "off");
}
if (_9$$5) {
RETURN_MM_BOOL(0);
}
if (ZEPHIR_IS_STRING_IDENTICAL(ini, "null")) {
RETURN_MM_NULL();
}
if (zephir_is_numeric(ini)) {
ZEPHIR_INIT_VAR(_11$$9);
ZEPHIR_INIT_VAR(_12$$9);
ZEPHIR_SINIT_VAR(_13$$9);
ZVAL_STRING(&_13$$9, "/[.]+/", 0);
zephir_preg_match(_12$$9, &_13$$9, ini, _11$$9, 0, 0 , 0 TSRMLS_CC);
if (zephir_is_true(_12$$9)) {
RETURN_MM_DOUBLE(zephir_get_doubleval(ini));
} else {
RETURN_MM_LONG(zephir_get_intval(ini));
}
}
}
RETVAL_ZVAL(ini, 1, 0);
RETURN_MM();
}