/** * Generates a link to the current version documentation */ PHP_METHOD(Phalcon_Debug, getVersion) { zval *link = NULL, *_0 = NULL, *_2, *_3, *_4 = NULL; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL, *_5 = NULL, *_6 = NULL; ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(link); zephir_create_array(link, 4, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 0); ZEPHIR_CALL_CE_STATIC(&_0, phalcon_version_ce, "getpart", &_1, 161, _2); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZEPHIR_CONCAT_SVS(_3, "https://docs.phalconphp.com/en/", _0, ".0.0/"); zephir_array_update_string(&link, SL("action"), &_3, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_CE_STATIC(&_4, phalcon_version_ce, "get", &_5, 160); zephir_check_call_status(); zephir_array_update_string(&link, SL("text"), &_4, PH_COPY | PH_SEPARATE); zephir_array_update_string(&link, SL("local"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE); add_assoc_stringl_ex(link, SS("target"), SL("_new"), 1); ZEPHIR_CALL_CE_STATIC(&_4, phalcon_tag_ce, "linkto", &_6, 162, link); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, "<div class='version'>Phalcon Framework ", _4, "</div>"); RETURN_MM(); }
/** * Produces an string representation of a variable */ PHP_METHOD(Phalcon_Debug, _getVarDump) { zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_1 = NULL; zval *variable, *className, *dumpedObject = NULL, *dump, *_0 = NULL, *_2 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &variable); ZEPHIR_CALL_FUNCTION(&_0, "is_scalar", &_1, variable); zephir_check_call_status(); if (zephir_is_true(_0)) { if (Z_TYPE_P(variable) == IS_BOOL) { if (zephir_is_true(variable)) { RETURN_MM_STRING("true", 1); } else { RETURN_MM_STRING("false", 1); } } if (Z_TYPE_P(variable) == IS_STRING) { ZEPHIR_RETURN_CALL_METHOD(this_ptr, "_escapestring", NULL, variable); zephir_check_call_status(); RETURN_MM(); } RETVAL_ZVAL(variable, 1, 0); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_OBJECT) { ZEPHIR_INIT_VAR(className); zephir_get_class(className, variable, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(dump); if ((zephir_method_exists_ex(variable, SS("dump") TSRMLS_CC) == SUCCESS)) { ZEPHIR_CALL_METHOD(&dumpedObject, variable, "dump", NULL); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_2, this_ptr, "_getarraydump", &_3, dumpedObject); zephir_check_call_status(); ZEPHIR_CONCAT_SVSVS(dump, "Object(", className, ": ", _2, ")"); } else { ZEPHIR_CONCAT_SVS(dump, "Object(", className, ")</span>"); } RETURN_CCTOR(dump); } if (Z_TYPE_P(variable) == IS_ARRAY) { ZEPHIR_CALL_METHOD(&_2, this_ptr, "_getarraydump", &_3, variable); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, "Array(", _2, ")"); RETURN_MM(); } if (Z_TYPE_P(variable) == IS_NULL) { RETURN_MM_STRING("null", 1); } zephir_gettype(return_value, variable TSRMLS_CC); RETURN_MM(); }
/** * Generate the HTML to label the element * * @param array attributes */ PHP_METHOD(Phalcon_Forms_Element, label) { zend_bool _2; zephir_fcall_cache_entry *_0 = NULL; zend_long ZEPHIR_LAST_CALL_STATUS; zval *attributes = NULL, *internalAttributes = NULL, *label = NULL, *name = NULL, *code = NULL, *_1, *_3$$7, *_4$$8; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &attributes); if (!attributes) { ZEPHIR_CPY_WRT(attributes, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(attributes); } ZEPHIR_CALL_METHOD(&internalAttributes, this_ptr, "getattributes", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_VAR(name); if (!(zephir_array_isset_string_fetch(&name, internalAttributes, SS("id"), 0 TSRMLS_CC))) { ZEPHIR_OBS_NVAR(name); zephir_read_property_this(&name, this_ptr, SL("_name"), PH_NOISY_CC); } if (Z_TYPE_P(attributes) == IS_ARRAY) { if (!(zephir_array_isset_string(attributes, SS("for")))) { zephir_array_update_string(&attributes, SL("for"), &name, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_INIT_NVAR(attributes); zephir_create_array(attributes, 1, 0 TSRMLS_CC); zephir_array_update_string(&attributes, SL("for"), &name, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "<label", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_CE_STATIC(&code, phalcon_tag_ce, "renderattributes", &_0, 4, _1, attributes); zephir_check_temp_parameter(_1); zephir_check_call_status(); ZEPHIR_OBS_VAR(label); zephir_read_property_this(&label, this_ptr, SL("_label"), PH_NOISY_CC); _2 = zephir_is_true(label); if (!(_2)) { _2 = zephir_is_numeric(label); } if (_2) { ZEPHIR_INIT_VAR(_3$$7); ZEPHIR_CONCAT_SVS(_3$$7, ">", label, "</label>"); zephir_concat_self(&code, _3$$7 TSRMLS_CC); } else { ZEPHIR_INIT_VAR(_4$$8); ZEPHIR_CONCAT_SVS(_4$$8, ">", name, "</label>"); zephir_concat_self(&code, _4$$8 TSRMLS_CC); } RETURN_CCTOR(code); }
/** * Returns the content of the resource as an string * Optionally a base path where the resource is located can be set */ PHP_METHOD(Phalcon_Assets_Resource, getContent) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *basePath_param = NULL, *sourcePath = NULL, *completePath = NULL, *content = NULL, *_0, *_1$$5, *_2$$5, *_3$$6, *_4$$6; zval *basePath = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &basePath_param); if (!basePath_param) { ZEPHIR_INIT_VAR(basePath); ZVAL_EMPTY_STRING(basePath); } else { zephir_get_strval(basePath, basePath_param); } ZEPHIR_OBS_VAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_sourcePath"), PH_NOISY_CC); if (ZEPHIR_IS_EMPTY(sourcePath)) { ZEPHIR_OBS_NVAR(sourcePath); zephir_read_property_this(&sourcePath, this_ptr, SL("_path"), PH_NOISY_CC); } ZEPHIR_INIT_VAR(completePath); ZEPHIR_CONCAT_VV(completePath, basePath, sourcePath); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_local"), PH_NOISY_CC); if (zephir_is_true(_0)) { if (!((zephir_file_exists(completePath TSRMLS_CC) == SUCCESS))) { ZEPHIR_INIT_VAR(_1$$5); object_init_ex(_1$$5, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(_2$$5); ZEPHIR_CONCAT_SVS(_2$$5, "Resource's content for '", completePath, "' cannot be read"); ZEPHIR_CALL_METHOD(NULL, _1$$5, "__construct", NULL, 9, _2$$5); zephir_check_call_status(); zephir_throw_exception_debug(_1$$5, "phalcon/assets/resource.zep", 183 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } ZEPHIR_INIT_VAR(content); zephir_file_get_contents(content, completePath TSRMLS_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(content)) { ZEPHIR_INIT_VAR(_3$$6); object_init_ex(_3$$6, phalcon_assets_exception_ce); ZEPHIR_INIT_VAR(_4$$6); ZEPHIR_CONCAT_SVS(_4$$6, "Resource's content for '", completePath, "' cannot be read"); ZEPHIR_CALL_METHOD(NULL, _3$$6, "__construct", NULL, 9, _4$$6); zephir_check_call_status(); zephir_throw_exception_debug(_3$$6, "phalcon/assets/resource.zep", 192 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_CCTOR(content); }
/** * Generates SQL to drop a view */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView) { zend_bool ifExists; zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *sql, *view = NULL; zval *viewName = NULL, *schemaName = NULL, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &viewName_param, &schemaName_param, &ifExists_param); if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) { zephir_get_strval(viewName, viewName_param); } else { ZEPHIR_INIT_VAR(viewName); ZVAL_EMPTY_STRING(viewName); } if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } if (!ifExists_param) { ifExists = 1; } else { ifExists = zephir_get_boolval(ifExists_param); } if (schemaName && Z_STRLEN_P(schemaName)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_VSV(_0, schemaName, "\".\"", viewName); ZEPHIR_CPY_WRT(view, _0); } else { ZEPHIR_CPY_WRT(view, viewName); } ZEPHIR_INIT_VAR(sql); if (ifExists) { ZEPHIR_CONCAT_SVS(sql, "DROP VIEW IF EXISTS \"", view, "\""); } else { ZEPHIR_CONCAT_SVS(sql, "DROP VIEW \"", view, "\""); } RETURN_CCTOR(sql); }
/** * Generates SQL to drop a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) { zend_bool ifExists; zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *sql, *table = NULL; zval *tableName = NULL, *schemaName = NULL, *_0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param); if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (!schemaName_param) { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } else { zephir_get_strval(schemaName, schemaName_param); } if (!ifExists_param) { ifExists = 1; } else { if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } ifExists = Z_BVAL_P(ifExists_param); } if (schemaName && Z_STRLEN_P(schemaName)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_VSV(_0, schemaName, "\".\"", tableName); ZEPHIR_CPY_WRT(table, _0); } else { ZEPHIR_CPY_WRT(table, tableName); } ZEPHIR_INIT_VAR(sql); if (ifExists) { ZEPHIR_CONCAT_SVS(sql, "DROP TABLE IF EXISTS \"", table, "\""); } else { ZEPHIR_CONCAT_SVS(sql, "DROP TABLE \"", table, "\""); } RETURN_CCTOR(sql); }
/** * Returns the css sources */ PHP_METHOD(Phalcon_Debug, getCssSources) { zval *uri, *sources, *_0; ZEPHIR_MM_GROW(); uri = zephir_fetch_nproperty_this(this_ptr, SL("_uri"), PH_NOISY_CC); ZEPHIR_INIT_VAR(sources); ZEPHIR_CONCAT_SVS(sources, "<link href=\"", uri, "jquery/jquery-ui.css\" type=\"text/css\" rel=\"stylesheet\" />"); ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_SVS(_0, "<link href=\"", uri, "themes/default/style.css\" type=\"text/css\" rel=\"stylesheet\" />"); zephir_concat_self(&sources, _0 TSRMLS_CC); RETURN_CCTOR(sources); }
/** * Generates the SQL to get query list of indexes * * <code> * print_r( * $dialect->listIndexesSql("blog") * ); * </code> */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listIndexesSql) { int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *keyName_param = NULL, *_0 = NULL, *_1, *_2$$3 = NULL, *_3$$3; zval *table = NULL, *schema = NULL, *keyName = NULL, *sql = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &table_param, &schema_param, &keyName_param); if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(table_param) == IS_STRING)) { zephir_get_strval(table, table_param); } else { ZEPHIR_INIT_VAR(table); ZVAL_EMPTY_STRING(table); } if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } if (!keyName_param) { ZEPHIR_INIT_VAR(keyName); ZVAL_EMPTY_STRING(keyName); } else { zephir_get_strval(keyName, keyName_param); } ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", NULL, 53, table); zephir_check_call_status(); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "SELECT sql FROM sqlite_master WHERE type = 'index' AND tbl_name = ", _0, " COLLATE NOCASE"); zephir_get_strval(sql, _1); if (!(!keyName) && Z_STRLEN_P(keyName)) { ZEPHIR_CALL_METHOD(&_2$$3, this_ptr, "escape", NULL, 53, keyName); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_CONCAT_SVS(_3$$3, " AND name = ", _2$$3, " COLLATE NOCASE"); zephir_concat_self(&sql, _3$$3 TSRMLS_CC); } RETURN_CTOR(sql); }
PHP_METHOD(Test_Concat, testConcat2) { zval _1; zval url, _0; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, "test"); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other"); ZEPHIR_CPY_WRT(&url, &_0); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SS(&_1, "append", "other"); ZEPHIR_CPY_WRT(&url, &_1); ZEPHIR_INIT_LNVAR(_0); ZEPHIR_CONCAT_SSV(&_0, "append", "other", &url); ZEPHIR_CPY_WRT(&url, &_0); RETURN_CCTOR(url); }
PHP_METHOD(Test_Concat, testConcatSelf1) { zval _1; zval url, _0, _2; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, ""); zephir_concat_self_str(&url, SL("test") TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other"); zephir_concat_self(&url, &_0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SS(&_1, "append", "other"); zephir_concat_self(&url, &_1 TSRMLS_CC); ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_SSV(&_2, "append", "other", &url); zephir_concat_self(&url, &_2 TSRMLS_CC); RETURN_CCTOR(url); }
/** * Phalcon\Logger\Adapter\File constructor * * @param string name * @param array options */ PHP_METHOD(Phalcon_Logger_Adapter_File, __construct) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_3 = NULL; zval *name_param = NULL, *options = NULL, *mode = NULL, *handler = NULL, *_1; zval *name = NULL, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &name_param, &options); if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(name_param) == IS_STRING)) { zephir_get_strval(name, name_param); } else { ZEPHIR_INIT_VAR(name); ZVAL_EMPTY_STRING(name); } if (!options) { options = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(mode); ZVAL_NULL(mode); if (Z_TYPE_P(options) == IS_ARRAY) { ZEPHIR_OBS_NVAR(mode); if (zephir_array_isset_string_fetch(&mode, options, SS("mode"), 0 TSRMLS_CC)) { if (zephir_memnstr_str(mode, SL("r"), "phalcon/logger/adapter/file.zep", 72)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode", "phalcon/logger/adapter/file.zep", 73); return; } } } if (Z_TYPE_P(mode) == IS_NULL) { ZEPHIR_INIT_NVAR(mode); ZVAL_STRING(mode, "ab", 1); } ZEPHIR_CALL_FUNCTION(&handler, "fopen", &_0, name, mode); zephir_check_call_status(); if (Z_TYPE_P(handler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_1); object_init_ex(_1, phalcon_logger_exception_ce); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_SVS(_2, "Can't open log file at '", name, "'"); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2); zephir_check_call_status(); zephir_throw_exception_debug(_1, "phalcon/logger/adapter/file.zep", 87 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } zephir_update_property_this(this_ptr, SL("_path"), name TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_fileHandler"), handler TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * Generates SQL to query foreign keys on a table * * @param string table * @param string schema * @return string */ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeReferences) { zval *table, *schema = NULL, *sql, *_0 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table, &schema); if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(sql); ZVAL_STRING(sql, "SELECT tc.table_name as TABLE_NAME, kcu.column_name as COLUMN_NAME, tc.constraint_name as CONSTRAINT_NAME, tc.table_catalog as REFERENCED_TABLE_SCHEMA, ccu.table_name AS REFERENCED_TABLE_NAME, ccu.column_name AS REFERENCED_COLUMN_NAME FROM information_schema.table_constraints AS tc JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name WHERE constraint_type = 'FOREIGN KEY' AND ", 1); if (zephir_is_true(schema)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_SVSVS(_0, "tc.table_schema = '", schema, "' AND tc.table_name='", table, "'"); zephir_concat_self(&sql, _0 TSRMLS_CC); } else { ZEPHIR_INIT_LNVAR(_0); ZEPHIR_CONCAT_SVS(_0, "tc.table_name='", table, "'"); zephir_concat_self(&sql, _0 TSRMLS_CC); } RETURN_CCTOR(sql); }
/** * @inheritdoc */ PHP_METHOD(Owl_Log_AbstractWriter, getOption) { int ZEPHIR_LAST_CALL_STATUS; zval *option_param = NULL, *_0, *_1, *_3, *_4; zval *option = NULL, *_2; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &option_param); zephir_get_strval(option, option_param); _0 = zephir_fetch_nproperty_this(this_ptr, SL("options"), PH_NOISY_CC); if (!(zephir_array_isset(_0, option))) { ZEPHIR_INIT_VAR(_1); object_init_ex(_1, owl_log_exception_invalidwriterexception_ce); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_SVS(_2, "Option ", option, " is not exists"); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 1, _2); zephir_check_call_status(); zephir_throw_exception_debug(_1, "owl/Log/AbstractWriter.zep", 66 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } _3 = zephir_fetch_nproperty_this(this_ptr, SL("options"), PH_NOISY_CC); zephir_array_fetch(&_4, _3, option, PH_NOISY | PH_READONLY, "owl/Log/AbstractWriter.zep", 68 TSRMLS_CC); RETURN_CTOR(_4); }
/** * Returns the insert id for the auto_increment/serial column inserted in the lastest executed SQL statement * *<code> * //Inserting a new robot * $success = $connection->insert( * "robots", * array("Astro Boy", 1952), * array("name", "year") * ); * * //Getting the generated id * $id = $connection->lastInsertId(); *</code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Oracle, lastInsertId) { int ZEPHIR_LAST_CALL_STATUS; zval *sequenceName_param = NULL, *_0 = NULL, *_2, *_3; zval *sequenceName = NULL, *_1; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &sequenceName_param); if (!sequenceName_param) { ZEPHIR_INIT_VAR(sequenceName); ZVAL_EMPTY_STRING(sequenceName); } else { zephir_get_strval(sequenceName, sequenceName_param); } ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "SELECT ", sequenceName, ".CURRVAL FROM dual"); ZEPHIR_INIT_VAR(_2); ZVAL_LONG(_2, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _1, _2); zephir_check_call_status(); zephir_array_fetch_long(&_3, _0, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/oracle.zep", 223 TSRMLS_CC); RETURN_CTOR(_3); }
/** * Returns the prefix for all the generated urls. By default / */ PHP_METHOD(Phalcon_Mvc_Url, getBaseUri) { zval *_SERVER, baseUri, phpSelf, uri, _0; zval *this_ptr = getThis(); ZVAL_UNDEF(&baseUri); ZVAL_UNDEF(&phpSelf); ZVAL_UNDEF(&uri); ZVAL_UNDEF(&_0); ZEPHIR_MM_GROW(); zephir_get_global(&_SERVER, SL("_SERVER")); zephir_read_property(&_0, this_ptr, SL("baseUri"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&baseUri, &_0); if (Z_TYPE_P(&baseUri) == IS_NULL) { ZEPHIR_OBS_VAR(&phpSelf); if (zephir_array_isset_string_fetch(&phpSelf, _SERVER, SL("PHP_SELF"), 0)) { ZEPHIR_INIT_VAR(&uri); phalcon_get_uri(&uri, &phpSelf); } else { ZEPHIR_INIT_NVAR(&uri); ZVAL_NULL(&uri); } ZEPHIR_INIT_NVAR(&baseUri); if (!(zephir_is_true(&uri))) { ZVAL_STRING(&baseUri, "/"); } else { ZEPHIR_CONCAT_SVS(&baseUri, "/", &uri, "/"); } zephir_update_property_zval(this_ptr, SL("baseUri"), &baseUri); } RETURN_CCTOR(&baseUri); }
/** * Returns a form by its name */ PHP_METHOD(Phalcon_Forms_Manager, get) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, *form = NULL, *_0, *_1$$3; zval *name = NULL, *_2$$3; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(name, name_param); ZEPHIR_OBS_VAR(form); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_forms"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&form, _0, name, 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_CONCAT_SVS(_2$$3, "There is no form with name='", name, "'"); ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _2$$3); zephir_check_call_status(); zephir_throw_exception_debug(_1$$3, "phalcon/forms/manager.zep", 52 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_CCTOR(form); }
/** * Returns a form by its name */ PHP_METHOD(Phalcon_Forms_Manager, get) { zend_long ZEPHIR_LAST_CALL_STATUS; zval *name_param = NULL, form, _0, _1$$3; zval name, _2$$3; zval *this_ptr = getThis(); ZVAL_UNDEF(&name); ZVAL_UNDEF(&_2$$3); ZVAL_UNDEF(&form); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1$$3); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &name_param); zephir_get_strval(&name, name_param); ZEPHIR_OBS_VAR(&form); zephir_read_property(&_0, this_ptr, SL("_forms"), PH_NOISY_CC | PH_READONLY); if (!(zephir_array_isset_fetch(&form, &_0, &name, 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(&_1$$3); object_init_ex(&_1$$3, phalcon_forms_exception_ce); ZEPHIR_INIT_VAR(&_2$$3); ZEPHIR_CONCAT_SVS(&_2$$3, "There is no form with name='", &name, "'"); ZEPHIR_CALL_METHOD(NULL, &_1$$3, "__construct", NULL, 4, &_2$$3); zephir_check_call_status(); zephir_throw_exception_debug(&_1$$3, "phalcon/forms/manager.zep", 43 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } RETURN_CCTOR(&form); }
/** * Returns the prefix for all the generated urls. By default / */ PHP_METHOD(Phalcon_Mvc_Url, getBaseUri) { zval *_SERVER, *baseUri = NULL, *phpSelf = NULL, *uri = NULL; ZEPHIR_MM_GROW(); zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC); ZEPHIR_OBS_VAR(baseUri); zephir_read_property_this(&baseUri, this_ptr, SL("_baseUri"), PH_NOISY_CC); if (Z_TYPE_P(baseUri) == IS_NULL) { ZEPHIR_OBS_VAR(phpSelf); if (zephir_array_isset_string_fetch(&phpSelf, _SERVER, SS("PHP_SELF"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(uri); phalcon_get_uri(uri, phpSelf); } else { ZEPHIR_INIT_NVAR(uri); ZVAL_NULL(uri); } ZEPHIR_INIT_NVAR(baseUri); if (!(zephir_is_true(uri))) { ZVAL_STRING(baseUri, "/", 1); } else { ZEPHIR_CONCAT_SVS(baseUri, "/", uri, "/"); } zephir_update_property_this(getThis(), SL("_baseUri"), baseUri TSRMLS_CC); } RETURN_CCTOR(baseUri); }
/** * Escapes a column/table/schema name * * @param string|array identifier * @return string */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, escapeIdentifier) { zval *identifier, *domain, *name; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &identifier); if (Z_TYPE_P(identifier) == IS_ARRAY) { ZEPHIR_OBS_VAR(domain); zephir_array_fetch_long(&domain, identifier, 0, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 63 TSRMLS_CC); ZEPHIR_OBS_VAR(name); zephir_array_fetch_long(&name, identifier, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 64 TSRMLS_CC); if (ZEPHIR_GLOBAL(db).escape_identifiers) { ZEPHIR_CONCAT_SVSVS(return_value, "`", domain, "`.`", name, "`"); RETURN_MM(); } ZEPHIR_CONCAT_VSV(return_value, domain, ".", name); RETURN_MM(); } if (ZEPHIR_GLOBAL(db).escape_identifiers) { ZEPHIR_CONCAT_SVS(return_value, "`", identifier, "`"); RETURN_MM(); } RETVAL_ZVAL(identifier, 1, 0); RETURN_MM(); }
PHP_METHOD(Test_Concat, testConcat2) { zval _1; zval url, _0; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, "test"); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other"); ZEPHIR_CPY_WRT(&url, &_0); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SS(&_1, "append", "other"); ZEPHIR_CPY_WRT(&url, &_1); ZEPHIR_INIT_LNVAR(_0); ZEPHIR_CONCAT_SSV(&_0, "append", "other", &url); ZEPHIR_CPY_WRT(&url, &_0); RETURN_CCTOR(url); }
PHP_METHOD(Test_Concat, testConcatSelf1) { zval _1; zval url, _0, _2; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&url); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_1); ZEPHIR_MM_GROW(); ZEPHIR_INIT_VAR(&url); ZVAL_STRING(&url, ""); zephir_concat_self_str(&url, SL("test") TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other"); zephir_concat_self(&url, &_0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SS(&_1, "append", "other"); zephir_concat_self(&url, &_1 TSRMLS_CC); ZEPHIR_INIT_VAR(&_2); ZEPHIR_CONCAT_SSV(&_2, "append", "other", &url); zephir_concat_self(&url, &_2 TSRMLS_CC); RETURN_CCTOR(url); }
/** * Generates SQL describing a table * *<code> * print_r($dialect->describeColumns("posts")); *</code> * * @param string table * @param string schema * @return string */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeColumns) { zval *table_param = NULL, *schema = NULL; zval *table = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema); if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(table_param) == IS_STRING)) { zephir_get_strval(table, table_param); } else { ZEPHIR_INIT_VAR(table); ZVAL_EMPTY_STRING(table); } if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_CONCAT_SVS(return_value, "PRAGMA table_info('", table, "')"); RETURN_MM(); }
/** * List all tables in database * * <code> * print_r($dialect->listTables("blog")) * </code> */ PHP_METHOD(Phalcon_Db_Dialect_Oracle, listTables) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL; zval *schemaName_param = NULL, *_0 = NULL; zval *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &schemaName_param); if (!schemaName_param) { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } else { zephir_get_strval(schemaName, schemaName_param); } if (!ZEPHIR_IS_STRING(schemaName, "")) { ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, 144, schemaName); zephir_check_call_status(); ZEPHIR_CONCAT_SVS(return_value, "SELECT TABLE_NAME, OWNER FROM ALL_TABLES WHERE OWNER='", _0, "' ORDER BY OWNER, TABLE_NAME"); RETURN_MM(); } RETURN_MM_STRING("SELECT TABLE_NAME, OWNER FROM ALL_TABLES ORDER BY OWNER, TABLE_NAME", 1); }
/** * Generates SQL to query indexes detail on a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndex) { zval *index_param = NULL; zval *index = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &index_param); if (unlikely(Z_TYPE_P(index_param) != IS_STRING && Z_TYPE_P(index_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'index' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(index_param) == IS_STRING)) { zephir_get_strval(index, index_param); } else { ZEPHIR_INIT_VAR(index); ZVAL_EMPTY_STRING(index); } ZEPHIR_CONCAT_SVS(return_value, "PRAGMA index_info('", index, "')"); RETURN_MM(); }
/** * Generates SQL checking for the existence of a schema.view * * @param string viewName * @param string schemaName * @return string */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) { zval *viewName_param = NULL, *schemaName = NULL; zval *viewName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName); if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) { zephir_get_strval(viewName, viewName_param); } else { ZEPHIR_INIT_VAR(viewName); ZVAL_EMPTY_STRING(viewName); } if (!schemaName) { schemaName = ZEPHIR_GLOBAL(global_null); } ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM sqlite_master WHERE type='view' AND tbl_name='", viewName, "'"); RETURN_MM(); }
/** * Gets number of rows returned by a resultset * *<code> * $result = $connection->query("SELECT * FROM robots ORDER BY name"); * echo 'There are ', $result->numRows(), ' rows in the resultset'; *</code> */ PHP_METHOD(Phalcon_Db_Result_Pdo, numRows) { zend_bool _0$$3; zval *sqlStatement = NULL, *rowCount = NULL, *connection = NULL, *type = NULL, *pdoStatement = NULL, *matches = NULL, *result = NULL, *row = NULL, *_1$$6, _2$$6, *_3$$7, *_4$$7, *_5$$7, *_6$$7; int ZEPHIR_LAST_CALL_STATUS; ZEPHIR_MM_GROW(); ZEPHIR_OBS_VAR(rowCount); zephir_read_property_this(&rowCount, this_ptr, SL("_rowCount"), PH_NOISY_CC); if (ZEPHIR_IS_FALSE_IDENTICAL(rowCount)) { ZEPHIR_OBS_VAR(connection); zephir_read_property_this(&connection, this_ptr, SL("_connection"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&type, connection, "gettype", NULL, 0); zephir_check_call_status(); _0$$3 = ZEPHIR_IS_STRING(type, "mysql"); if (!(_0$$3)) { _0$$3 = ZEPHIR_IS_STRING(type, "pgsql"); } if (_0$$3) { ZEPHIR_OBS_VAR(pdoStatement); zephir_read_property_this(&pdoStatement, this_ptr, SL("_pdoStatement"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&rowCount, pdoStatement, "rowcount", NULL, 0); zephir_check_call_status(); } if (ZEPHIR_IS_FALSE_IDENTICAL(rowCount)) { ZEPHIR_OBS_VAR(sqlStatement); zephir_read_property_this(&sqlStatement, this_ptr, SL("_sqlStatement"), PH_NOISY_CC); if (!(zephir_start_with_str(sqlStatement, SL("SELECT COUNT(*) ")))) { ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_VAR(_1$$6); ZEPHIR_SINIT_VAR(_2$$6); ZVAL_STRING(&_2$$6, "/^SELECT\\s+(.*)/i", 0); zephir_preg_match(_1$$6, &_2$$6, sqlStatement, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_1$$6)) { zephir_array_fetch_long(&_3$$7, matches, 1, PH_NOISY | PH_READONLY, "phalcon/db/result/pdo.zep", 217 TSRMLS_CC); ZEPHIR_INIT_VAR(_4$$7); ZEPHIR_CONCAT_SVS(_4$$7, "SELECT COUNT(*) \"numrows\" FROM (SELECT ", _3$$7, ")"); _5$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_bindParams"), PH_NOISY_CC); _6$$7 = zephir_fetch_nproperty_this(this_ptr, SL("_bindTypes"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&result, connection, "query", NULL, 0, _4$$7, _5$$7, _6$$7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&row, result, "fetch", NULL, 0); zephir_check_call_status(); ZEPHIR_OBS_NVAR(rowCount); zephir_array_fetch_string(&rowCount, row, SL("numrows"), PH_NOISY, "phalcon/db/result/pdo.zep", 219 TSRMLS_CC); } } else { ZEPHIR_INIT_NVAR(rowCount); ZVAL_LONG(rowCount, 1); } } zephir_update_property_this(this_ptr, SL("_rowCount"), rowCount TSRMLS_CC); } RETURN_CCTOR(rowCount); }
/** * Generates SQL to delete an index from a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropIndex) { zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL, *sql = NULL; zval *tableName = NULL, *schemaName = NULL, *indexName = NULL, *_0 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param); if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) { zephir_get_strval(tableName, tableName_param); } else { ZEPHIR_INIT_VAR(tableName); ZVAL_EMPTY_STRING(tableName); } if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) { zephir_get_strval(schemaName, schemaName_param); } else { ZEPHIR_INIT_VAR(schemaName); ZVAL_EMPTY_STRING(schemaName); } if (unlikely(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(indexName_param) == IS_STRING)) { zephir_get_strval(indexName, indexName_param); } else { ZEPHIR_INIT_VAR(indexName); ZVAL_EMPTY_STRING(indexName); } ZEPHIR_INIT_VAR(sql); if (schemaName && Z_STRLEN_P(schemaName)) { ZEPHIR_INIT_VAR(_0); ZEPHIR_CONCAT_SVSVS(_0, "DROP INDEX \"", schemaName, "\".\"", indexName, "\""); ZEPHIR_CPY_WRT(sql, _0); } else { ZEPHIR_INIT_LNVAR(_0); ZEPHIR_CONCAT_SVS(_0, "DROP INDEX \"", indexName, "\""); ZEPHIR_CPY_WRT(sql, _0); } RETURN_CCTOR(sql); }
/** * Appends a NOT IN condition to the current conditions * *<code> * $criteria->notInWhere('id', [1, 2, 3]); *</code> */ PHP_METHOD(Phalcon_Mvc_Model_Criteria, notInWhere) { HashTable *_1; HashPosition _0; int ZEPHIR_LAST_CALL_STATUS; zval *values = NULL; zval *expr_param = NULL, *values_param = NULL, *hiddenParam = NULL, *bindParams = NULL, *bindKeys = NULL, *value = NULL, *key = NULL, **_2, *_4, *_5, *_3$$3 = NULL; zval *expr = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &expr_param, &values_param); if (unlikely(Z_TYPE_P(expr_param) != IS_STRING && Z_TYPE_P(expr_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'expr' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(expr_param) == IS_STRING)) { zephir_get_strval(expr, expr_param); } else { ZEPHIR_INIT_VAR(expr); ZVAL_EMPTY_STRING(expr); } values = values_param; ZEPHIR_OBS_VAR(hiddenParam); zephir_read_property_this(&hiddenParam, this_ptr, SL("_hiddenParamNumber"), PH_NOISY_CC); ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); ZEPHIR_INIT_VAR(bindKeys); array_init(bindKeys); zephir_is_iterable(values, &_1, &_0, 0, 0, "phalcon/mvc/model/criteria.zep", 503); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(value, _2); ZEPHIR_INIT_NVAR(key); ZEPHIR_CONCAT_SV(key, "ACP", hiddenParam); ZEPHIR_INIT_LNVAR(_3$$3); ZEPHIR_CONCAT_SVS(_3$$3, ":", key, ":"); zephir_array_append(&bindKeys, _3$$3, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 493); zephir_array_update_zval(&bindParams, key, &value, PH_COPY | PH_SEPARATE); ZEPHIR_SEPARATE(hiddenParam); zephir_increment(hiddenParam); } ZEPHIR_INIT_VAR(_4); zephir_fast_join_str(_4, SL(", "), bindKeys TSRMLS_CC); ZEPHIR_INIT_VAR(_5); ZEPHIR_CONCAT_VSVS(_5, expr, " NOT IN (", _4, ")"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "andwhere", NULL, 0, _5, bindParams); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_hiddenParamNumber"), hiddenParam TSRMLS_CC); RETURN_THIS(); }
/** * Load translates from file * * @param string file * @param int length * @param string delimiter * @param string enclosure */ PHP_METHOD(Phalcon_Translate_Adapter_Csv, _load) { zend_bool _6; zephir_fcall_cache_entry *_3 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *file, *length, *delimiter, *enclosure, *data = NULL, *fileHandler = NULL, _0 = zval_used_for_init, *_1 = NULL, *_2, *_4, _5 = zval_used_for_init, *_7, *_8 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 4, 0, &file, &length, &delimiter, &enclosure); ZEPHIR_SINIT_VAR(_0); ZVAL_STRING(&_0, "rb", 0); ZEPHIR_CALL_FUNCTION(&fileHandler, "fopen", NULL, 292, file, &_0); zephir_check_call_status(); if (Z_TYPE_P(fileHandler) != IS_RESOURCE) { ZEPHIR_INIT_VAR(_1); object_init_ex(_1, phalcon_translate_exception_ce); ZEPHIR_INIT_VAR(_2); ZEPHIR_CONCAT_SVS(_2, "Error opening translation file '", file, "'"); ZEPHIR_CALL_METHOD(NULL, _1, "__construct", NULL, 9, _2); zephir_check_call_status(); zephir_throw_exception_debug(_1, "phalcon/translate/adapter/csv.zep", 64 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } while (1) { ZEPHIR_CALL_FUNCTION(&data, "fgetcsv", &_3, 428, fileHandler, length, delimiter, enclosure); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(data)) { break; } zephir_array_fetch_long(&_4, data, 0, PH_NOISY | PH_READONLY, "phalcon/translate/adapter/csv.zep", 74 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_0); ZVAL_LONG(&_0, 0); ZEPHIR_SINIT_NVAR(_5); ZVAL_LONG(&_5, 1); ZEPHIR_INIT_NVAR(_1); zephir_substr(_1, _4, 0 , 1 , 0); _6 = ZEPHIR_IS_STRING_IDENTICAL(_1, "#"); if (!(_6)) { _6 = !(zephir_array_isset_long(data, 1)); } if (_6) { continue; } zephir_array_fetch_long(&_7, data, 1, PH_NOISY | PH_READONLY, "phalcon/translate/adapter/csv.zep", 78 TSRMLS_CC); ZEPHIR_OBS_NVAR(_8); zephir_array_fetch_long(&_8, data, 0, PH_NOISY, "phalcon/translate/adapter/csv.zep", 78 TSRMLS_CC); zephir_update_property_array(this_ptr, SL("_translate"), _8, _7 TSRMLS_CC); } zephir_fclose(fileHandler TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
/** * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. * Call it when you need to restore a database connection. */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Postgresql, connect) { zend_bool _3$$6; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_5 = NULL; zval *descriptor_param = NULL, *schema = NULL, *sql = NULL, *status = NULL, *_0$$3, *_2$$6, *_4$$6; zval *descriptor = NULL, *_1$$3 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &descriptor_param); if (!descriptor_param) { ZEPHIR_INIT_VAR(descriptor); array_init(descriptor); } else { zephir_get_arrval(descriptor, descriptor_param); } if (ZEPHIR_IS_EMPTY(descriptor)) { ZEPHIR_OBS_VAR(_0$$3); zephir_read_property_this(&_0$$3, this_ptr, SL("_descriptor"), PH_NOISY_CC); zephir_get_arrval(_1$$3, _0$$3); ZEPHIR_CPY_WRT(descriptor, _1$$3); } ZEPHIR_OBS_VAR(schema); if (zephir_array_isset_string_fetch(&schema, descriptor, SS("schema"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("schema"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(schema); ZVAL_STRING(schema, "", 1); } if (zephir_array_isset_string(descriptor, SS("password"))) { ZEPHIR_OBS_VAR(_2$$6); zephir_array_fetch_string(&_2$$6, descriptor, SL("password"), PH_NOISY, "phalcon/db/adapter/pdo/postgresql.zep", 73 TSRMLS_CC); _3$$6 = Z_TYPE_P(_2$$6) == IS_STRING; if (_3$$6) { zephir_array_fetch_string(&_4$$6, descriptor, SL("password"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/postgresql.zep", 73 TSRMLS_CC); _3$$6 = zephir_fast_strlen_ev(_4$$6) == 0; } if (_3$$6) { zephir_array_update_string(&descriptor, SL("password"), &ZEPHIR_GLOBAL(global_null), PH_COPY | PH_SEPARATE); } } ZEPHIR_CALL_PARENT(&status, phalcon_db_adapter_pdo_postgresql_ce, this_ptr, "connect", &_5, 149, descriptor); zephir_check_call_status(); if (!(ZEPHIR_IS_EMPTY(schema))) { ZEPHIR_INIT_VAR(sql); ZEPHIR_CONCAT_SVS(sql, "SET search_path TO '", schema, "'"); ZEPHIR_CALL_METHOD(NULL, this_ptr, "execute", NULL, 0, sql); zephir_check_call_status(); } RETURN_CCTOR(status); }