本文整理汇总了C++中phalcon_read_property函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_read_property函数的具体用法?C++ phalcon_read_property怎么用?C++ phalcon_read_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_read_property函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Set a param by its name or numeric index
*
* @param mixed $param
* @param mixed $value
*/
PHP_METHOD(Phalcon_Dispatcher, setParam){
zval *param = NULL, *value = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", ¶m, &value) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "_params", sizeof("_params")-1, PHALCON_NOISY TSRMLS_CC);
phalcon_array_update(&t0, param, &value, PHALCON_NO_SEPARATE_THX, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC);
phalcon_update_property_zval(this_ptr, "_params", strlen("_params"), t0 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例2: PHP_METHOD
/**
* @brief string|null Phalcon\Registry::serialize()
*/
PHP_METHOD(Phalcon_Registry, serialize){
zval data = {};
phalcon_read_property(&data, getThis(), SL("_data"), PH_NOISY);
smart_str buf = { 0 };
php_serialize_data_t var_hash;
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &data, &var_hash);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (buf.s) {
RETURN_NEW_STR(buf.s);
}
RETURN_NULL();
}
示例3: PHP_METHOD
/**
* Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
*
*<code>
* //Return array with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_NUM);
*
* //Return associative array without integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_ASSOC);
*
* //Return associative array together with integer indexes
* $result->setFetchMode(Phalcon\Db::FETCH_BOTH);
*
* //Return an object
* $result->setFetchMode(Phalcon\Db::FETCH_OBJ);
*</code>
*
* @param int $fetchMode
*/
PHP_METHOD(Phalcon_Db_Result_Pdo, setFetchMode){
long fetch_mode;
zval *pdo_statement, *fetch_type;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fetch_mode) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(fetch_type);
PHALCON_INIT_VAR(pdo_statement);
phalcon_read_property(&pdo_statement, this_ptr, SL("_pdoStatement"), PH_NOISY_CC);
if (fetch_mode == 1) {
ZVAL_LONG(fetch_type, 2);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(pdo_statement, "setfetchmode", fetch_type, PH_NO_CHECK);
phalcon_update_property_long(this_ptr, SL("_fetchMode"), 2 TSRMLS_CC);
} else {
if (fetch_mode == 2) {
ZVAL_LONG(fetch_type, 4);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(pdo_statement, "setfetchmode", fetch_type, PH_NO_CHECK);
phalcon_update_property_long(this_ptr, SL("_fetchMode"), 4 TSRMLS_CC);
} else {
if (fetch_mode == 3) {
ZVAL_LONG(fetch_type, 3);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(pdo_statement, "setfetchmode", fetch_type, PH_NO_CHECK);
phalcon_update_property_long(this_ptr, SL("_fetchMode"), 3 TSRMLS_CC);
} else {
if (fetch_mode == 4) {
ZVAL_LONG(fetch_type, 5);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(pdo_statement, "setfetchmode", fetch_type, PH_NO_CHECK);
phalcon_update_property_long(this_ptr, SL("_fetchMode"), 5 TSRMLS_CC);
}
}
}
}
PHALCON_MM_RESTORE();
RETURN_NULL();
}
示例4: PHP_METHOD
/**
* Gets a list of columns with escaped identifiers
*
*<code>
* echo $dialect->getColumnList(array('column1', 'column'));
*</code>
*
* @param array $columnList
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, getColumnList){
zval *column_list, *str_list, *escape_char, *column = NULL;
zval *column_quoted = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &column_list);
PHALCON_INIT_VAR(str_list);
array_init(str_list);
escape_char = phalcon_read_property(getThis(), SL("_escapeChar"), PH_NOISY);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(column_list), column) {
PHALCON_INIT_NVAR(column_quoted);
PHALCON_CONCAT_VVV(column_quoted, escape_char, column, escape_char);
phalcon_array_append(str_list, column_quoted, PH_COPY);
} ZEND_HASH_FOREACH_END();
示例5: PHP_METHOD
/**
* Appends a LIMIT clause to $sqlQuery argument
*
* @param string $sqlQuery
* @param int $number
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, limit){
zval *sql_query = NULL, *number = NULL, *dialect = NULL, *sql = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &sql_query, &number) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(dialect);
phalcon_read_property(&dialect, this_ptr, SL("_dialect"), PH_NOISY_CC);
PHALCON_INIT_VAR(sql);
PHALCON_CALL_METHOD_PARAMS_2(sql, dialect, "limit", sql_query, number, PH_NO_CHECK);
RETURN_CCTOR(sql);
}
示例6: PHP_METHOD
/**
* Escapes a value to avoid SQL injections
*
* @param string $str
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, escapeString){
zval *str = NULL;
zval *t0 = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &str) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_pdo"), PH_NOISY_CC);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_METHOD_PARAMS_1(r0, t0, "quote", str, PH_NO_CHECK);
RETURN_CTOR(r0);
}
示例7: PHP_METHOD
/**
* Sets a header to be sent at the end of the request
*
* @param string $name
* @param string $value
*/
PHP_METHOD(Phalcon_Http_Response_Headers, set){
zval *name, *value;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &name, &value) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(t0);
phalcon_read_property(&t0, this_ptr, SL("_headers"), PH_NOISY_CC);
phalcon_array_update_zval(&t0, name, &value, PH_COPY TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_headers"), t0 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例8: PHP_METHOD
PHP_METHOD(Phalcon_Mvc_Model_Query_Status, getMessages){
zval *model = NULL, *messages = NULL, *empty_arr = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(model);
phalcon_read_property(&model, this_ptr, SL("_model"), PH_NOISY_CC);
if (Z_TYPE_P(model) != IS_NULL) {
PHALCON_INIT_VAR(messages);
PHALCON_CALL_METHOD(messages, model, "getmessages", PH_NO_CHECK);
RETURN_CCTOR(messages);
}
PHALCON_INIT_VAR(empty_arr);
array_init(empty_arr);
RETURN_CTOR(empty_arr);
}
示例9: PHP_METHOD
/**
* Adds parameters to views
*
* @param string $key
* @param mixed $value
*/
PHP_METHOD(Phalcon_Mvc_View, setVar){
zval *key = NULL, *value = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &key, &value) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_viewParams"), PH_NOISY_CC);
phalcon_array_update_zval(&t0, key, &value, PH_COPY TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_viewParams"), t0 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例10: PHP_METHOD
/**
* Escapes a value to avoid SQL injections
*
* @param string $str
* @return string
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, escapeString){
zval *str = NULL, *pdo = NULL, *quoted_str = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &str) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(pdo);
phalcon_read_property(&pdo, this_ptr, SL("_pdo"), PH_NOISY_CC);
PHALCON_INIT_VAR(quoted_str);
PHALCON_CALL_METHOD_PARAMS_1(quoted_str, pdo, "quote", str, PH_NO_CHECK);
RETURN_CCTOR(quoted_str);
}
示例11: PHP_METHOD
/**
* Removes an element from the form
*
* @param string $name
* @return boolean
*/
PHP_METHOD(Phalcon_Forms_Form, remove){
zval *name, *elements;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_OBS_VAR(elements);
phalcon_read_property(&elements, this_ptr, SL("_elements"), PH_NOISY_CC);
if (phalcon_array_isset(elements, name)) {
phalcon_unset_property_array(this_ptr, SL("_elements"), name TSRMLS_CC);
RETURN_MM_TRUE;
}
RETURN_MM_FALSE;
}
示例12: PHP_METHOD
/**
* Create internal connection to memcached
*/
PHP_METHOD(Phalcon_Cache_Backend_Memcache, _connect){
zval *options, *memcache, *host, *port, *persistent;
zval *success = NULL;
zend_class_entry *ce0;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(options);
phalcon_read_property(&options, this_ptr, SL("_options"), PH_NOISY_CC);
ce0 = zend_fetch_class(SL("Memcache"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
PHALCON_INIT_VAR(memcache);
object_init_ex(memcache, ce0);
if (phalcon_has_constructor(memcache TSRMLS_CC)) {
PHALCON_CALL_METHOD_NORETURN(memcache, "__construct");
}
PHALCON_OBS_VAR(host);
phalcon_array_fetch_string(&host, options, SL("host"), PH_NOISY_CC);
PHALCON_OBS_VAR(port);
phalcon_array_fetch_string(&port, options, SL("port"), PH_NOISY_CC);
PHALCON_OBS_VAR(persistent);
phalcon_array_fetch_string(&persistent, options, SL("persistent"), PH_NOISY_CC);
if (zend_is_true(persistent)) {
PHALCON_INIT_VAR(success);
PHALCON_CALL_METHOD_PARAMS_2(success, memcache, "pconnect", host, port);
} else {
PHALCON_INIT_NVAR(success);
PHALCON_CALL_METHOD_PARAMS_2(success, memcache, "connect", host, port);
}
if (!zend_is_true(success)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_cache_exception_ce, "Cannot connect to Memcached server");
return;
}
phalcon_update_property_zval(this_ptr, SL("_memcache"), memcache TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例13: PHP_METHOD
/**
* Set a dispatching parameter
*
* @param mixed $index
* @param mixed $value
*/
PHP_METHOD(Phalcon_Controller, _setParam){
zval *index = NULL, *value = NULL;
zval *r0 = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &index, &value) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "dispatcher", sizeof("dispatcher")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_2(r0, t0, "setparam", index, value, PHALCON_NO_CHECK);
PHALCON_RETURN_DZVAL(r0);
}
示例14: PHP_METHOD
/**
* Check whether a translation key exists
*
* @param string $translateKey
* @return boolean
*/
PHP_METHOD(Phalcon_Translate, offsetExists){
zval *translate_key = NULL;
zval *r0 = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &translate_key) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_adapter"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_1(r0, t0, "exists", translate_key, PHALCON_NO_CHECK);
RETURN_DZVAL(r0);
}
示例15: PHP_METHOD
/**
* This method is automatically called in Phalcon\Db\Adapter\Pdo constructor.
* Call it when you need to restore a database connection.
*
* Support set search_path after connectted if schema is specified in config.
*
* @param array $descriptor
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, connect) {
zval *descriptor = NULL, *schema = NULL, *sql = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &descriptor) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!descriptor) {
PHALCON_ALLOC_ZVAL_MM(descriptor);
ZVAL_NULL(descriptor);
} else {
PHALCON_SEPARATE_PARAM(descriptor);
}
if (!zend_is_true(descriptor)) {
PHALCON_INIT_VAR(descriptor);
phalcon_read_property(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC);
}
PHALCON_INIT_VAR(schema);
ZVAL_NULL(schema);
eval_int = phalcon_array_isset_string(descriptor, SS("schema"));
if (eval_int) {
PHALCON_INIT_VAR(schema);
phalcon_array_fetch_string(&schema, descriptor, SL("schema"), PH_NOISY_CC);
PHALCON_SEPARATE_PARAM(descriptor);
phalcon_array_unset_string(descriptor, SS("schema"));
}
PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon\\Db\\Adapter\\Pdo\\Postgresql", "connect", descriptor);
if (Z_TYPE_P(schema) == IS_STRING) {
PHALCON_INIT_VAR(sql);
PHALCON_CONCAT_SVS(sql, "SET search_path TO '", schema, "'");
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "execute", sql, PH_NO_CHECK);
}
PHALCON_MM_RESTORE();
}