• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ phalcon_array_update_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中phalcon_array_update_string函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_array_update_string函数的具体用法?C++ phalcon_array_update_string怎么用?C++ phalcon_array_update_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了phalcon_array_update_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PHP_METHOD

/**
 * Serializing a resultset will dump all related rows into a big array
 *
 * @return string
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize){

	zval *records, *cache, *column_types, *hydrate_mode;
	zval *data, *serialized;

	PHALCON_MM_GROW();

	/** 
	 * Obtain the records as an array
	 */
	PHALCON_INIT_VAR(records);
	PHALCON_CALL_METHOD(records, this_ptr, "toarray");
	
	PHALCON_OBS_VAR(cache);
	phalcon_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(column_types);
	phalcon_read_property_this(&column_types, this_ptr, SL("_columnTypes"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(hydrate_mode);
	phalcon_read_property_this(&hydrate_mode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(data);
	array_init_size(data, 4);
	phalcon_array_update_string(&data, SL("cache"), &cache, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("rows"), &records, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("columnTypes"), &column_types, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("hydrateMode"), &hydrate_mode, PH_COPY | PH_SEPARATE TSRMLS_CC);
	
	PHALCON_INIT_VAR(serialized);
	PHALCON_CALL_FUNC_PARAMS_1(serialized, "serialize", data);
	RETURN_CCTOR(serialized);
}
开发者ID:angkatan21,项目名称:cphalcon,代码行数:38,代码来源:complex.c


示例2: PHP_METHOD

/**
 * Returns an HTML string of information about a single variable.
 *
 * <code>
 *    echo (new \Phalcon\Debug\Dump())->variable($foo, "foo");
 * </code>
 */
PHP_METHOD(Phalcon_Debug_Dump, variable){

	zval *variable, *name = NULL, *str, *type, *style = NULL, *output = NULL, *replace_pairs;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 1, &variable, &name);

	if (!name) {
		name = PHALCON_GLOBAL(z_null);
	}

	PHALCON_INIT_VAR(str);
	ZVAL_STRING(str, "<pre style=':style'>:output</pre>", 1);

	PHALCON_INIT_VAR(type);
	ZVAL_STRING(type, "pre", 1);

	PHALCON_CALL_SELF(&style, "getstyle", type);
	PHALCON_CALL_SELF(&output, "output", variable, name);

	PHALCON_INIT_VAR(replace_pairs);
	array_init(replace_pairs);

	phalcon_array_update_string(&replace_pairs, SL(":style"), style, PH_COPY);
	phalcon_array_update_string(&replace_pairs, SL(":output"), output, PH_COPY);

	phalcon_strtr_array(return_value, str, replace_pairs TSRMLS_CC);

	RETURN_MM();
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:38,代码来源:dump.c


示例3: PHP_METHOD

PHP_METHOD(Phalcon_Mvc_Router, __construct){

	zval *a0 = NULL, *a1 = NULL, *a2 = NULL, *a3 = NULL, *a4 = NULL, *a5 = NULL;

	PHALCON_MM_GROW();
	
	PHALCON_ALLOC_ZVAL_MM(a0);
	array_init(a0);
	zend_update_property(phalcon_mvc_router_ce, this_ptr, SL("_params"), a0 TSRMLS_CC);
	PHALCON_ALLOC_ZVAL_MM(a1);
	array_init(a1);
	PHALCON_ALLOC_ZVAL_MM(a2);
	array_init(a2);
	add_assoc_stringl_ex(a2, SL("pattern")+1, SL("#^/([a-zA-Z0-9\\_]+)[/]{0,1}$#"), 1);
	PHALCON_ALLOC_ZVAL_MM(a3);
	array_init(a3);
	add_assoc_long_ex(a3, SL("controller")+1, 1);
	phalcon_array_update_string(&a2, SL("paths"), &a3, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_append(&a1, a2, PH_SEPARATE TSRMLS_CC);
	PHALCON_ALLOC_ZVAL_MM(a4);
	array_init(a4);
	add_assoc_stringl_ex(a4, SL("pattern")+1, SL("#^/([a-zA-Z0-9\\_]+)/([a-zA-Z0-9\\_]+)(/.*)*$#"), 1);
	PHALCON_ALLOC_ZVAL_MM(a5);
	array_init(a5);
	add_assoc_long_ex(a5, SL("controller")+1, 1);
	add_assoc_long_ex(a5, SL("action")+1, 2);
	add_assoc_long_ex(a5, SL("params")+1, 3);
	phalcon_array_update_string(&a4, SL("paths"), &a5, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_append(&a1, a4, PH_SEPARATE TSRMLS_CC);
	phalcon_update_property_zval(this_ptr, SL("_routes"), a1 TSRMLS_CC);
	
	PHALCON_MM_RESTORE();
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:33,代码来源:router.c


示例4: phalcon_array_update_zval_string_append_multi_3

/**
 * $x[$a]["hello"][] = $v
 */
void phalcon_array_update_zval_string_append_multi_3(zval **arr, zval *index1, char *index2, uint index2_length, zval **value, int flags TSRMLS_DC){

	zval *temp1 = NULL, *temp2 = NULL;

	if (Z_TYPE_PP(arr) == IS_ARRAY) {

		phalcon_array_fetch(&temp1, *arr, index1, PH_SILENT_CC);
		if (Z_REFCOUNT_P(temp1) > 1) {
			phalcon_array_update_zval(arr, index1, &temp1, PH_COPY | PH_CTOR TSRMLS_CC);
		}
		if (Z_TYPE_P(temp1) != IS_ARRAY) {
			convert_to_array(temp1);
			phalcon_array_update_zval(arr, index1, &temp1, PH_COPY TSRMLS_CC);
		}

		phalcon_array_fetch_string(&temp2, temp1, index2, index2_length, PH_SILENT_CC);
		if (Z_REFCOUNT_P(temp2) > 1) {
			phalcon_array_update_string(&temp1, index2, index2_length, &temp2, PH_COPY | PH_CTOR TSRMLS_CC);
		}
		if (Z_TYPE_P(temp2) != IS_ARRAY) {
			convert_to_array(temp2);
			phalcon_array_update_string(&temp1, index2, index2_length, &temp2, PH_COPY TSRMLS_CC);
		}

		phalcon_array_append(&temp2, *value, flags TSRMLS_CC);
	}

	if (temp1 != NULL) {
		zval_ptr_dtor(&temp1);
	}
	if (temp2 != NULL) {
		zval_ptr_dtor(&temp2);
	}

}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:38,代码来源:array.c


示例5: PHP_METHOD

/**
 * Serializing a resultset will dump all related rows into a big array
 *
 * @return string
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize){

	zval *records = NULL, *cache, *column_types, *hydrate_mode;
	zval *data, *serialized;

	PHALCON_MM_GROW();

	/** 
	 * Obtain the records as an array
	 */
	PHALCON_CALL_METHOD(&records, this_ptr, "toarray");
	
	cache        = phalcon_fetch_nproperty_this(this_ptr, SL("_cache"), PH_NOISY TSRMLS_CC);
	column_types = phalcon_fetch_nproperty_this(this_ptr, SL("_columnTypes"), PH_NOISY TSRMLS_CC);
	hydrate_mode = phalcon_fetch_nproperty_this(this_ptr, SL("_hydrateMode"), PH_NOISY TSRMLS_CC);
	
	PHALCON_INIT_VAR(data);
	array_init_size(data, 4);
	phalcon_array_update_string(&data, SL("cache"), cache, PH_COPY);
	phalcon_array_update_string(&data, SL("rows"), records, PH_COPY);
	phalcon_array_update_string(&data, SL("columnTypes"), column_types, PH_COPY);
	phalcon_array_update_string(&data, SL("hydrateMode"), hydrate_mode, PH_COPY);
	
	PHALCON_INIT_VAR(serialized);
	phalcon_serialize(serialized, &data TSRMLS_CC);
	
	/** 
	 * Avoid return bad serialized data
	 */
	if (Z_TYPE_P(serialized) != IS_STRING) {
		RETURN_MM_NULL();
	}
	
	RETURN_CTOR(serialized);
}
开发者ID:100851766,项目名称:cphalcon,代码行数:40,代码来源:complex.c


示例6: PHP_METHOD

/**
 * Adds the limit parameter to the criteria
 *
 * @param int $limit
 * @param int $offset
 * @return Phalcon\Mvc\Model\Criteria
 */
PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit){

	zval *limit, *offset = NULL, *limit_clause;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 1, &limit, &offset);
	
	if (!offset) {
		PHALCON_INIT_VAR(offset);
	}
	
	if (!phalcon_is_numeric(limit)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Rows limit parameter must be integer");
		return;
	}
	if (Z_TYPE_P(offset) == IS_NULL) {
		phalcon_update_property_array_string(this_ptr, SL("_params"), SS("limit"), limit TSRMLS_CC);
	} else {
		PHALCON_INIT_VAR(limit_clause);
		array_init_size(limit_clause, 2);
		phalcon_array_update_string(&limit_clause, SL("number"), &limit, PH_COPY | PH_SEPARATE TSRMLS_CC);
		phalcon_array_update_string(&limit_clause, SL("offset"), &offset, PH_COPY | PH_SEPARATE TSRMLS_CC);
		phalcon_update_property_array_string(this_ptr, SL("_params"), SS("limit"), limit_clause TSRMLS_CC);
	}
	
	RETURN_THIS();
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:35,代码来源:criteria.c


示例7: PHP_METHOD

/**
 * Applies a format to a message before sent it to the internal log
 *
 * @param string $message
 * @param int $type
 * @param int $timestamp
 * @param array $context
 * @return string
 */
PHP_METHOD(Phalcon_Logger_Formatter_Json, format){

	zval *message, *type, *timestamp, *context, *interpolated = NULL, *type_str = NULL, *log, *json;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 4, 0, &message, &type, &timestamp, &context);
	
	if (Z_TYPE_P(context) == IS_ARRAY) {
		PHALCON_CALL_METHOD(&interpolated, this_ptr, "interpolate", message, context);
	}
	else {
		interpolated = message;
	}

	PHALCON_CALL_METHOD(&type_str, this_ptr, "gettypestring", type);
	
	PHALCON_INIT_VAR(log);
	array_init_size(log, 3);
	phalcon_array_update_string(&log, SL("type"), type_str, PH_COPY);
	phalcon_array_update_string(&log, SL("message"), interpolated, PH_COPY);
	phalcon_array_update_string(&log, SL("timestamp"), timestamp, PH_COPY);

	PHALCON_INIT_VAR(json);
	RETURN_MM_ON_FAILURE(phalcon_json_encode(json, log, 0 TSRMLS_CC));

	PHALCON_CONCAT_VS(return_value, json, PHP_EOL);
	RETURN_MM();
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:38,代码来源:json.c


示例8: PHP_METHOD

/**
 * Restore a Phalcon\Db\Reference object from export
 *
 * @param array $data
 * @return Phalcon\Db\Reference
 */
PHP_METHOD(Phalcon_Db_Reference, __set_state){

	zval *data, *constraint_name, *referenced_schema = NULL;
	zval *referenced_table = NULL, *columns = NULL, *referenced_columns = NULL;
	zval *definition;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &data);
	
	if (!phalcon_array_isset_string(data, SS("_referenceName"))) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "_referenceName parameter is required");
		return;
	} else {
		PHALCON_OBS_VAR(constraint_name);
		phalcon_array_fetch_string(&constraint_name, data, SL("_referenceName"), PH_NOISY);
	}
	if (phalcon_array_isset_string(data, SS("_referencedSchema"))) {
		PHALCON_OBS_VAR(referenced_schema);
		phalcon_array_fetch_string(&referenced_schema, data, SL("_referencedSchema"), PH_NOISY);
	} else {
		PHALCON_INIT_NVAR(referenced_schema);
	}
	
	if (phalcon_array_isset_string(data, SS("_referencedTable"))) {
		PHALCON_OBS_VAR(referenced_table);
		phalcon_array_fetch_string(&referenced_table, data, SL("_referencedTable"), PH_NOISY);
	} else {
		PHALCON_INIT_NVAR(referenced_table);
	}
	
	if (phalcon_array_isset_string(data, SS("_columns"))) {
		PHALCON_OBS_VAR(columns);
		phalcon_array_fetch_string(&columns, data, SL("_columns"), PH_NOISY);
	} else {
		PHALCON_INIT_NVAR(columns);
	}
	
	if (phalcon_array_isset_string(data, SS("_referencedColumns"))) {
		PHALCON_OBS_VAR(referenced_columns);
		phalcon_array_fetch_string(&referenced_columns, data, SL("_referencedColumns"), PH_NOISY);
	} else {
		PHALCON_INIT_NVAR(referenced_columns);
	}
	
	PHALCON_INIT_VAR(definition);
	array_init_size(definition, 4);
	phalcon_array_update_string(&definition, SL("referencedSchema"), &referenced_schema, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&definition, SL("referencedTable"), &referenced_table, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&definition, SL("columns"), &columns, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&definition, SL("referencedColumns"), &referenced_columns, PH_COPY | PH_SEPARATE);
	object_init_ex(return_value, phalcon_db_reference_ce);
	phalcon_call_method_p2_noret(return_value, "__construct", constraint_name, definition);
	
	RETURN_MM();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:62,代码来源:reference.c


示例9: PHP_METHOD

/**
 * Serializing a resultset will dump all related rows into a big array
 *
 * @return string
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize){

	zval *type = NULL, *result = NULL, *records = NULL, *row_count = NULL, *model = NULL;
	zval *cache = NULL, *data = NULL, *serialized = NULL;

	PHALCON_MM_GROW();
	PHALCON_INIT_VAR(type);
	phalcon_read_property(&type, this_ptr, SL("_type"), PH_NOISY_CC);
	if (zend_is_true(type)) {
		PHALCON_INIT_VAR(result);
		phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC);
		if (PHALCON_IS_NOT_FALSE(result)) {
			PHALCON_CALL_METHOD_NORETURN(result, "execute", PH_NO_CHECK);
			
			PHALCON_INIT_VAR(records);
			PHALCON_CALL_METHOD(records, result, "fetchall", PH_NO_CHECK);
		} else {
			PHALCON_INIT_VAR(records);
			array_init(records);
		}
	} else {
		PHALCON_INIT_VAR(records);
		phalcon_read_property(&records, this_ptr, SL("_rows"), PH_NOISY_CC);
		if (Z_TYPE_P(records) == IS_NULL) {
			PHALCON_INIT_VAR(result);
			phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC);
			if (PHALCON_IS_NOT_FALSE(result)) {
				PHALCON_INIT_VAR(records);
				PHALCON_CALL_METHOD(records, result, "fetchall", PH_NO_CHECK);
				
				PHALCON_INIT_VAR(row_count);
				phalcon_fast_count(row_count, records TSRMLS_CC);
				phalcon_update_property_zval(this_ptr, SL("_rows"), row_count TSRMLS_CC);
			}
		}
	}
	
	PHALCON_INIT_VAR(model);
	phalcon_read_property(&model, this_ptr, SL("_model"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(cache);
	phalcon_read_property(&cache, this_ptr, SL("_cache"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(data);
	array_init(data);
	phalcon_array_update_string(&data, SL("model"), &model, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("cache"), &cache, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("rows"), &records, PH_COPY | PH_SEPARATE TSRMLS_CC);
	
	PHALCON_INIT_VAR(serialized);
	PHALCON_CALL_FUNC_PARAMS_1(serialized, "serialize", data);
	
	RETURN_CCTOR(serialized);
}
开发者ID:awakmu,项目名称:cphalcon,代码行数:59,代码来源:simple.c


示例10: PHP_METHOD

/**
 * Phalcon\Acl\Adapter\Memory constructor
 */
PHP_METHOD(Phalcon_Acl_Adapter_Memory, __construct){

	zval *a0 = NULL, *a1 = NULL, *a2 = NULL;

	PHALCON_MM_GROW();

	phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_rolesNames") TSRMLS_CC);
	
	phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_roles") TSRMLS_CC);
	
	phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_resources") TSRMLS_CC);
	
	phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_access") TSRMLS_CC);
	
	phalcon_update_property_empty_array(phalcon_acl_adapter_memory_ce, this_ptr, SL("_roleInherits") TSRMLS_CC);
	
	PHALCON_INIT_VAR(a0);
	array_init_size(a0, 1);
	add_assoc_bool_ex(a0, SS("*"), 1);
	zend_update_property(phalcon_acl_adapter_memory_ce, this_ptr, SL("_resourcesNames"), a0 TSRMLS_CC);
	
	PHALCON_INIT_VAR(a1);
	array_init_size(a1, 1);
	
	PHALCON_INIT_VAR(a2);
	array_init_size(a2, 1);
	add_assoc_bool_ex(a2, SS("*"), 1);
	phalcon_array_update_string(&a1, SL("*"), &a2, PH_COPY | PH_SEPARATE TSRMLS_CC);
	zend_update_property(phalcon_acl_adapter_memory_ce, this_ptr, SL("_accessList"), a1 TSRMLS_CC);
	

	PHALCON_MM_RESTORE();
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:36,代码来源:memory.c


示例11: phalcon_array_update_string_zval_zval_multi_3

/**
 * $x[$a][$b]["str"] = $v
 */
void phalcon_array_update_string_zval_zval_multi_3(zval **arr, zval *index1, zval *index2, char *index3, uint index3_length, zval **value, int flags TSRMLS_DC){

	zval *temp1, *temp2;

	ALLOC_INIT_ZVAL(temp1);
	ALLOC_INIT_ZVAL(temp2);

	if (Z_TYPE_PP(arr) == IS_ARRAY) {
		ALLOC_INIT_ZVAL(temp1);
		phalcon_array_fetch(&temp1, *arr, index1, PH_SILENT_CC);
	}
	if (Z_REFCOUNT_P(temp1) > 1) {
		phalcon_array_update_zval(arr, index1, &temp1, PH_COPY | PH_CTOR TSRMLS_CC);
	}
	if (Z_TYPE_P(temp1) != IS_ARRAY) {
		convert_to_array(temp1);
		phalcon_array_update_zval(arr, index1, &temp1, PH_COPY TSRMLS_CC);
	}
	if (Z_TYPE_P(temp1) == IS_ARRAY) {
		ALLOC_INIT_ZVAL(temp2);
		phalcon_array_fetch(&temp2, temp1, index2, PH_SILENT_CC);
	}
	if (Z_REFCOUNT_P(temp2) > 1) {
		phalcon_array_update_zval(&temp1, index2, &temp2, PH_COPY | PH_CTOR TSRMLS_CC);
	}
	if (Z_TYPE_P(temp2) != IS_ARRAY) {
		convert_to_array(temp2);
		phalcon_array_update_zval(&temp1, index2, &temp2, PH_COPY TSRMLS_CC);
	}
	phalcon_array_update_string(&temp2, index3, index3_length, value, PH_COPY TSRMLS_CC);

	zval_ptr_dtor(&temp1);
	zval_ptr_dtor(&temp2);

}
开发者ID:meibk,项目名称:cphalcon,代码行数:38,代码来源:array.c


示例12: PHP_METHOD

/**
 * Adds the limit parameter to the criteria
 *
 * @param string $orderColumns
 * @return Phalcon\Mvc\Model\Criteria
 */
PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit){

	zval *limit = NULL;
	zval *r0 = NULL;
	zval *t0 = NULL;

	PHALCON_MM_GROW();
	
	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &limit) == FAILURE) {
		PHALCON_MM_RESTORE();
		RETURN_NULL();
	}

	PHALCON_ALLOC_ZVAL_MM(r0);
	PHALCON_CALL_FUNC_PARAMS_1(r0, "is_numeric", limit);
	if (!zend_is_true(r0)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Rows limit parameter must be integer");
		return;
	}
	
	PHALCON_ALLOC_ZVAL_MM(t0);
	phalcon_read_property(&t0, this_ptr, SL("_params"), PH_NOISY_CC);
	phalcon_array_update_string(&t0, SL("limit"), &limit, PH_COPY TSRMLS_CC);
	phalcon_update_property_zval(this_ptr, SL("_params"), t0 TSRMLS_CC);
	
	RETURN_CCTOR(this_ptr);
}
开发者ID:meibk,项目名称:cphalcon,代码行数:33,代码来源:criteria.c


示例13: PHP_METHOD

/**
 * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor.
 * Call it when you need to restore a database connection.
 *
 * @param array $descriptor
 * @return boolean
 */
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, connect){

	zval *descriptor = NULL, *dbname;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &descriptor) == FAILURE) {
		RETURN_MM_NULL();
	}

	if (!descriptor) {
		PHALCON_INIT_VAR(descriptor);
	} else {
		PHALCON_SEPARATE_PARAM(descriptor);
	}
	
	if (!zend_is_true(descriptor)) {
		PHALCON_OBS_NVAR(descriptor);
		phalcon_read_property(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC);
	}
	if (!phalcon_array_isset_string(descriptor, SS("dbname"))) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "dbname must be specified");
		return;
	} else {
		PHALCON_OBS_VAR(dbname);
		phalcon_array_fetch_string(&dbname, descriptor, SL("dbname"), PH_NOISY_CC);
		phalcon_array_update_string(&descriptor, SL("dsn"), &dbname, PH_COPY | PH_SEPARATE TSRMLS_CC);
	}
	
	PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon\\Db\\Adapter\\Pdo\\Sqlite", "connect", descriptor);
	
	PHALCON_MM_RESTORE();
}
开发者ID:Gildus,项目名称:cphalcon,代码行数:40,代码来源:sqlite.c


示例14: 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, *password;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 0, 1, &descriptor);
	
	if (!descriptor) {
		PHALCON_INIT_VAR(descriptor);
	} else {
		PHALCON_SEPARATE_PARAM(descriptor);
	}
	
	if (!zend_is_true(descriptor)) {
		PHALCON_OBS_NVAR(descriptor);
		phalcon_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY TSRMLS_CC);
	}
	
	if (phalcon_array_isset_string(descriptor, SS("schema"))) {
		PHALCON_OBS_VAR(schema);
		phalcon_array_fetch_string(&schema, descriptor, SL("schema"), PH_NOISY);
		phalcon_array_unset_string(&descriptor, SS("schema"), PH_COPY);

		phalcon_update_property_this(this_ptr, SL("_schema"), schema TSRMLS_CC);
	}
	else {
		PHALCON_INIT_VAR(schema);
	}

	if (phalcon_array_isset_string_fetch(&password, descriptor, SS("password"))) {
		/* There is a bug in pdo_pgsql driver when the password is empty,
		 * the driver tries to access invalid memory:
		 *
		 * if (dbh->password[0] != '\'' && dbh->password[strlen(dbh->password) - 1] != '\'')
		 *
		 * To avoid this we set the password to null
		 */
		if (Z_TYPE_P(password) == IS_STRING && Z_STRLEN_P(password) == 0) {
			phalcon_array_update_string(&descriptor, SL("password"), PHALCON_GLOBAL(z_null), PH_COPY);
		}
	}

	
	PHALCON_CALL_PARENT(NULL, phalcon_db_adapter_pdo_postgresql_ce, this_ptr, "connect", descriptor);
	
	/** 
	 * Execute the search path in the after connect
	 */
	if (Z_TYPE_P(schema) == IS_STRING) {
		PHALCON_INIT_VAR(sql);
		PHALCON_CONCAT_SVS(sql, "SET search_path TO '", schema, "'");
		PHALCON_CALL_METHOD(NULL, this_ptr, "execute", sql);
	}
	
	PHALCON_MM_RESTORE();
}
开发者ID:banketree,项目名称:cphalcon,代码行数:66,代码来源:postgresql.c


示例15: phalcon_array_update_string_long

int phalcon_array_update_string_long(zval **arr, char *index, uint index_length, long value, int flags TSRMLS_DC){

	zval *zvalue;

	ALLOC_INIT_ZVAL(zvalue);
	ZVAL_LONG(zvalue, value);

	return phalcon_array_update_string(arr, index, index_length, &zvalue, flags TSRMLS_CC);
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:9,代码来源:array.c


示例16: PHP_METHOD

/**
 * Phalcon\Acl\Adapter\Memory constructor
 *
 */
PHP_METHOD(Phalcon_Acl_Adapter_Memory, __construct){

	zval *resources_names, *access_list;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(resources_names);
	array_init_size(resources_names, 1);
	phalcon_array_update_string(&resources_names, SL("*"), PHALCON_GLOBAL(z_true), PH_COPY);
	phalcon_update_property_this(this_ptr, SL("_resourcesNames"), resources_names TSRMLS_CC);
	
	PHALCON_INIT_VAR(access_list);
	array_init_size(access_list, 1);
	phalcon_array_update_string(&access_list, SL("*!*"), PHALCON_GLOBAL(z_true), PH_COPY);
	phalcon_update_property_this(this_ptr, SL("_accessList"), access_list TSRMLS_CC);
	
	PHALCON_MM_RESTORE();
}
开发者ID:CoolCloud,项目名称:cphalcon,代码行数:22,代码来源:memory.c


示例17: phalcon_array_update_string_string

int phalcon_array_update_string_string(zval **arr, char *index, uint index_length, char *value, uint value_length, int flags TSRMLS_DC){

	zval *zvalue;

	ALLOC_INIT_ZVAL(zvalue);
	ZVAL_STRINGL(zvalue, value, value_length, 1);

	return phalcon_array_update_string(arr, index, index_length, &zvalue, flags TSRMLS_CC);
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:9,代码来源:array.c


示例18: PHP_METHOD

/**
 * Serializing a resultset will dump all related rows into a big array
 *
 * @return string
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize){

	zval *records, *model, *cache, *column_map, *hydrate_mode;
	zval *data, *serialized;

	PHALCON_MM_GROW();

	PHALCON_INIT_VAR(records);
	PHALCON_CALL_METHOD(records, this_ptr, "toarray");
	
	PHALCON_OBS_VAR(model);
	phalcon_read_property(&model, this_ptr, SL("_model"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(cache);
	phalcon_read_property(&cache, this_ptr, SL("_cache"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(column_map);
	phalcon_read_property(&column_map, this_ptr, SL("_columnMap"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(hydrate_mode);
	phalcon_read_property(&hydrate_mode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(data);
	array_init_size(data, 5);
	phalcon_array_update_string(&data, SL("model"), &model, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("cache"), &cache, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("rows"), &records, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("columnMap"), &column_map, PH_COPY | PH_SEPARATE TSRMLS_CC);
	phalcon_array_update_string(&data, SL("hydrateMode"), &hydrate_mode, PH_COPY | PH_SEPARATE TSRMLS_CC);
	
	/** 
	 * Force to re-execute the query
	 */
	phalcon_update_property_bool(this_ptr, SL("_activeRow"), 0 TSRMLS_CC);
	
	/** 
	 * Serialize the cache using the serialize function
	 */
	PHALCON_INIT_VAR(serialized);
	PHALCON_CALL_FUNC_PARAMS_1(serialized, "serialize", data);
	RETURN_CCTOR(serialized);
}
开发者ID:bicouy0,项目名称:cphalcon,代码行数:47,代码来源:simple.c


示例19: PHP_METHOD

/**
 * Serializing a resultset will dump all related rows into a big array
 *
 * @return string
 */
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize){

	zval *records, *cache, *column_types, *hydrate_mode;
	zval *data, *serialized;

	PHALCON_MM_GROW();

	/** 
	 * Obtain the records as an array
	 */
	PHALCON_INIT_VAR(records);
	phalcon_call_method(records, this_ptr, "toarray");
	
	PHALCON_OBS_VAR(cache);
	phalcon_read_property_this(&cache, this_ptr, SL("_cache"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(column_types);
	phalcon_read_property_this(&column_types, this_ptr, SL("_columnTypes"), PH_NOISY_CC);
	
	PHALCON_OBS_VAR(hydrate_mode);
	phalcon_read_property_this(&hydrate_mode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(data);
	array_init_size(data, 4);
	phalcon_array_update_string(&data, SL("cache"), &cache, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&data, SL("rows"), &records, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&data, SL("columnTypes"), &column_types, PH_COPY | PH_SEPARATE);
	phalcon_array_update_string(&data, SL("hydrateMode"), &hydrate_mode, PH_COPY | PH_SEPARATE);
	
	PHALCON_INIT_VAR(serialized);
	phalcon_serialize(serialized, &data TSRMLS_CC);
	
	/** 
	 * Avoid return bad serialized data
	 */
	if (Z_TYPE_P(serialized) != IS_STRING) {
		RETURN_MM_NULL();
	}
	
	RETURN_CTOR(serialized);
}
开发者ID:Dinesh-Ramakrishnan,项目名称:cphalcon,代码行数:46,代码来源:complex.c


示例20: PHP_METHOD

/**
 * Changes a parameter in the definition without resolve the service
 *
 * @param long $position
 * @param array $parameter
 * @return Phalcon\DI\Service
 */
PHP_METHOD(Phalcon_DI_Service, setParameter){

	zval *position, *parameter, *definition, *arguments = NULL;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &position, &parameter) == FAILURE) {
		RETURN_MM_NULL();
	}

	PHALCON_OBS_VAR(definition);
	phalcon_read_property(&definition, this_ptr, SL("_definition"), PH_NOISY_CC);
	if (Z_TYPE_P(definition) != IS_ARRAY) { 
		PHALCON_THROW_EXCEPTION_STR(phalcon_di_exception_ce, "Definition must be an array to update its parameters");
		return;
	}
	
	if (Z_TYPE_P(position) != IS_LONG) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_di_exception_ce, "Position must be integer");
		return;
	}
	
	if (Z_TYPE_P(parameter) != IS_ARRAY) { 
		PHALCON_THROW_EXCEPTION_STR(phalcon_di_exception_ce, "The parameter must be an array");
		return;
	}
	
	/** 
	 * Update the parameter
	 */
	if (phalcon_array_isset_string(definition, SS("arguments"))) {
		PHALCON_OBS_VAR(arguments);
		phalcon_array_fetch_string(&arguments, definition, SL("arguments"), PH_NOISY_CC);
		phalcon_array_update_zval(&arguments, position, &parameter, PH_COPY | PH_SEPARATE TSRMLS_CC);
	} else {
		PHALCON_INIT_NVAR(arguments);
		array_init_size(arguments, 1);
		phalcon_array_update_zval(&arguments, position, &parameter, PH_COPY | PH_SEPARATE TSRMLS_CC);
	}
	
	/** 
	 * Re-update the arguments
	 */
	phalcon_array_update_string(&definition, SL("arguments"), &arguments, PH_COPY | PH_SEPARATE TSRMLS_CC);
	
	/** 
	 * Re-update the definition
	 */
	phalcon_update_property_zval(this_ptr, SL("_definition"), definition TSRMLS_CC);
	
	RETURN_THIS();
}
开发者ID:Gildus,项目名称:cphalcon,代码行数:59,代码来源:service.c



注:本文中的phalcon_array_update_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ phalcon_call_method函数代码示例发布时间:2022-05-30
下一篇:
C++ phalcon_array_isset_string函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap