本文整理汇总了C++中PHALCON_THROW_EXCEPTION_STR函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_THROW_EXCEPTION_STR函数的具体用法?C++ PHALCON_THROW_EXCEPTION_STR怎么用?C++ PHALCON_THROW_EXCEPTION_STR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_THROW_EXCEPTION_STR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Externally sets the view content
*
*<code>
*$this->view->setContent("<h1>hello</h1>");
*</code>
*
* @param string $content
*/
PHP_METHOD(Phalcon_Mvc_View, setContent){
zval *content;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &content) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(content) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_view_exception_ce, "Content must be a string");
return;
}
phalcon_update_property_zval(this_ptr, SL("_content"), content TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:kenjiroy,项目名称:cphalcon,代码行数:28,代码来源:view.c
示例2: PHP_METHOD
/**
* Sets the DependencyInjector container
*
* @param Phalcon\DI $dependencyInjector
*/
PHP_METHOD(Phalcon_Session_Bag, setDI){
zval *dependency_injector;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dependency_injector) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_session_exception_ce, "The dependency injector must be an Object");
return;
}
phalcon_update_property_zval(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:24,代码来源:bag.c
示例3: PHP_METHOD
/**
* Constructor for Phalcon\Db\Adapter\Pdo
*
* @param array $descriptor
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, __construct){
zval *descriptor;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &descriptor) == FAILURE) {
RETURN_MM_NULL();
}
if (Z_TYPE_P(descriptor) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "The descriptor must be an array");
return;
}
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "connect", descriptor);
PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon\\Db\\Adapter\\Pdo", "__construct", descriptor);
PHALCON_MM_RESTORE();
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:24,代码来源:pdo.c
示例4: PHP_METHOD
/**
* Sets the dependency injector container.
*
* @param Phalcon\DI $dispatcher
*/
PHP_METHOD(Phalcon_Tag, setDI){
zval *dependency_injector = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dependency_injector) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "Parameter dependencyInjector must be an Object");
return;
}
phalcon_update_static_property(SL("phalcon\\tag"), SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:codeanu,项目名称:cphalcon,代码行数:24,代码来源:tag.c
示例5: PHP_METHOD
/**
* Return active Dispatcher
*
* @return Phalcon_Dispatcher
*/
PHP_METHOD(Phalcon_Controller_Front, getDispatcher){
zval *t0 = NULL, *t1 = NULL;
PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "_dispatcher", sizeof("_dispatcher")-1, PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t0)) {
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, "_dispatcher", sizeof("_dispatcher")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_RETURN_CHECK_CTOR(t1);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_exception_ce, "Dispatch process has not started yet");
return;
}
PHALCON_MM_RESTORE();
}
开发者ID:andresgutierrez,项目名称:cphalcon,代码行数:24,代码来源:front.c
示例6: PHP_METHOD
/**
* Register an array of modules present in the console
*
*<code>
* $this->registerModules(array(
* 'frontend' => array(
* 'className' => 'Multiple\Frontend\Module',
* 'path' => '../apps/frontend/Module.php'
* ),
* 'backend' => array(
* 'className' => 'Multiple\Backend\Module',
* 'path' => '../apps/backend/Module.php'
* )
* ));
*</code>
*
* @param array $modules
*/
PHP_METHOD(Phalcon_CLI_Console, registerModules){
zval *modules;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &modules) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(modules) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_cli_console_exception_ce, "Modules must be an Array");
return;
}
phalcon_update_property_zval(this_ptr, SL("_modules"), modules TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:Tigerlee1987,项目名称:cphalcon,代码行数:37,代码来源:console.c
示例7: PHP_METHOD
/**
* Phalcon\Logger\Adapter\File constructor
*
* @param string $name
* @param array $options
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, __construct){
zval *name, *options = NULL, *mode = NULL, *handler, *exception_message;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &name, &options);
if (!options) {
PHALCON_INIT_VAR(options);
}
if (phalcon_array_isset_string(options, SS("mode"))) {
PHALCON_OBS_VAR(mode);
phalcon_array_fetch_string(&mode, options, SL("mode"), PH_NOISY);
if (phalcon_memnstr_str(mode, SL("r"))) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode");
return;
}
} else {
PHALCON_INIT_NVAR(mode);
ZVAL_STRING(mode, "ab", 1);
}
/**
* We use 'fopen' to respect to open-basedir directive
*/
PHALCON_INIT_VAR(handler);
phalcon_call_func_p2(handler, "fopen", name, mode);
if (!zend_is_true(handler)) {
PHALCON_INIT_VAR(exception_message);
PHALCON_CONCAT_SVS(exception_message, "Can't open log file at '", name, "'");
PHALCON_THROW_EXCEPTION_ZVAL(phalcon_logger_exception_ce, exception_message);
return;
}
phalcon_update_property_this(this_ptr, SL("_path"), name TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_fileHandler"), handler TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:DonOzone,项目名称:cphalcon,代码行数:49,代码来源:file.c
示例8: PHP_METHOD
/**
* Writes parsed annotations to files
*
* @param string $key
* @param Phalcon\Annotations\Reflection $data
*/
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){
zval *key, *data, *annotations_dir, *separator;
zval *virtual_key, *path, *to_string, *export, *php_export;
zval *status;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &key, &data);
PHALCON_OBS_VAR(annotations_dir);
phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
PHALCON_INIT_VAR(separator);
ZVAL_STRING(separator, "_", 1);
/**
* Paths must be normalized before be used as keys
*/
PHALCON_INIT_VAR(virtual_key);
phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
PHALCON_INIT_VAR(path);
PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
PHALCON_INIT_VAR(to_string);
ZVAL_BOOL(to_string, 1);
PHALCON_INIT_VAR(export);
phalcon_call_func_p2(export, "var_export", data, to_string);
PHALCON_INIT_VAR(php_export);
PHALCON_CONCAT_SVS(php_export, "<?php return ", export, "; ");
PHALCON_INIT_VAR(status);
phalcon_file_put_contents(status, path, php_export TSRMLS_CC);
if (PHALCON_IS_FALSE(status)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
return;
}
PHALCON_MM_RESTORE();
}
开发者ID:11mariom,项目名称:cphalcon,代码行数:49,代码来源:files.c
示例9: PHP_METHOD
/**
* Writes parsed annotations to files
*
* @param string $key
* @param array $data
*/
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){
zval *key, *data, *annotations_dir, *separator;
zval *virtual_key, *path, *to_string, *export, *php_export;
zval *status;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &key, &data) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_OBS_VAR(annotations_dir);
phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
PHALCON_INIT_VAR(separator);
ZVAL_STRING(separator, "_", 1);
PHALCON_INIT_VAR(virtual_key);
phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
PHALCON_INIT_VAR(path);
PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
PHALCON_INIT_VAR(to_string);
ZVAL_BOOL(to_string, 1);
PHALCON_INIT_VAR(export);
PHALCON_CALL_FUNC_PARAMS_2(export, "var_export", data, to_string);
PHALCON_INIT_VAR(php_export);
PHALCON_CONCAT_SVS(php_export, "<?php return ", export, "; ");
PHALCON_INIT_VAR(status);
PHALCON_CALL_FUNC_PARAMS_2(status, "file_put_contents", path, php_export);
if (PHALCON_IS_FALSE(status)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
return;
}
PHALCON_MM_RESTORE();
}
开发者ID:101010111100,项目名称:cphalcon,代码行数:48,代码来源:files.c
示例10: PHP_METHOD
/**
* Unserializing a resultset will allow to only works on the rows present in the saved state
*
* @param string $data
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize){
zval *data, *resultset, *model, *rows, *cache, *column_map;
zval *hydrate_mode;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &data) == FAILURE) {
RETURN_MM_NULL();
}
phalcon_update_property_long(this_ptr, SL("_type"), 0 TSRMLS_CC);
PHALCON_INIT_VAR(resultset);
PHALCON_CALL_FUNC_PARAMS_1(resultset, "unserialize", data);
if (Z_TYPE_P(resultset) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data");
return;
}
PHALCON_OBS_VAR(model);
phalcon_array_fetch_string(&model, resultset, SL("model"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_model"), model TSRMLS_CC);
PHALCON_OBS_VAR(rows);
phalcon_array_fetch_string(&rows, resultset, SL("rows"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_rows"), rows TSRMLS_CC);
PHALCON_OBS_VAR(cache);
phalcon_array_fetch_string(&cache, resultset, SL("cache"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_cache"), cache TSRMLS_CC);
PHALCON_OBS_VAR(column_map);
phalcon_array_fetch_string(&column_map, resultset, SL("columnMap"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_columnMap"), column_map TSRMLS_CC);
PHALCON_OBS_VAR(hydrate_mode);
phalcon_array_fetch_string(&hydrate_mode, resultset, SL("hydrateMode"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_hydrateMode"), hydrate_mode TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:bicouy0,项目名称:cphalcon,代码行数:47,代码来源:simple.c
示例11: PHP_METHOD
/**
* Check if a model has certain attribute
*
* @param Phalcon\Mvc\ModelInterface $model
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, hasAttribute){
zval *model, *attribute, *column_map, *meta_data;
zval *data_types;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model, &attribute) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(attribute) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Attribute must be a string");
return;
}
PHALCON_INIT_VAR(column_map);
PHALCON_CALL_METHOD_PARAMS_1(column_map, this_ptr, "getreversecolumnmap", model, PH_NO_CHECK);
if (Z_TYPE_P(column_map) == IS_ARRAY) {
eval_int = phalcon_array_isset(column_map, attribute);
if (eval_int) {
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
} else {
PHALCON_INIT_VAR(meta_data);
PHALCON_CALL_METHOD_PARAMS_1(meta_data, this_ptr, "readmetadata", model, PH_NO_CHECK);
PHALCON_INIT_VAR(data_types);
phalcon_array_fetch_long(&data_types, meta_data, 4, PH_NOISY_CC);
eval_int = phalcon_array_isset(data_types, attribute);
if (eval_int) {
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
}
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
开发者ID:Tigerlee1987,项目名称:cphalcon,代码行数:48,代码来源:metadata.c
示例12: PHP_METHOD
/**
* Phalcon_View_Engine_Mustache constructor
*
* @param Phalcon_View $view
* @param array $options
*/
PHP_METHOD(Phalcon_View_Engine_Mustache, __construct){
zval *view = NULL, *options = NULL, *mustache = NULL;
zval *c0 = NULL;
zval *r0 = NULL, *r1 = NULL;
zval *i0 = NULL;
int eval_int;
zend_class_entry *ce0;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &view, &options) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "Mustache", 1);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_1(r0, "class_exists", c0);
if (!zend_is_true(r0)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_view_exception_ce, "Mustache class must be loaded first");
return;
}
eval_int = phalcon_array_isset_string(options, SL("mustache")+1);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_array_fetch_string(&r1, options, SL("mustache"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(mustache, r1);
} else {
ce0 = zend_fetch_class("Mustache", strlen("Mustache"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, ce0);
PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK);
PHALCON_CPY_WRT(mustache, i0);
}
phalcon_update_property_zval(this_ptr, SL("_mustache"), mustache TSRMLS_CC);
PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon_View_Engine_Mustache", "__construct", view, options);
PHALCON_MM_RESTORE();
}
开发者ID:rcpsec,项目名称:cphalcon,代码行数:48,代码来源:mustache.c
示例13: PHP_METHOD
/**
* Rollbacks the internal transaction
*
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, rollback){
zval *transaction = NULL, *quenue = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(transaction);
phalcon_read_property(&transaction, this_ptr, SL("_transaction"), PH_NOISY_CC);
if (!zend_is_true(transaction)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "There is no active transaction");
return;
}
phalcon_update_property_bool(this_ptr, SL("_transaction"), 0 TSRMLS_CC);
PHALCON_INIT_VAR(quenue);
array_init(quenue);
phalcon_update_property_zval(this_ptr, SL("_quenue"), quenue TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:awakmu,项目名称:cphalcon,代码行数:24,代码来源:file.c
示例14: PHP_METHOD
/**
* Sets a database profiler to the connection
*
* @param Phalcon_Db_Profiler $profiler
*/
PHP_METHOD(Phalcon_Db, setProfiler){
zval *profiler = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &profiler) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(profiler) == IS_OBJECT) {
phalcon_update_property_zval(this_ptr, "_profiler", strlen("_profiler"), profiler TSRMLS_CC);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Profiler must be an object");
return;
}
PHALCON_MM_RESTORE();
}
开发者ID:andresgutierrez,项目名称:cphalcon,代码行数:25,代码来源:db.c
示例15: PHP_METHOD
/**
* Set an array with CSS classes to format the messages
*
* @param array $cssClasses
*/
PHP_METHOD(Phalcon_Flash, setCssClasses){
zval *css_classes = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &css_classes) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(css_classes) == IS_ARRAY) {
phalcon_update_property_zval(this_ptr, SL("_cssClasses"), css_classes TSRMLS_CC);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_flash_exception_ce, "CSS classes must be an Array");
return;
}
RETURN_CCTOR(this_ptr);
}
开发者ID:croustibat,项目名称:cphalcon,代码行数:25,代码来源:flash.c
示例16: PHP_METHOD
/**
* Rollbacks the internal transaction
*
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, rollback){
zval *t0 = NULL;
zval *a0 = NULL;
PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_transaction"), PH_NOISY_CC);
if (!zend_is_true(t0)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "There is no active transaction");
return;
}
phalcon_update_property_bool(this_ptr, SL("_transaction"), 0 TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(a0);
array_init(a0);
phalcon_update_property_zval(this_ptr, SL("_quenue"), a0 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:fatihzkaratana,项目名称:cphalcon,代码行数:24,代码来源:file.c
示例17: PHP_METHOD
/**
* Initializes the engine adapter
*
* @param Phalcon_View $view
* @param array $options
*/
PHP_METHOD(Phalcon_View_Engine, initialize){
zval *view = NULL, *options = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &view, &options) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(view) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_view_exception_ce, "Invalid view component provided to Phalcon_View_Engine");
return;
}
phalcon_update_property_zval(this_ptr, "_view", strlen("_view"), view TSRMLS_CC);
phalcon_update_property_zval(this_ptr, "_options", strlen("_options"), options TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:andresgutierrez,项目名称:cphalcon,代码行数:26,代码来源:engine.c
示例18: PHP_METHOD
/**
* Returns attributes that must be ignored from the UPDATE SQL generation
*
*<code>
* print_r($metaData->getAutomaticUpdateAttributes(new Robots()));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, getAutomaticUpdateAttributes) {
zval *model, *index, *data;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model);
PHALCON_INIT_VAR(index);
ZVAL_LONG(index, 11);
PHALCON_INIT_VAR(data);
phalcon_call_method_p2(data, this_ptr, "readmetadataindex", model, index);
if (Z_TYPE_P(data) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "The meta-data is invalid or is corrupt");
return;
}
RETURN_CCTOR(data);
}
开发者ID:rakeshbitling,项目名称:cphalcon,代码行数:30,代码来源:metadata.c
示例19: PHP_METHOD
/**
* Generates SQL to add an index to a table
*
* @param string $tableName
* @param string $schemaName
* @param Phalcon_Db_Index $index
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Mysql, addIndex){
zval *table_name = NULL, *schema_name = NULL, *index = NULL, *sql = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzz", &table_name, &schema_name, &index) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(index) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Index parameter must be an instance of Phalcon_Db_Index");
return;
}
if (zend_is_true(schema_name)) {
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CONCAT_SVSVS(r0, "ALTER TABLE `", schema_name, "`.`", table_name, "` ADD INDEX ");
PHALCON_CPY_WRT(sql, r0);
} else {
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_CONCAT_SVS(r1, "ALTER TABLE `", table_name, "` ADD INDEX ");
PHALCON_CPY_WRT(sql, r1);
}
PHALCON_ALLOC_ZVAL_MM(r2);
PHALCON_ALLOC_ZVAL_MM(r3);
PHALCON_CALL_METHOD(r3, index, "getname", PHALCON_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(r4);
PHALCON_ALLOC_ZVAL_MM(r5);
PHALCON_CALL_METHOD(r5, index, "getcolumns", PHALCON_NO_CHECK);
PHALCON_CALL_SELF_PARAMS_1(r4, this_ptr, "getcolumnlist", r5);
PHALCON_CONCAT_SVSVS(r2, "`", r3, "` (", r4, ")");
phalcon_concat_self(&sql, r2 TSRMLS_CC);
PHALCON_RETURN_CTOR(sql);
}
开发者ID:andresgutierrez,项目名称:cphalcon,代码行数:49,代码来源:mysql.c
示例20: PHP_METHOD
/**
* Initializes the session bag. This method must not be called directly, the class calls it when its internal data is accesed
*/
PHP_METHOD(Phalcon_Session_Bag, initialize){
zval *session = NULL, *dependency_injector, *service;
zval *name, *data = NULL;
PHALCON_MM_GROW();
PHALCON_OBS_VAR(session);
phalcon_read_property(&session, this_ptr, SL("_session"), PH_NOISY_CC);
if (Z_TYPE_P(session) != IS_OBJECT) {
PHALCON_OBS_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_session_exception_ce, "A dependency injection object is required to access the 'session' service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "session", 1);
PHALCON_INIT_NVAR(session);
PHALCON_CALL_METHOD_PARAMS_1(session, dependency_injector, "getshared", service);
phalcon_update_property_zval(this_ptr, SL("_session"), session TSRMLS_CC);
}
PHALCON_OBS_VAR(name);
phalcon_read_property(&name, this_ptr, SL("_name"), PH_NOISY_CC);
PHALCON_INIT_VAR(data);
PHALCON_CALL_METHOD_PARAMS_1(data, session, "get", name);
if (Z_TYPE_P(data) != IS_ARRAY) {
PHALCON_INIT_NVAR(data);
array_init(data);
}
phalcon_update_property_zval(this_ptr, SL("_data"), data TSRMLS_CC);
phalcon_update_property_bool(this_ptr, SL("_initalized"), 1 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:44,代码来源:bag.c
注:本文中的PHALCON_THROW_EXCEPTION_STR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论