/** * Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST */ PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput) { zend_bool _6$$4, _7$$7; HashTable *_4$$3; HashPosition _3$$3; zend_class_entry *_2$$3; int ZEPHIR_LAST_CALL_STATUS; zval *data = NULL; zval *modelName = NULL, *operator = NULL, *_12$$10; zval *dependencyInjector, *modelName_param = NULL, *data_param = NULL, *operator_param = NULL, *attribute = NULL, *conditions = NULL, *field = NULL, *value = NULL, *type = NULL, *metaData = NULL, *model = NULL, *dataTypes = NULL, *bind = NULL, *criteria = NULL, *columnMap = NULL, *_0$$3, *_1$$3 = NULL, **_5$$3, *_8$$9 = NULL, *_9$$9 = NULL, *_10$$8 = NULL, *_11$$10; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &dependencyInjector, &modelName_param, &data_param, &operator_param); if (unlikely(Z_TYPE_P(modelName_param) != IS_STRING && Z_TYPE_P(modelName_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'modelName' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(modelName_param) == IS_STRING)) { zephir_get_strval(modelName, modelName_param); } else { ZEPHIR_INIT_VAR(modelName); ZVAL_EMPTY_STRING(modelName); } data = data_param; if (!operator_param) { ZEPHIR_INIT_VAR(operator); ZVAL_STRING(operator, "AND", 1); } else { if (unlikely(Z_TYPE_P(operator_param) != IS_STRING && Z_TYPE_P(operator_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'operator' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(operator_param) == IS_STRING)) { zephir_get_strval(operator, operator_param); } else { ZEPHIR_INIT_VAR(operator); ZVAL_EMPTY_STRING(operator); } } ZEPHIR_INIT_VAR(conditions); array_init(conditions); if (zephir_fast_count_int(data TSRMLS_CC)) { ZEPHIR_INIT_VAR(_0$$3); ZVAL_STRING(_0$$3, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0$$3); zephir_check_temp_parameter(_0$$3); zephir_check_call_status(); ZEPHIR_INIT_VAR(model); zephir_fetch_safe_class(_1$$3, modelName); _2$$3 = zend_fetch_class(Z_STRVAL_P(_1$$3), Z_STRLEN_P(_1$$3), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); object_init_ex(model, _2$$3); if (zephir_has_constructor(model TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, model, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&dataTypes, metaData, "getdatatypes", NULL, 0, model); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, model); zephir_check_call_status(); ZEPHIR_INIT_VAR(bind); array_init(bind); zephir_is_iterable(data, &_4$$3, &_3$$3, 0, 0, "phalcon/mvc/model/criteria.zep", 747); for ( ; zephir_hash_get_current_data_ex(_4$$3, (void**) &_5$$3, &_3$$3) == SUCCESS ; zephir_hash_move_forward_ex(_4$$3, &_3$$3) ) { ZEPHIR_GET_HMKEY(field, _4$$3, _3$$3); ZEPHIR_GET_HVALUE(value, _5$$3); _6$$4 = Z_TYPE_P(columnMap) == IS_ARRAY; if (_6$$4) { _6$$4 = (zephir_fast_count_int(columnMap TSRMLS_CC)) ? 1 : 0; } if (_6$$4) { ZEPHIR_OBS_NVAR(attribute); zephir_array_fetch(&attribute, columnMap, field, PH_NOISY, "phalcon/mvc/model/criteria.zep", 724 TSRMLS_CC); } else { ZEPHIR_CPY_WRT(attribute, field); } ZEPHIR_OBS_NVAR(type); if (zephir_array_isset_fetch(&type, dataTypes, attribute, 0 TSRMLS_CC)) { _7$$7 = Z_TYPE_P(value) != IS_NULL; if (_7$$7) { _7$$7 = !ZEPHIR_IS_STRING_IDENTICAL(value, ""); } if (_7$$7) { if (ZEPHIR_IS_LONG(type, 2)) { ZEPHIR_INIT_LNVAR(_8$$9); ZEPHIR_CONCAT_SVSVS(_8$$9, "[", field, "] LIKE :", field, ":"); zephir_array_append(&conditions, _8$$9, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 736); ZEPHIR_INIT_LNVAR(_9$$9); ZEPHIR_CONCAT_SVS(_9$$9, "%", value, "%"); zephir_array_update_zval(&bind, field, &_9$$9, PH_COPY | PH_SEPARATE); continue; } ZEPHIR_INIT_LNVAR(_10$$8); ZEPHIR_CONCAT_SVSVS(_10$$8, "[", field, "] = :", field, ":"); zephir_array_append(&conditions, _10$$8, PH_SEPARATE, "phalcon/mvc/model/criteria.zep", 743); zephir_array_update_zval(&bind, field, &value, PH_COPY | PH_SEPARATE); } } } } ZEPHIR_INIT_VAR(criteria); object_init_ex(criteria, phalcon_mvc_model_criteria_ce); if (zephir_has_constructor(criteria TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, criteria, "__construct", NULL, 0); zephir_check_call_status(); } if (zephir_fast_count_int(conditions TSRMLS_CC)) { ZEPHIR_INIT_VAR(_11$$10); ZEPHIR_INIT_VAR(_12$$10); ZEPHIR_CONCAT_SVS(_12$$10, " ", operator, " "); zephir_fast_join(_11$$10, _12$$10, conditions TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, criteria, "where", NULL, 306, _11$$10); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, criteria, "bind", NULL, 307, bind); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(NULL, criteria, "setmodelname", NULL, 300, modelName); zephir_check_call_status(); RETURN_CCTOR(criteria); }
PHP_METHOD(Phalcon_Validation_Validator_Uniqueness, isUniqueness) { zval *_24$$17 = NULL, *_33$$20 = NULL; zend_bool _11$$7, _18$$12, _19$$12; zend_class_entry *_53; HashTable *_2, *_8, *_21$$16, *_30$$19, *_43$$22; HashPosition _1, _7, _20$$16, _29$$19, _42$$22; zephir_fcall_cache_entry *_5 = NULL, *_12 = NULL, *_14 = NULL; int ZEPHIR_LAST_CALL_STATUS, index = 0; zval *validation, *field = NULL, *value = NULL, *values = NULL, *convert = NULL, *record = NULL, *attribute = NULL, *except = NULL, *params = NULL, *metaData = NULL, *primaryField = NULL, *className = NULL, *singleField = NULL, *fieldExcept = NULL, *singleExcept = NULL, *notInValues = NULL, *exceptConditions = NULL, *_0 = NULL, **_3, **_9, *_38 = NULL, *_51, *_52 = NULL, *_4$$4 = NULL, *_6$$5 = NULL, *_10$$7 = NULL, *_13$$7 = NULL, _15$$10 = zval_used_for_init, *_16$$10 = NULL, *_17$$11 = NULL, **_22$$16, *_25$$16 = NULL, *_26$$16 = NULL, _23$$17 = zval_used_for_init, _27$$18 = zval_used_for_init, *_28$$18 = NULL, **_31$$19, *_34$$19 = NULL, *_35$$19 = NULL, _32$$20 = zval_used_for_init, _36$$21 = zval_used_for_init, *_37$$21 = NULL, *_39$$22 = NULL, *_40$$22, *_41$$22 = NULL, **_44$$22, *_45$$23 = NULL, _46$$23 = zval_used_for_init, *_47$$23 = NULL, *_48$$23 = NULL, *_49$$24, *_50$$24; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &validation, &field); ZEPHIR_SEPARATE_PARAM(field); ZEPHIR_INIT_VAR(exceptConditions); array_init(exceptConditions); index = 0; ZEPHIR_INIT_VAR(params); zephir_create_array(params, 2, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); array_init(_0); zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_0); array_init(_0); zephir_array_update_string(¶ms, SL("bind"), &_0, PH_COPY | PH_SEPARATE); if (Z_TYPE_P(field) != IS_ARRAY) { ZEPHIR_CPY_WRT(singleField, field); ZEPHIR_INIT_NVAR(field); array_init(field); zephir_array_append(&field, singleField, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 156); } ZEPHIR_INIT_VAR(values); array_init(values); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "convert", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&convert, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); zephir_is_iterable(field, &_2, &_1, 0, 0, "phalcon/validation/validator/uniqueness.zep", 166); for ( ; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zephir_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HVALUE(singleField, _3); ZEPHIR_CALL_METHOD(&_4$$4, validation, "getvalue", &_5, 0, singleField); zephir_check_call_status(); zephir_array_update_zval(&values, singleField, &_4$$4, PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(convert) != IS_NULL) { ZEPHIR_CALL_ZVAL_FUNCTION(&_6$$5, convert, NULL, 0, values); zephir_check_call_status(); ZEPHIR_CPY_WRT(values, _6$$5); if (!(Z_TYPE_P(values) == IS_ARRAY)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Value conversion must return an array", "phalcon/validation/validator/uniqueness.zep", 170); return; } } zephir_is_iterable(field, &_8, &_7, 0, 0, "phalcon/validation/validator/uniqueness.zep", 241); for ( ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zephir_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(singleField, _9); ZEPHIR_INIT_NVAR(fieldExcept); ZVAL_NULL(fieldExcept); ZEPHIR_INIT_NVAR(notInValues); array_init(notInValues); ZEPHIR_INIT_NVAR(_10$$7); ZVAL_STRING(_10$$7, "model", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&record, this_ptr, "getoption", NULL, 0, _10$$7); zephir_check_temp_parameter(_10$$7); zephir_check_call_status(); ZEPHIR_OBS_NVAR(value); zephir_array_fetch(&value, values, singleField, PH_NOISY, "phalcon/validation/validator/uniqueness.zep", 178 TSRMLS_CC); _11$$7 = ZEPHIR_IS_EMPTY(record); if (!(_11$$7)) { _11$$7 = Z_TYPE_P(record) != IS_OBJECT; } if (_11$$7) { ZEPHIR_CALL_METHOD(&record, validation, "getentity", &_12, 0); zephir_check_call_status(); if (ZEPHIR_IS_EMPTY(record)) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_validation_exception_ce, "Model of record must be set to property \"model\"", "phalcon/validation/validator/uniqueness.zep", 184); return; } } ZEPHIR_INIT_NVAR(_10$$7); ZVAL_STRING(_10$$7, "attribute", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&_13$$7, this_ptr, "getoption", NULL, 0, _10$$7, singleField); zephir_check_temp_parameter(_10$$7); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&attribute, this_ptr, "getcolumnnamereal", &_14, 0, record, _13$$7); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_10$$7); ZVAL_STRING(_10$$7, "except", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&except, this_ptr, "getoption", NULL, 0, _10$$7); zephir_check_temp_parameter(_10$$7); zephir_check_call_status(); if (Z_TYPE_P(value) != IS_NULL) { ZEPHIR_SINIT_NVAR(_15$$10); ZVAL_LONG(&_15$$10, index); ZEPHIR_INIT_LNVAR(_16$$10); ZEPHIR_CONCAT_VSV(_16$$10, attribute, " = ?", &_15$$10); zephir_array_update_multi(¶ms, &_16$$10 TSRMLS_CC, SL("sa"), 3, SL("conditions")); zephir_array_update_multi(¶ms, &value TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } else { ZEPHIR_INIT_LNVAR(_17$$11); ZEPHIR_CONCAT_VS(_17$$11, attribute, " IS NULL"); zephir_array_update_multi(¶ms, &_17$$11 TSRMLS_CC, SL("sa"), 3, SL("conditions")); } if (zephir_is_true(except)) { _18$$12 = Z_TYPE_P(except) == IS_ARRAY; if (_18$$12) { _18$$12 = zephir_fast_count_int(field TSRMLS_CC) > 1; } if (_18$$12) { if (zephir_array_isset(except, singleField)) { ZEPHIR_OBS_NVAR(fieldExcept); zephir_array_fetch(&fieldExcept, except, singleField, PH_NOISY, "phalcon/validation/validator/uniqueness.zep", 203 TSRMLS_CC); } } _19$$12 = Z_TYPE_P(except) == IS_ARRAY; if (_19$$12) { _19$$12 = zephir_fast_count_int(field TSRMLS_CC) == 1; } if (Z_TYPE_P(fieldExcept) != IS_NULL) { if (Z_TYPE_P(fieldExcept) == IS_ARRAY) { zephir_is_iterable(fieldExcept, &_21$$16, &_20$$16, 0, 0, "phalcon/validation/validator/uniqueness.zep", 214); for ( ; zephir_hash_get_current_data_ex(_21$$16, (void**) &_22$$16, &_20$$16) == SUCCESS ; zephir_hash_move_forward_ex(_21$$16, &_20$$16) ) { ZEPHIR_GET_HVALUE(singleExcept, _22$$16); ZEPHIR_SINIT_NVAR(_23$$17); ZVAL_LONG(&_23$$17, index); ZEPHIR_INIT_LNVAR(_24$$17); ZEPHIR_CONCAT_SV(_24$$17, "?", &_23$$17); zephir_array_append(¬InValues, _24$$17, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 210); zephir_array_update_multi(¶ms, &singleExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } ZEPHIR_INIT_NVAR(_25$$16); zephir_fast_join_str(_25$$16, SL(","), notInValues TSRMLS_CC); ZEPHIR_INIT_LNVAR(_26$$16); ZEPHIR_CONCAT_VSVS(_26$$16, attribute, " NOT IN (", _25$$16, ")"); zephir_array_append(&exceptConditions, _26$$16, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 214); } else { ZEPHIR_SINIT_NVAR(_27$$18); ZVAL_LONG(&_27$$18, index); ZEPHIR_INIT_LNVAR(_28$$18); ZEPHIR_CONCAT_VSV(_28$$18, attribute, " <> ?", &_27$$18); zephir_array_append(&exceptConditions, _28$$18, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 217); zephir_array_update_multi(¶ms, &fieldExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } else if (_19$$12) { zephir_is_iterable(except, &_30$$19, &_29$$19, 0, 0, "phalcon/validation/validator/uniqueness.zep", 228); for ( ; zephir_hash_get_current_data_ex(_30$$19, (void**) &_31$$19, &_29$$19) == SUCCESS ; zephir_hash_move_forward_ex(_30$$19, &_29$$19) ) { ZEPHIR_GET_HVALUE(singleExcept, _31$$19); ZEPHIR_SINIT_NVAR(_32$$20); ZVAL_LONG(&_32$$20, index); ZEPHIR_INIT_LNVAR(_33$$20); ZEPHIR_CONCAT_SV(_33$$20, "?", &_32$$20); zephir_array_append(¬InValues, _33$$20, PH_SEPARATE, "phalcon/validation/validator/uniqueness.zep", 224); zephir_array_update_multi(¶ms, &singleExcept TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } ZEPHIR_INIT_NVAR(_34$$19); zephir_fast_join_str(_34$$19, SL(","), notInValues TSRMLS_CC); ZEPHIR_INIT_LNVAR(_35$$19); ZEPHIR_CONCAT_VSVS(_35$$19, attribute, " NOT IN (", _34$$19, ")"); zephir_array_update_multi(¶ms, &_35$$19 TSRMLS_CC, SL("sa"), 3, SL("conditions")); } else if (zephir_fast_count_int(field TSRMLS_CC) == 1) { ZEPHIR_SINIT_NVAR(_36$$21); ZVAL_LONG(&_36$$21, index); ZEPHIR_INIT_LNVAR(_37$$21); ZEPHIR_CONCAT_VSV(_37$$21, attribute, " <> ?", &_36$$21); zephir_array_update_multi(¶ms, &_37$$21 TSRMLS_CC, SL("sa"), 3, SL("conditions")); zephir_array_update_multi(¶ms, &except TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } } ZEPHIR_CALL_METHOD(&_38, record, "getdirtystate", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_38, 0)) { ZEPHIR_CALL_METHOD(&_39$$22, record, "getdi", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_40$$22); ZVAL_STRING(_40$$22, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&metaData, _39$$22, "getshared", NULL, 0, _40$$22); zephir_check_temp_parameter(_40$$22); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_41$$22, metaData, "getprimarykeyattributes", NULL, 0, record); zephir_check_call_status(); zephir_is_iterable(_41$$22, &_43$$22, &_42$$22, 0, 0, "phalcon/validation/validator/uniqueness.zep", 249); for ( ; zephir_hash_get_current_data_ex(_43$$22, (void**) &_44$$22, &_42$$22) == SUCCESS ; zephir_hash_move_forward_ex(_43$$22, &_42$$22) ) { ZEPHIR_GET_HVALUE(primaryField, _44$$22); ZEPHIR_CALL_METHOD(&_45$$23, this_ptr, "getcolumnnamereal", &_14, 0, record, primaryField); zephir_check_call_status(); ZEPHIR_SINIT_NVAR(_46$$23); ZVAL_LONG(&_46$$23, index); ZEPHIR_INIT_LNVAR(_47$$23); ZEPHIR_CONCAT_VSV(_47$$23, _45$$23, " <> ?", &_46$$23); zephir_array_update_multi(¶ms, &_47$$23 TSRMLS_CC, SL("sa"), 3, SL("conditions")); ZEPHIR_CALL_METHOD(&_48$$23, record, "readattribute", NULL, 0, primaryField); zephir_check_call_status(); zephir_array_update_multi(¶ms, &_48$$23 TSRMLS_CC, SL("sa"), 3, SL("bind")); index++; } } ZEPHIR_INIT_VAR(className); zephir_get_class(className, record, 0 TSRMLS_CC); if (!(ZEPHIR_IS_EMPTY(exceptConditions))) { ZEPHIR_INIT_VAR(_49$$24); zephir_fast_join_str(_49$$24, SL(" OR "), exceptConditions TSRMLS_CC); ZEPHIR_INIT_VAR(_50$$24); ZEPHIR_CONCAT_SVS(_50$$24, "(", _49$$24, ")"); zephir_array_update_multi(¶ms, &_50$$24 TSRMLS_CC, SL("sa"), 3, SL("conditions")); } ZEPHIR_INIT_NVAR(_0); zephir_array_fetch_string(&_51, params, SL("conditions"), PH_NOISY | PH_READONLY, "phalcon/validation/validator/uniqueness.zep", 255 TSRMLS_CC); zephir_fast_join_str(_0, SL(" AND "), _51 TSRMLS_CC); zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); _53 = zephir_fetch_class(className TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&_52, _53, "count", NULL, 0, params); zephir_check_call_status(); RETURN_MM_BOOL(ZEPHIR_IS_LONG(_52, 0)); }
/** * Phalcon\Config\Adapter\Ini constructor */ PHP_METHOD(Phalcon_Config_Adapter_Ini, __construct) { HashTable *_5, *_8$$5; HashPosition _4, _7$$5; zephir_fcall_cache_entry *_12 = NULL, *_16 = NULL, *_17 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *filePath_param = NULL, *iniConfig = NULL, _0, *config = NULL, *section = NULL, *sections = NULL, *directives = NULL, *path = NULL, *lastValue = NULL, **_6, *_1$$3, *_2$$3, *_3$$3, **_9$$5, *_10$$6 = NULL, *_13$$7 = NULL, _14$$7 = zval_used_for_init, *_15$$8 = NULL; zval *filePath = NULL, *_11$$6 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &filePath_param); if (unlikely(Z_TYPE_P(filePath_param) != IS_STRING && Z_TYPE_P(filePath_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'filePath' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(filePath_param) == IS_STRING)) { zephir_get_strval(filePath, filePath_param); } else { ZEPHIR_INIT_VAR(filePath); ZVAL_EMPTY_STRING(filePath); } ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 1); ZEPHIR_CALL_FUNCTION(&iniConfig, "parse_ini_file", NULL, 134, filePath, ZEPHIR_GLOBAL(global_true), &_0); zephir_check_call_status(); if (ZEPHIR_IS_FALSE_IDENTICAL(iniConfig)) { ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_config_exception_ce); ZEPHIR_INIT_VAR(_2$$3); zephir_basename(_2$$3, filePath TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_CONCAT_SVS(_3$$3, "Configuration file ", _2$$3, " can't be loaded"); ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _3$$3); zephir_check_call_status(); zephir_throw_exception_debug(_1$$3, "phalcon/config/adapter/ini.zep", 67 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(config); array_init(config); zephir_is_iterable(iniConfig, &_5, &_4, 0, 0, "phalcon/config/adapter/ini.zep", 88); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(section, _5, _4); ZEPHIR_GET_HVALUE(directives, _6); if (Z_TYPE_P(directives) == IS_ARRAY) { ZEPHIR_INIT_NVAR(sections); array_init(sections); zephir_is_iterable(directives, &_8$$5, &_7$$5, 0, 0, "phalcon/config/adapter/ini.zep", 80); for ( ; zephir_hash_get_current_data_ex(_8$$5, (void**) &_9$$5, &_7$$5) == SUCCESS ; zephir_hash_move_forward_ex(_8$$5, &_7$$5) ) { ZEPHIR_GET_HMKEY(path, _8$$5, _7$$5); ZEPHIR_GET_HVALUE(lastValue, _9$$5); zephir_get_strval(_11$$6, path); ZEPHIR_CALL_METHOD(&_10$$6, this_ptr, "_parseinistring", &_12, 0, _11$$6, lastValue); zephir_check_call_status(); zephir_array_append(§ions, _10$$6, PH_SEPARATE, "phalcon/config/adapter/ini.zep", 78); } if (zephir_fast_count_int(sections TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_13$$7); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_STRING(&_14$$7, "array_merge_recursive", 0); ZEPHIR_CALL_USER_FUNC_ARRAY(_13$$7, &_14$$7, sections); zephir_check_call_status(); zephir_array_update_zval(&config, section, &_13$$7, PH_COPY | PH_SEPARATE); } } else { ZEPHIR_CALL_METHOD(&_15$$8, this_ptr, "_cast", &_16, 135, directives); zephir_check_call_status(); zephir_array_update_zval(&config, section, &_15$$8, PH_COPY | PH_SEPARATE); } } ZEPHIR_CALL_PARENT(NULL, phalcon_config_adapter_ini_ce, this_ptr, "__construct", &_17, 19, config); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); }
/** * Produces a recursive representation of an array */ PHP_METHOD(Phalcon_Debug, _getArrayDump) { HashTable *_2; HashPosition _1; zend_bool _0; zephir_fcall_cache_entry *_4 = NULL, *_7 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *argument_param = NULL, *n = NULL, *numberArguments = NULL, *dump = NULL, *varDump = NULL, *k = NULL, *v = NULL, **_3, *_5$$8 = NULL, *_6$$8 = NULL, *_8$$9 = NULL, *_9$$5 = NULL; zval *argument = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &argument_param, &n); argument = argument_param; if (!n) { ZEPHIR_INIT_VAR(n); ZVAL_LONG(n, 0); } ZEPHIR_INIT_VAR(numberArguments); ZVAL_LONG(numberArguments, zephir_fast_count_int(argument TSRMLS_CC)); _0 = ZEPHIR_GE_LONG(n, 3); if (!(_0)) { _0 = ZEPHIR_IS_LONG(numberArguments, 0); } if (_0) { RETURN_MM_NULL(); } if (ZEPHIR_GE_LONG(numberArguments, 10)) { RETURN_CCTOR(numberArguments); } ZEPHIR_INIT_VAR(dump); array_init(dump); zephir_is_iterable(argument, &_2, &_1, 0, 0, "phalcon/debug.zep", 189); for ( ; zend_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS ; zend_hash_move_forward_ex(_2, &_1) ) { ZEPHIR_GET_HMKEY(k, _2, _1); ZEPHIR_GET_HVALUE(v, _3); if (ZEPHIR_IS_STRING(v, "")) { ZEPHIR_INIT_NVAR(varDump); ZVAL_STRING(varDump, "(empty string)", 1); } else if (zephir_is_scalar(v)) { ZEPHIR_CALL_METHOD(&varDump, this_ptr, "_escapestring", &_4, 0, v); zephir_check_call_status(); } else if (Z_TYPE_P(v) == IS_ARRAY) { ZEPHIR_INIT_NVAR(_6$$8); ZVAL_LONG(_6$$8, (zephir_get_numberval(n) + 1)); ZEPHIR_CALL_METHOD(&_5$$8, this_ptr, "_getarraydump", &_7, 159, v, _6$$8); zephir_check_call_status(); ZEPHIR_INIT_NVAR(varDump); ZEPHIR_CONCAT_SVS(varDump, "Array(", _5$$8, ")"); } else if (Z_TYPE_P(v) == IS_OBJECT) { ZEPHIR_INIT_NVAR(_8$$9); zephir_get_class(_8$$9, v, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(varDump); ZEPHIR_CONCAT_SVS(varDump, "Object(", _8$$9, ")"); } else if (Z_TYPE_P(v) == IS_NULL) { ZEPHIR_INIT_NVAR(varDump); ZVAL_STRING(varDump, "null", 1); } else { ZEPHIR_CPY_WRT(varDump, v); } ZEPHIR_INIT_LNVAR(_9$$5); ZEPHIR_CONCAT_SVSV(_9$$5, "[", k, "] => ", varDump); zephir_array_append(&dump, _9$$5, PH_SEPARATE, "phalcon/debug.zep", 186); } zephir_fast_join_str(return_value, SL(", "), dump TSRMLS_CC); RETURN_MM(); }
PHP_METHOD(Test_Sort, quick) { zephir_fcall_cache_entry *_7 = NULL; zend_bool _1; int i, length, pivot, item, _2, _3, ZEPHIR_LAST_CALL_STATUS; zval *arr_param = NULL, *left, *right, *_0, *_4 = NULL, *_5 = NULL, *_6 = NULL, *_9 = NULL; zval *arr = NULL, *_8; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &arr_param); zephir_get_arrval(arr, arr_param); length = zephir_fast_count_int(arr TSRMLS_CC); if (length <= 1) { RETURN_CTOR(arr); } ZEPHIR_OBS_VAR(_0); zephir_array_fetch_long(&_0, arr, 0, PH_NOISY, "test/sort.zep", 18 TSRMLS_CC); pivot = zephir_get_intval(_0); ZEPHIR_INIT_VAR(left); array_init(left); ZEPHIR_INIT_VAR(right); array_init(right); _3 = (length - 1); _2 = 1; _1 = 0; if (_2 <= _3) { while (1) { if (_1) { _2++; if (!(_2 <= _3)) { break; } } else { _1 = 1; } i = _2; ZEPHIR_OBS_NVAR(_4); zephir_array_fetch_long(&_4, arr, i, PH_NOISY, "test/sort.zep", 23 TSRMLS_CC); item = zephir_get_intval(_4); if (item < pivot) { ZEPHIR_INIT_NVAR(_5); ZVAL_LONG(_5, item); zephir_array_append(&left, _5, PH_SEPARATE, "test/sort.zep", 25); } else { ZEPHIR_INIT_NVAR(_5); ZVAL_LONG(_5, item); zephir_array_append(&right, _5, PH_SEPARATE, "test/sort.zep", 27); } } } ZEPHIR_CALL_METHOD(&_6, this_ptr, "quick", &_7, 68, left); zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); zephir_create_array(_8, 1, 0 TSRMLS_CC); ZEPHIR_INIT_NVAR(_5); ZVAL_LONG(_5, pivot); zephir_array_fast_append(_8, _5); ZEPHIR_CALL_METHOD(&_9, this_ptr, "quick", &_7, 68, right); zephir_check_call_status(); ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 69, _6, _8, _9); zephir_check_call_status(); RETURN_MM(); }
/** * Lists table indexes * * <code> * print_r($connection->describeIndexes('robots_parts')); * </code> * * @param string table * @param string schema * @return \Phalcon\Db\IndexInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeIndexes) { HashTable *_5, *_15; HashPosition _4, _14; zephir_fcall_cache_entry *_20 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema = NULL, *indexes = NULL, *index = NULL, *keyName = NULL, *indexObjects = NULL, *columns = NULL, *name = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, **_16, *_7$$4 = NULL, *_8$$3, *_10$$3, *_11$$3, *_9$$6, *_12$$7 = NULL, *_13$$8 = NULL, *_17$$10 = NULL, *_18$$10, *_19$$10; 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_INIT_VAR(indexes); array_init(indexes); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describeindexes", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 2); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 389); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(index, _6); zephir_array_fetch_string(&keyName, index, SL("Key_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 365 TSRMLS_CC); if (!(zephir_array_isset(indexes, keyName))) { ZEPHIR_INIT_NVAR(_7$$4); array_init(_7$$4); zephir_array_update_zval(&indexes, keyName, &_7$$4, PH_COPY | PH_SEPARATE); } zephir_array_fetch(&_8$$3, indexes, keyName, PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 371 TSRMLS_CC); if (!(zephir_array_isset_string(_8$$3, SS("columns")))) { ZEPHIR_INIT_NVAR(columns); array_init(columns); } else { zephir_array_fetch(&_9$$6, indexes, keyName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 374 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9$$6, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 374 TSRMLS_CC); } zephir_array_fetch_string(&_10$$3, index, SL("Column_name"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 377 TSRMLS_CC); zephir_array_append(&columns, _10$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 377); zephir_array_update_multi(&indexes, &columns TSRMLS_CC, SL("zs"), 3, keyName, SL("columns")); zephir_array_fetch_string(&_11$$3, index, SL("Non_unique"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 382 TSRMLS_CC); if (ZEPHIR_IS_STRING(keyName, "PRIMARY")) { ZEPHIR_INIT_NVAR(_12$$7); ZVAL_STRING(_12$$7, "PRIMARY", 1); zephir_array_update_multi(&indexes, &_12$$7 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else if (ZEPHIR_IS_LONG(_11$$3, 0)) { ZEPHIR_INIT_NVAR(_13$$8); ZVAL_STRING(_13$$8, "UNIQUE", 1); zephir_array_update_multi(&indexes, &_13$$8 TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } else { zephir_array_update_multi(&indexes, &ZEPHIR_GLOBAL(global_null) TSRMLS_CC, SL("zs"), 3, keyName, SL("type")); } } ZEPHIR_INIT_VAR(indexObjects); array_init(indexObjects); zephir_is_iterable(indexes, &_15, &_14, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 394); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(name, _15, _14); ZEPHIR_GET_HVALUE(index, _16); ZEPHIR_INIT_NVAR(_17$$10); object_init_ex(_17$$10, phalcon_db_index_ce); zephir_array_fetch_string(&_18$$10, index, SL("columns"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 391 TSRMLS_CC); zephir_array_fetch_string(&_19$$10, index, SL("type"), PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 391 TSRMLS_CC); ZEPHIR_CALL_METHOD(NULL, _17$$10, "__construct", &_20, 15, name, _18$$10, _19$$10); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_17$$10, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }
/** * Lists table references * * @param string table * @param string schema * @return Phalcon\Db\ReferenceInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) { zephir_fcall_cache_entry *_16 = NULL; zval *_11 = NULL; HashTable *_5, *_13; HashPosition _4, _12; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *references, *reference = NULL, *arrayReference = NULL, *constraintName = NULL, *referenceObjects, *name = NULL, *referencedSchema = NULL, *referencedTable = NULL, *columns = NULL, *referencedColumns = NULL, *number = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7, *_8, *_9, *_10, **_14, *_15 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table, &schema); if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(references); array_init(references); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describereferences", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 373); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HMKEY(number, _5, _4); ZEPHIR_GET_HVALUE(reference, _6); ZEPHIR_INIT_NVAR(constraintName); ZEPHIR_CONCAT_SV(constraintName, "foreign_key_", number); if (!(zephir_array_isset(references, constraintName))) { ZEPHIR_INIT_NVAR(referencedSchema); ZVAL_NULL(referencedSchema); ZEPHIR_OBS_NVAR(referencedTable); zephir_array_fetch_long(&referencedTable, reference, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 352 TSRMLS_CC); ZEPHIR_INIT_NVAR(columns); array_init(columns); ZEPHIR_INIT_NVAR(referencedColumns); array_init(referencedColumns); } else { zephir_array_fetch(&_7, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 356 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedSchema); zephir_array_fetch_string(&referencedSchema, _7, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 356 TSRMLS_CC); zephir_array_fetch(&_8, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 357 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedTable); zephir_array_fetch_string(&referencedTable, _8, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 357 TSRMLS_CC); zephir_array_fetch(&_9, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 358 TSRMLS_CC); ZEPHIR_OBS_NVAR(columns); zephir_array_fetch_string(&columns, _9, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 358 TSRMLS_CC); zephir_array_fetch(&_10, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 359 TSRMLS_CC); ZEPHIR_OBS_NVAR(referencedColumns); zephir_array_fetch_string(&referencedColumns, _10, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 359 TSRMLS_CC); } zephir_array_fetch_long(&_7, reference, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 362 TSRMLS_CC); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 362); zephir_array_fetch_long(&_8, reference, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 363 TSRMLS_CC); zephir_array_append(&referencedColumns, _8, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 363); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 4, 0 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("referencedTable"), &referencedTable, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("columns"), &columns, PH_COPY | PH_SEPARATE); zephir_array_update_string(&_11, SL("referencedColumns"), &referencedColumns, PH_COPY | PH_SEPARATE); zephir_array_update_zval(&references, constraintName, &_11, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(referenceObjects); array_init(referenceObjects); zephir_is_iterable(references, &_13, &_12, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 383); for ( ; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS ; zephir_hash_move_forward_ex(_13, &_12) ) { ZEPHIR_GET_HMKEY(name, _13, _12); ZEPHIR_GET_HVALUE(arrayReference, _14); ZEPHIR_INIT_NVAR(_3); object_init_ex(_3, phalcon_db_reference_ce); ZEPHIR_INIT_NVAR(_11); zephir_create_array(_11, 4, 0 TSRMLS_CC); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 376 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedSchema"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 377 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedTable"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 378 TSRMLS_CC); zephir_array_update_string(&_11, SL("columns"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_OBS_NVAR(_15); zephir_array_fetch_string(&_15, arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 380 TSRMLS_CC); zephir_array_update_string(&_11, SL("referencedColumns"), &_15, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_16, 16, name, _11); zephir_check_call_status(); zephir_array_update_zval(&referenceObjects, name, &_3, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(referenceObjects); }
/** * @return mixed */ PHP_METHOD(Lynx_Annotation_RegexDocParser, parseValue) { int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_14 = NULL; HashTable *_11; HashPosition _10; zend_bool _3, _15, _20; zval *value, *val = NULL, *vals, *v = NULL, _0, _1, *_2, _4, *_5, _6 = zval_used_for_init, _7 = zval_used_for_init, *_8 = NULL, _9 = zval_used_for_init, **_12, *_13 = NULL, *_16, _17, _18, *_19, _21, *_22, _23, _24, *_25 = NULL, *_26; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &value); ZEPHIR_INIT_VAR(val); zephir_fast_trim(val, value, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, 0); ZEPHIR_SINIT_VAR(_1); ZVAL_LONG(&_1, 1); ZEPHIR_INIT_VAR(_2); zephir_substr(_2, val, 0 , 1 , 0); _3 = ZEPHIR_IS_STRING(_2, "["); if (_3) { ZEPHIR_SINIT_VAR(_4); ZVAL_LONG(&_4, -1); ZEPHIR_INIT_VAR(_5); zephir_substr(_5, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); _3 = ZEPHIR_IS_STRING(_5, "]"); } if (_3) { ZEPHIR_INIT_VAR(vals); ZEPHIR_SINIT_VAR(_6); ZVAL_LONG(&_6, 1); ZEPHIR_SINIT_VAR(_7); ZVAL_LONG(&_7, -1); ZEPHIR_INIT_VAR(_8); zephir_substr(_8, val, 1 , -1 , 0); ZEPHIR_SINIT_VAR(_9); ZVAL_LONG(&_9, ','); zephir_fast_explode(vals, &_9, _8, LONG_MAX TSRMLS_CC); ZEPHIR_INIT_NVAR(val); array_init(val); zephir_is_iterable(vals, &_11, &_10, 0, 0, "lynx/Annotation/RegexDocParser.zep", 89); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HVALUE(v, _12); ZEPHIR_CALL_SELF(&_13, "parsevalue", &_14, v); zephir_check_call_status(); zephir_array_append(&val, _13, PH_SEPARATE, "lynx/Annotation/RegexDocParser.zep", 86); } RETURN_CCTOR(val); } else { ZEPHIR_SINIT_NVAR(_6); ZVAL_LONG(&_6, 0); ZEPHIR_SINIT_NVAR(_7); ZVAL_LONG(&_7, 1); ZEPHIR_INIT_NVAR(_8); zephir_substr(_8, val, 0 , 1 , 0); _15 = ZEPHIR_IS_STRING(_8, "{"); if (_15) { ZEPHIR_SINIT_NVAR(_9); ZVAL_LONG(&_9, -1); ZEPHIR_INIT_VAR(_16); zephir_substr(_16, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); _15 = ZEPHIR_IS_STRING(_16, "}"); } if (_15) { zephir_json_decode(return_value, &(return_value), val, 0 TSRMLS_CC); RETURN_MM(); } else { ZEPHIR_SINIT_VAR(_17); ZVAL_LONG(&_17, 0); ZEPHIR_SINIT_VAR(_18); ZVAL_LONG(&_18, 1); ZEPHIR_INIT_VAR(_19); zephir_substr(_19, val, 0 , 1 , 0); _20 = ZEPHIR_IS_STRING(_19, "\""); if (_20) { ZEPHIR_SINIT_VAR(_21); ZVAL_LONG(&_21, -1); ZEPHIR_INIT_VAR(_22); zephir_substr(_22, val, -1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); _20 = ZEPHIR_IS_STRING(_22, "\""); } if (_20) { ZEPHIR_SINIT_VAR(_23); ZVAL_LONG(&_23, 1); ZEPHIR_SINIT_VAR(_24); ZVAL_LONG(&_24, -1); ZEPHIR_INIT_VAR(_25); zephir_substr(_25, val, 1 , -1 , 0); ZEPHIR_CPY_WRT(val, _25); ZEPHIR_RETURN_CALL_SELF("parsevalue", &_14, val); zephir_check_call_status(); RETURN_MM(); } else { ZEPHIR_INIT_NVAR(_25); zephir_fast_strtolower(_25, val); if (ZEPHIR_IS_STRING(_25, "true")) { RETURN_MM_BOOL(1); } else { ZEPHIR_INIT_VAR(_26); zephir_fast_strtolower(_26, val); if (ZEPHIR_IS_STRING(_26, "false")) { RETURN_MM_BOOL(0); } else { if (zephir_is_numeric(val)) { if (zephir_get_doubleval(val) == zephir_get_intval(val)) { RETURN_MM_LONG(zephir_get_intval(val)); } else { RETURN_MM_DOUBLE(zephir_get_doubleval(val)); } } } } } } } RETURN_CCTOR(val); }
/** * Attach a listener to the events manager * * @param string eventType * @param object|callable handler * @param int priority */ PHP_METHOD(Phalcon_Events_Manager, attach) { int priority, ZEPHIR_LAST_CALL_STATUS; zval *eventType_param = NULL, *handler, *priority_param = NULL, *priorityQueue = NULL, *_0, *_1$$4, *_2$$5, *_3$$7; zval *eventType = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &eventType_param, &handler, &priority_param); if (unlikely(Z_TYPE_P(eventType_param) != IS_STRING && Z_TYPE_P(eventType_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'eventType' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(eventType_param) == IS_STRING)) { zephir_get_strval(eventType, eventType_param); } else { ZEPHIR_INIT_VAR(eventType); ZVAL_EMPTY_STRING(eventType); } if (!priority_param) { priority = 100; } else { if (unlikely(Z_TYPE_P(priority_param) != IS_LONG)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'priority' must be a int") TSRMLS_CC); RETURN_MM_NULL(); } priority = Z_LVAL_P(priority_param); } if (Z_TYPE_P(handler) != IS_OBJECT) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_events_exception_ce, "Event handler must be an Object", "phalcon/events/manager.zep", 56); return; } ZEPHIR_OBS_VAR(priorityQueue); _0 = zephir_fetch_nproperty_this(this_ptr, SL("_events"), PH_NOISY_CC); if (!(zephir_array_isset_fetch(&priorityQueue, _0, eventType, 0 TSRMLS_CC))) { _1$$4 = zephir_fetch_nproperty_this(this_ptr, SL("_enablePriorities"), PH_NOISY_CC); ZEPHIR_INIT_NVAR(priorityQueue); if (zephir_is_true(_1$$4)) { object_init_ex(priorityQueue, spl_ce_SplPriorityQueue); if (zephir_has_constructor(priorityQueue TSRMLS_CC)) { ZEPHIR_CALL_METHOD(NULL, priorityQueue, "__construct", NULL, 0); zephir_check_call_status(); } ZEPHIR_INIT_VAR(_2$$5); ZVAL_LONG(_2$$5, 1); ZEPHIR_CALL_METHOD(NULL, priorityQueue, "setextractflags", NULL, 190, _2$$5); zephir_check_call_status(); zephir_update_property_array(this_ptr, SL("_events"), eventType, priorityQueue TSRMLS_CC); } else { array_init(priorityQueue); } } if (Z_TYPE_P(priorityQueue) == IS_OBJECT) { ZEPHIR_INIT_VAR(_3$$7); ZVAL_LONG(_3$$7, priority); ZEPHIR_CALL_METHOD(NULL, priorityQueue, "insert", NULL, 191, handler, _3$$7); zephir_check_call_status(); } else { zephir_array_append(&priorityQueue, handler, PH_SEPARATE, "phalcon/events/manager.zep", 82); zephir_update_property_array(this_ptr, SL("_events"), eventType, priorityQueue TSRMLS_CC); } ZEPHIR_MM_RESTORE(); }
/** * Extracts a slice from a string/array/traversable object value */ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) { zend_bool _1$$5; zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL; int start, ZEPHIR_LAST_CALL_STATUS, position = 0; zval *value, *start_param = NULL, *end = NULL, *length = NULL, *slice = NULL, _10, *_0$$3 = NULL, *_2$$6 = NULL, _5$$9, _6$$11, _8$$10, _9$$12; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 2, &value, &start_param, &end); if (!start_param) { start = 0; } else { start = zephir_get_intval(start_param); } if (!end) { ZEPHIR_CPY_WRT(end, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(end); } if (Z_TYPE_P(value) == IS_OBJECT) { if (Z_TYPE_P(end) == IS_NULL) { ZEPHIR_INIT_NVAR(end); ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1)); } position = 0; ZEPHIR_INIT_VAR(slice); array_init(slice); ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL, 0); zephir_check_call_status(); while (1) { ZEPHIR_CALL_METHOD(&_0$$3, value, "valid", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_0$$3))) { break; } _1$$5 = position >= start; if (_1$$5) { _1$$5 = ZEPHIR_GE_LONG(end, position); } if (_1$$5) { ZEPHIR_CALL_METHOD(&_2$$6, value, "current", &_3, 0); zephir_check_call_status(); zephir_array_append(&slice, _2$$6, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 223); } ZEPHIR_CALL_METHOD(NULL, value, "next", &_4, 0); zephir_check_call_status(); position++; } RETURN_CCTOR(slice); } ZEPHIR_INIT_VAR(length); if (Z_TYPE_P(end) != IS_NULL) { ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1)); } else { ZVAL_NULL(length); } if (Z_TYPE_P(value) == IS_ARRAY) { ZEPHIR_SINIT_VAR(_5$$9); ZVAL_LONG(&_5$$9, start); ZEPHIR_RETURN_CALL_FUNCTION("array_slice", NULL, 394, value, &_5$$9, length); zephir_check_call_status(); RETURN_MM(); } if ((zephir_function_exists_ex(SS("mb_substr") TSRMLS_CC) == SUCCESS)) { if (Z_TYPE_P(length) != IS_NULL) { ZEPHIR_SINIT_VAR(_6$$11); ZVAL_LONG(&_6$$11, start); ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 395, value, &_6$$11, length); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_SINIT_VAR(_8$$10); ZVAL_LONG(&_8$$10, start); ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, 395, value, &_8$$10); zephir_check_call_status(); RETURN_MM(); } if (Z_TYPE_P(length) != IS_NULL) { ZEPHIR_SINIT_VAR(_9$$12); ZVAL_LONG(&_9$$12, start); zephir_substr(return_value, value, zephir_get_intval(&_9$$12), zephir_get_intval(length), 0); RETURN_MM(); } ZEPHIR_SINIT_VAR(_10); ZVAL_LONG(&_10, start); zephir_substr(return_value, value, zephir_get_intval(&_10), 0, ZEPHIR_SUBSTR_NO_LENGTH); RETURN_MM(); }
/** * Set an specific argument */ PHP_METHOD(Phalcon_Cli_Console, setArgument) { HashTable *_3; HashPosition _2; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_1 = NULL, *_8 = NULL, *_27 = NULL; zend_bool str, shift, _0; zval *arguments_param = NULL, *str_param = NULL, *shift_param = NULL, *arg = NULL, *pos = NULL, *args = NULL, *opts = NULL, *handleArgs = NULL, **_4, _5$$5 = zval_used_for_init, _6$$5 = zval_used_for_init, *_7$$5 = NULL, _9$$6 = zval_used_for_init, *_10$$7 = NULL, _11$$7 = zval_used_for_init, *_12$$7 = NULL, *_13$$7 = NULL, _14$$7 = zval_used_for_init, _15$$7 = zval_used_for_init, *_16$$7 = NULL, *_17$$8 = NULL, _18$$8 = zval_used_for_init, *_19$$8 = NULL, _20$$9 = zval_used_for_init, _21$$9 = zval_used_for_init, *_22$$9 = NULL, _23$$10 = zval_used_for_init, *_24$$10 = NULL, *_25$$13, *_26$$13 = NULL, *_28$$15 = NULL, *_29$$16 = NULL, *_30$$17; zval *arguments = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 3, &arguments_param, &str_param, &shift_param); if (!arguments_param) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); } else { arguments = arguments_param; } if (!str_param) { str = 1; } else { if (unlikely(Z_TYPE_P(str_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } str = Z_BVAL_P(str_param); } if (!shift_param) { shift = 1; } else { if (unlikely(Z_TYPE_P(shift_param) != IS_BOOL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'shift' must be a bool") TSRMLS_CC); RETURN_MM_NULL(); } shift = Z_BVAL_P(shift_param); } ZEPHIR_INIT_VAR(args); array_init(args); ZEPHIR_INIT_VAR(opts); array_init(opts); ZEPHIR_INIT_VAR(handleArgs); array_init(handleArgs); _0 = shift; if (_0) { _0 = ((zephir_fast_count_int(arguments TSRMLS_CC)) ? 1 : 0); } if (_0) { ZEPHIR_MAKE_REF(arguments); ZEPHIR_CALL_FUNCTION(NULL, "array_shift", &_1, 132, arguments); ZEPHIR_UNREF(arguments); zephir_check_call_status(); } zephir_is_iterable(arguments, &_3, &_2, 0, 0, "phalcon/cli/console.zep", 199); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(arg, _4); if (Z_TYPE_P(arg) == IS_STRING) { ZEPHIR_SINIT_NVAR(_5$$5); ZVAL_STRING(&_5$$5, "--", 0); ZEPHIR_SINIT_NVAR(_6$$5); ZVAL_LONG(&_6$$5, 2); ZEPHIR_CALL_FUNCTION(&_7$$5, "strncmp", &_8, 133, arg, &_5$$5, &_6$$5); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_7$$5, 0)) { ZEPHIR_SINIT_NVAR(_9$$6); ZVAL_STRING(&_9$$6, "=", 0); ZEPHIR_INIT_NVAR(pos); zephir_fast_strpos(pos, arg, &_9$$6, 0 ); if (zephir_is_true(pos)) { ZEPHIR_INIT_NVAR(_10$$7); ZEPHIR_SINIT_NVAR(_11$$7); ZVAL_LONG(&_11$$7, (zephir_get_numberval(pos) + 1)); ZEPHIR_INIT_NVAR(_12$$7); zephir_substr(_12$$7, arg, zephir_get_intval(&_11$$7), 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_fast_trim(_10$$7, _12$$7, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_NVAR(_13$$7); ZEPHIR_SINIT_NVAR(_14$$7); ZVAL_LONG(&_14$$7, 2); ZEPHIR_SINIT_NVAR(_15$$7); ZVAL_LONG(&_15$$7, (zephir_get_numberval(pos) - 2)); ZEPHIR_INIT_NVAR(_16$$7); zephir_substr(_16$$7, arg, 2 , zephir_get_intval(&_15$$7), 0); zephir_fast_trim(_13$$7, _16$$7, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); zephir_array_update_zval(&opts, _13$$7, &_10$$7, PH_COPY | PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(_17$$8); ZEPHIR_SINIT_NVAR(_18$$8); ZVAL_LONG(&_18$$8, 2); ZEPHIR_INIT_NVAR(_19$$8); zephir_substr(_19$$8, arg, 2 , 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_fast_trim(_17$$8, _19$$8, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); zephir_array_update_zval(&opts, _17$$8, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } } else { ZEPHIR_SINIT_NVAR(_20$$9); ZVAL_STRING(&_20$$9, "-", 0); ZEPHIR_SINIT_NVAR(_21$$9); ZVAL_LONG(&_21$$9, 1); ZEPHIR_CALL_FUNCTION(&_22$$9, "strncmp", &_8, 133, arg, &_20$$9, &_21$$9); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_22$$9, 0)) { ZEPHIR_SINIT_NVAR(_23$$10); ZVAL_LONG(&_23$$10, 1); ZEPHIR_INIT_NVAR(_24$$10); zephir_substr(_24$$10, arg, 1 , 0, ZEPHIR_SUBSTR_NO_LENGTH); zephir_array_update_zval(&opts, _24$$10, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_append(&args, arg, PH_SEPARATE, "phalcon/cli/console.zep", 191); } } } else { zephir_array_append(&args, arg, PH_SEPARATE, "phalcon/cli/console.zep", 195); } } if (str) { ZEPHIR_INIT_VAR(_25$$13); ZEPHIR_CALL_CE_STATIC(&_26$$13, phalcon_cli_router_route_ce, "getdelimiter", &_27, 134); zephir_check_call_status(); zephir_fast_join(_25$$13, _26$$13, args TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_arguments"), _25$$13 TSRMLS_CC); } else { if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_MAKE_REF(args); ZEPHIR_CALL_FUNCTION(&_28$$15, "array_shift", &_1, 132, args); ZEPHIR_UNREF(args); zephir_check_call_status(); zephir_array_update_string(&handleArgs, SL("task"), &_28$$15, PH_COPY | PH_SEPARATE); } if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_MAKE_REF(args); ZEPHIR_CALL_FUNCTION(&_29$$16, "array_shift", &_1, 132, args); ZEPHIR_UNREF(args); zephir_check_call_status(); zephir_array_update_string(&handleArgs, SL("action"), &_29$$16, PH_COPY | PH_SEPARATE); } if (zephir_fast_count_int(args TSRMLS_CC)) { ZEPHIR_INIT_VAR(_30$$17); zephir_fast_array_merge(_30$$17, &(handleArgs), &(args) TSRMLS_CC); ZEPHIR_CPY_WRT(handleArgs, _30$$17); } zephir_update_property_this(this_ptr, SL("_arguments"), handleArgs TSRMLS_CC); } zephir_update_property_this(this_ptr, SL("_options"), opts TSRMLS_CC); RETURN_THIS(); }
/** * Generates SQL to create a table */ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) { HashTable *_1, *_18$$14, *_31$$18; HashPosition _0, _17$$14, _30$$18; zend_bool hasPrimary = 0, _7$$7, _9$$7, _20$$15, _21$$15; zephir_fcall_cache_entry *_5 = NULL, *_14 = NULL, *_25 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *definition = NULL; zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL, *columns = NULL, *table = NULL, *temporary = NULL, *options = NULL, *createLines = NULL, *columnLine = NULL, *column = NULL, *indexes = NULL, *index = NULL, *indexName = NULL, *indexType = NULL, *references = NULL, *reference = NULL, *defaultValue = NULL, *referenceSql = NULL, *onDelete = NULL, *onUpdate = NULL, *sql = NULL, **_2, *_41, *_42, *_3$$7 = NULL, *_4$$7 = NULL, *_6$$7 = NULL, *_8$$7 = NULL, *_10$$7 = NULL, *_16$$7 = NULL, *_11$$10 = NULL, _12$$12 = zval_used_for_init, *_13$$12 = NULL, *_15$$12 = NULL, **_19$$14, *_22$$15 = NULL, *_23$$16 = NULL, *_24$$16 = NULL, *_26$$16 = NULL, *_27$$17 = NULL, *_28$$17 = NULL, *_29$$17 = NULL, **_32$$18, *_33$$19 = NULL, *_34$$19 = NULL, *_35$$19 = NULL, *_36$$19 = NULL, *_37$$19 = NULL, *_38$$19 = NULL, *_39$$20 = NULL, *_40$$21 = NULL; zval *tableName = NULL, *schemaName = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_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); } definition = definition_param; ZEPHIR_CALL_METHOD(&table, this_ptr, "preparetable", NULL, 0, tableName, schemaName); zephir_check_call_status(); ZEPHIR_INIT_VAR(temporary); ZVAL_BOOL(temporary, 0); ZEPHIR_OBS_VAR(options); if (zephir_array_isset_string_fetch(&options, definition, SS("options"), 0 TSRMLS_CC)) { ZEPHIR_OBS_NVAR(temporary); zephir_array_isset_string_fetch(&temporary, options, SS("temporary"), 0 TSRMLS_CC); } ZEPHIR_OBS_VAR(columns); if (!(zephir_array_isset_string_fetch(&columns, definition, SS("columns"), 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/db/dialect/sqlite.zep", 322); return; } ZEPHIR_INIT_VAR(sql); if (zephir_is_true(temporary)) { ZEPHIR_CONCAT_SVS(sql, "CREATE TEMPORARY TABLE ", table, " (\n\t"); } else { ZEPHIR_CONCAT_SVS(sql, "CREATE TABLE ", table, " (\n\t"); } hasPrimary = 0; ZEPHIR_INIT_VAR(createLines); array_init(createLines); zephir_is_iterable(columns, &_1, &_0, 0, 0, "phalcon/db/dialect/sqlite.zep", 380); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HVALUE(column, _2); ZEPHIR_CALL_METHOD(&_3$$7, column, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_4$$7, this_ptr, "getcolumndefinition", &_5, 0, column); zephir_check_call_status(); ZEPHIR_INIT_NVAR(columnLine); ZEPHIR_CONCAT_SVSV(columnLine, "`", _3$$7, "` ", _4$$7); ZEPHIR_CALL_METHOD(&_6$$7, column, "isprimary", NULL, 0); zephir_check_call_status(); _7$$7 = zephir_is_true(_6$$7); if (_7$$7) { _7$$7 = !hasPrimary; } if (_7$$7) { zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY") TSRMLS_CC); hasPrimary = 1; } ZEPHIR_CALL_METHOD(&_8$$7, column, "isautoincrement", NULL, 0); zephir_check_call_status(); _9$$7 = zephir_is_true(_8$$7); if (_9$$7) { _9$$7 = hasPrimary; } if (_9$$7) { zephir_concat_self_str(&columnLine, SL(" AUTOINCREMENT") TSRMLS_CC); } ZEPHIR_CALL_METHOD(&_10$$7, column, "hasdefault", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_10$$7)) { ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_11$$10); zephir_fast_strtoupper(_11$$10, defaultValue); if (zephir_memnstr_str(_11$$10, SL("CURRENT_TIMESTAMP"), "phalcon/db/dialect/sqlite.zep", 360)) { zephir_concat_self_str(&columnLine, SL(" DEFAULT CURRENT_TIMESTAMP") TSRMLS_CC); } else { ZEPHIR_SINIT_NVAR(_12$$12); ZVAL_STRING(&_12$$12, "\"", 0); ZEPHIR_CALL_FUNCTION(&_13$$12, "addcslashes", &_14, 153, defaultValue, &_12$$12); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_15$$12); ZEPHIR_CONCAT_SVS(_15$$12, " DEFAULT \"", _13$$12, "\""); zephir_concat_self(&columnLine, _15$$12 TSRMLS_CC); } } ZEPHIR_CALL_METHOD(&_16$$7, column, "isnotnull", NULL, 0); zephir_check_call_status(); if (zephir_is_true(_16$$7)) { zephir_concat_self_str(&columnLine, SL(" NOT NULL") TSRMLS_CC); } zephir_array_append(&createLines, columnLine, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 374); } ZEPHIR_OBS_VAR(indexes); if (zephir_array_isset_string_fetch(&indexes, definition, SS("indexes"), 0 TSRMLS_CC)) { zephir_is_iterable(indexes, &_18$$14, &_17$$14, 0, 0, "phalcon/db/dialect/sqlite.zep", 396); for ( ; zephir_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zephir_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(index, _19$$14); ZEPHIR_CALL_METHOD(&indexName, index, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&indexType, index, "gettype", NULL, 0); zephir_check_call_status(); _20$$15 = ZEPHIR_IS_STRING(indexName, "PRIMARY"); if (_20$$15) { _20$$15 = !hasPrimary; } _21$$15 = !(ZEPHIR_IS_EMPTY(indexType)); if (_21$$15) { ZEPHIR_INIT_NVAR(_22$$15); zephir_fast_strtoupper(_22$$15, indexType); _21$$15 = zephir_memnstr_str(_22$$15, SL("UNIQUE"), "phalcon/db/dialect/sqlite.zep", 392); } if (_20$$15) { ZEPHIR_CALL_METHOD(&_24$$16, index, "getcolumns", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_23$$16, this_ptr, "getcolumnlist", &_25, 54, _24$$16); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_26$$16); ZEPHIR_CONCAT_SVS(_26$$16, "PRIMARY KEY (", _23$$16, ")"); zephir_array_append(&createLines, _26$$16, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 391); } else if (_21$$15) { ZEPHIR_CALL_METHOD(&_28$$17, index, "getcolumns", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_27$$17, this_ptr, "getcolumnlist", &_25, 54, _28$$17); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_29$$17); ZEPHIR_CONCAT_SVS(_29$$17, "UNIQUE (", _27$$17, ")"); zephir_array_append(&createLines, _29$$17, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 393); } } } ZEPHIR_OBS_VAR(references); if (zephir_array_isset_string_fetch(&references, definition, SS("references"), 0 TSRMLS_CC)) { zephir_is_iterable(references, &_31$$18, &_30$$18, 0, 0, "phalcon/db/dialect/sqlite.zep", 418); for ( ; zephir_hash_get_current_data_ex(_31$$18, (void**) &_32$$18, &_30$$18) == SUCCESS ; zephir_hash_move_forward_ex(_31$$18, &_30$$18) ) { ZEPHIR_GET_HVALUE(reference, _32$$18); ZEPHIR_CALL_METHOD(&_33$$19, reference, "getname", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_35$$19, reference, "getcolumns", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_34$$19, this_ptr, "getcolumnlist", &_25, 54, _35$$19); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_36$$19, reference, "getreferencedtable", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_38$$19, reference, "getreferencedcolumns", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_37$$19, this_ptr, "getcolumnlist", &_25, 54, _38$$19); zephir_check_call_status(); ZEPHIR_INIT_NVAR(referenceSql); ZEPHIR_CONCAT_SVSVSSVSVS(referenceSql, "CONSTRAINT `", _33$$19, "` FOREIGN KEY (", _34$$19, ")", " REFERENCES `", _36$$19, "`(", _37$$19, ")"); ZEPHIR_CALL_METHOD(&onDelete, reference, "getondelete", NULL, 0); zephir_check_call_status(); if (!(ZEPHIR_IS_EMPTY(onDelete))) { ZEPHIR_INIT_LNVAR(_39$$20); ZEPHIR_CONCAT_SV(_39$$20, " ON DELETE ", onDelete); zephir_concat_self(&referenceSql, _39$$20 TSRMLS_CC); } ZEPHIR_CALL_METHOD(&onUpdate, reference, "getonupdate", NULL, 0); zephir_check_call_status(); if (!(ZEPHIR_IS_EMPTY(onUpdate))) { ZEPHIR_INIT_LNVAR(_40$$21); ZEPHIR_CONCAT_SV(_40$$21, " ON UPDATE ", onUpdate); zephir_concat_self(&referenceSql, _40$$21 TSRMLS_CC); } zephir_array_append(&createLines, referenceSql, PH_SEPARATE, "phalcon/db/dialect/sqlite.zep", 416); } } ZEPHIR_INIT_VAR(_41); zephir_fast_join_str(_41, SL(",\n\t"), createLines TSRMLS_CC); ZEPHIR_INIT_VAR(_42); ZEPHIR_CONCAT_VS(_42, _41, "\n)"); zephir_concat_self(&sql, _42 TSRMLS_CC); RETURN_CCTOR(sql); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_6; HashPosition _5; int ZEPHIR_LAST_CALL_STATUS; zephir_nts_static zephir_fcall_cache_entry *_4 = NULL, *_9 = NULL; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0, *_1, _2, *_3 = NULL, **_7, *_8 = NULL, *_10 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(variants); array_init_size(variants, 13); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_SINIT_VAR(_2); ZVAL_STRING(&_2, "", 0); ZEPHIR_CALL_FUNCTION(&_3, "preg_replace", &_4, _1, &_2, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _3); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_6, &_5, 0, 0); for ( ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS ; zephir_hash_move_forward_ex(_6, &_5) ) { ZEPHIR_GET_HVALUE(regex, _7); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_LNVAR(_8); ZEPHIR_CONCAT_SVS(_8, "/", regex, "/iS"); Z_SET_ISREF_P(discard); ZEPHIR_CALL_FUNCTION(&_3, "preg_match_all", &_9, _8, contents, discard); Z_UNSET_ISREF_P(discard); zephir_check_call_status(); zend_print_zval(_3, 0); php_printf("%c", '\n'); } ZEPHIR_CALL_FUNCTION(&_10, "preg_replace", &_4, vIUB, vIUBnew, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _10); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_RegexDNA, process) { int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, path_sub, variants, vIUB, vIUBnew, stuffToRemove, contents, initialLength, regex, codeLength, discard, _0, _1, _2, *_4, _5$$3, _6$$3; ZEPHIR_INIT_THIS(); ZVAL_UNDEF(&path_sub); ZVAL_UNDEF(&variants); ZVAL_UNDEF(&vIUB); ZVAL_UNDEF(&vIUBnew); ZVAL_UNDEF(&stuffToRemove); ZVAL_UNDEF(&contents); ZVAL_UNDEF(&initialLength); ZVAL_UNDEF(®ex); ZVAL_UNDEF(&codeLength); ZVAL_UNDEF(&discard); ZVAL_UNDEF(&_0); ZVAL_UNDEF(&_1); ZVAL_UNDEF(&_2); ZVAL_UNDEF(&_5$$3); ZVAL_UNDEF(&_6$$3); ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(&discard); ZVAL_NULL(&discard); ZEPHIR_INIT_VAR(&variants); zephir_create_array(&variants, 9, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_0); ZVAL_STRING(&_0, "agggtaaa|tttaccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "[cgt]gggtaaa|tttaccc[acg]"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "a[act]ggtaaa|tttacc[agt]t"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "ag[act]gtaaa|tttac[agt]ct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agg[act]taaa|ttta[agt]cct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "aggg[acg]aaa|ttt[cgt]ccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggt[cgt]aa|tt[acg]accct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggta[cgt]a|t[acg]taccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "agggtaa[cgt]|[acg]ttaccct"); zephir_array_fast_append(&variants, &_0); ZEPHIR_INIT_VAR(&vIUB); array_init(&vIUB); ZEPHIR_INIT_VAR(&vIUBnew); array_init(&vIUBnew); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/B/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/D/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/H/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/K/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/M/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/N/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|g|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/R/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/S/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/V/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|c|g)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/W/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(a|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "/Y/S"); zephir_array_append(&vIUB, &_0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, "(c|t)"); zephir_array_append(&vIUBnew, &_0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_VAR(&stuffToRemove); ZVAL_STRING(&stuffToRemove, "^>.*$|\n"); ZEPHIR_INIT_NVAR(&discard); ZVAL_NULL(&discard); ZEPHIR_INIT_VAR(&contents); zephir_file_get_contents(&contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(&initialLength); ZVAL_LONG(&initialLength, zephir_fast_strlen_ev(&contents)); ZEPHIR_INIT_VAR(&_1); ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 51, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); ZVAL_LONG(&codeLength, zephir_fast_strlen_ev(&contents)); zephir_is_iterable(&variants, 0, "test/regexdna.zep", 59); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(&variants), _4) { ZEPHIR_INIT_NVAR(®ex); ZVAL_COPY(®ex, _4); zend_print_zval(®ex, 0); php_printf("%s", " "); ZEPHIR_INIT_NVAR(&_5$$3); ZEPHIR_INIT_LNVAR(_6$$3); ZEPHIR_CONCAT_SVS(&_6$$3, "/", ®ex, "/iS"); zephir_preg_match(&_5$$3, &_6$$3, &contents, &discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(&_5$$3, 0); php_printf("%c", '\n'); } ZEND_HASH_FOREACH_END();
/** * Returns a complete resultset as an array, if the resultset has a big number of rows * it could consume more memory than currently it does. Export the resultset to an array * couldn't be faster with a large number of records */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) { HashTable *_2$$7, *_5$$8; HashPosition _1$$7, _4$$8; zephir_fcall_cache_entry *_9 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords = NULL, *columnMap = NULL, *_0$$3, **_3$$7, **_6$$8, *_7$$10 = NULL, *_8$$10 = NULL, *_10$$12 = NULL, *_11$$12 = NULL; zend_bool renameColumns; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &renameColumns_param); if (!renameColumns_param) { renameColumns = 1; } else { renameColumns = zephir_get_boolval(renameColumns_param); } ZEPHIR_OBS_VAR(records); zephir_read_property_this(&records, this_ptr, SL("_rows"), PH_NOISY_CC); if (Z_TYPE_P(records) != IS_ARRAY) { ZEPHIR_OBS_VAR(result); zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC); _0$$3 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC); if (Z_TYPE_P(_0$$3) != IS_NULL) { ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL, 0); zephir_check_call_status(); } ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL, 0); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC); zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC); } if (renameColumns) { ZEPHIR_OBS_VAR(columnMap); zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC); if (Z_TYPE_P(columnMap) != IS_ARRAY) { RETURN_CCTOR(records); } ZEPHIR_INIT_VAR(renamedRecords); array_init(renamedRecords); if (Z_TYPE_P(records) == IS_ARRAY) { zephir_is_iterable(records, &_2$$7, &_1$$7, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 218); for ( ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) ) { ZEPHIR_GET_HVALUE(record, _3$$7); ZEPHIR_INIT_NVAR(renamed); array_init(renamed); zephir_is_iterable(record, &_5$$8, &_4$$8, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 216); for ( ; zephir_hash_get_current_data_ex(_5$$8, (void**) &_6$$8, &_4$$8) == SUCCESS ; zephir_hash_move_forward_ex(_5$$8, &_4$$8) ) { ZEPHIR_GET_HMKEY(key, _5$$8, _4$$8); ZEPHIR_GET_HVALUE(value, _6$$8); ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_fetch(&renamedKey, columnMap, key, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_7$$10); object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_8$$10); ZEPHIR_CONCAT_SVS(_8$$10, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_9, 9, _8$$10); zephir_check_call_status(); zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/resultset/simple.zep", 200 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(renamedKey) == IS_ARRAY) { ZEPHIR_OBS_NVAR(renamedKey); if (!(zephir_array_isset_long_fetch(&renamedKey, renamedKey, 0, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_10$$12); object_init_ex(_10$$12, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_11$$12); ZEPHIR_CONCAT_SVS(_11$$12, "Column '", key, "' is not part of the column map"); ZEPHIR_CALL_METHOD(NULL, _10$$12, "__construct", &_9, 9, _11$$12); zephir_check_call_status(); zephir_throw_exception_debug(_10$$12, "phalcon/mvc/model/resultset/simple.zep", 206 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } zephir_array_update_zval(&renamed, renamedKey, &value, PH_COPY | PH_SEPARATE); } zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 216); } } RETURN_CCTOR(renamedRecords); } RETURN_CCTOR(records); }
/** * Insert a row in the table with the specified data and types * returns the number of affected rows */ PHP_METHOD(Lynx_DBAL_Connection, insert) { int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zval *data = NULL, *types = NULL; zval *table_param = NULL, *data_param = NULL, *types_param = NULL, *query, *stmt = NULL, *value = NULL, *set, *columnName = NULL, *fields, **_2, *_3, *_4 = NULL, *_5, *_6 = NULL, *_7, *_8, *_9; zval *table = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 1, &table_param, &data_param, &types_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); } data = data_param; if (!types_param) { ZEPHIR_INIT_VAR(types); array_init(types); } else { types = types_param; } ZEPHIR_INIT_VAR(set); array_init(set); ZEPHIR_INIT_VAR(fields); zephir_array_keys(fields, data TSRMLS_CC); zephir_is_iterable(data, &_1, &_0, 1, 0, "lynx/DBAL/Connection.zep", 70); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(columnName, _1, _0); ZEPHIR_GET_HVALUE(value, _2); if (zephir_array_isset(types, columnName)) { zephir_array_fetch(&_3, types, columnName, PH_NOISY | PH_READONLY, "lynx/DBAL/Connection.zep", 59 TSRMLS_CC); if (ZEPHIR_IS_LONG(_3, 10)) { zephir_array_append(&set, value, PH_SEPARATE, "lynx/DBAL/Connection.zep", 60); zephir_array_unset(&data, columnName, PH_SEPARATE); } else { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_SVS(_4, ":", columnName, ""); zephir_array_append(&set, _4, PH_SEPARATE, "lynx/DBAL/Connection.zep", 63); } } else { ZEPHIR_INIT_LNVAR(_4); ZEPHIR_CONCAT_SVS(_4, ":", columnName, ""); zephir_array_append(&set, _4, PH_SEPARATE, "lynx/DBAL/Connection.zep", 66); } } _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, table); zephir_check_call_status(); ZEPHIR_INIT_VAR(_7); zephir_fast_join_str(_7, SL(","), fields TSRMLS_CC); ZEPHIR_INIT_VAR(_8); zephir_fast_join_str(_8, SL(","), set TSRMLS_CC); ZEPHIR_INIT_VAR(query); ZEPHIR_CONCAT_SVSVSVS(query, "INSERT INTO ", _6, " (", _7, ") VALUES (", _8, ")"); _9 = zephir_fetch_nproperty_this(this_ptr, SL("driver"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&stmt, _9, "prepare", NULL, query); zephir_check_call_status(); ZEPHIR_RETURN_CALL_METHOD(stmt, "execute", NULL, data); zephir_check_call_status(); RETURN_MM(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) { HashTable *_5; HashPosition _4; zephir_fcall_cache_entry *_41 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns = NULL, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern = NULL, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3, **_6, *_7$$5 = NULL, *_8$$5 = NULL, *_9$$6 = NULL, *_10$$6 = NULL, *_11$$7 = NULL, *_12$$8 = NULL, *_13$$9 = NULL, *_14$$10 = NULL, *_15$$11 = NULL, *_16$$12 = NULL, *_17$$13 = NULL, *_18$$14 = NULL, *_19$$14 = NULL, *_20$$15 = NULL, *_21$$15 = NULL, *_22$$16 = NULL, *_23$$16 = NULL, *_24$$17 = NULL, *_25$$17 = NULL, *_26$$18 = NULL, *_27$$18 = NULL, *_28$$19 = NULL, *_29$$20 = NULL, *_30$$21 = NULL, *_31$$4 = NULL, *_32$$22 = NULL, *_33$$24 = NULL, *_34$$25 = NULL, *_35$$3, *_36$$3, *_37$$3, *_38$$3 = NULL, *_40$$3 = NULL, *_39$$32; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(sizePattern); ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 345); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 119 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/mysql.zep", 126)) { ZEPHIR_INIT_NVAR(_7$$5); ZVAL_LONG(_7$$5, 14); zephir_array_update_string(&definition, SL("type"), &_7$$5, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8$$5); ZVAL_LONG(_8$$5, 1); zephir_array_update_string(&definition, SL("bindType"), &_8$$5, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/mysql.zep", 136)) { ZEPHIR_INIT_NVAR(_9$$6); ZVAL_LONG(_9$$6, 0); zephir_array_update_string(&definition, SL("type"), &_9$$6, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_10$$6); ZVAL_LONG(_10$$6, 1); zephir_array_update_string(&definition, SL("bindType"), &_10$$6, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/mysql.zep", 146)) { ZEPHIR_INIT_NVAR(_11$$7); ZVAL_LONG(_11$$7, 2); zephir_array_update_string(&definition, SL("type"), &_11$$7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/mysql.zep", 154)) { ZEPHIR_INIT_NVAR(_12$$8); ZVAL_LONG(_12$$8, 4); zephir_array_update_string(&definition, SL("type"), &_12$$8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/mysql.zep", 162)) { ZEPHIR_INIT_NVAR(_13$$9); ZVAL_LONG(_13$$9, 5); zephir_array_update_string(&definition, SL("type"), &_13$$9, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/mysql.zep", 170)) { ZEPHIR_INIT_NVAR(_14$$10); ZVAL_LONG(_14$$10, 5); zephir_array_update_string(&definition, SL("type"), &_14$$10, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/mysql.zep", 178)) { ZEPHIR_INIT_NVAR(_15$$11); ZVAL_LONG(_15$$11, 1); zephir_array_update_string(&definition, SL("type"), &_15$$11, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/mysql.zep", 186)) { ZEPHIR_INIT_NVAR(_16$$12); ZVAL_LONG(_16$$12, 17); zephir_array_update_string(&definition, SL("type"), &_16$$12, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/mysql.zep", 194)) { ZEPHIR_INIT_NVAR(_17$$13); ZVAL_LONG(_17$$13, 6); zephir_array_update_string(&definition, SL("type"), &_17$$13, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/mysql.zep", 202)) { ZEPHIR_INIT_NVAR(_18$$14); ZVAL_LONG(_18$$14, 3); zephir_array_update_string(&definition, SL("type"), &_18$$14, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_19$$14); ZVAL_LONG(_19$$14, 32); zephir_array_update_string(&definition, SL("bindType"), &_19$$14, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("double"), "phalcon/db/adapter/pdo/mysql.zep", 212)) { ZEPHIR_INIT_NVAR(_20$$15); ZVAL_LONG(_20$$15, 9); zephir_array_update_string(&definition, SL("type"), &_20$$15, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_21$$15); ZVAL_LONG(_21$$15, 32); zephir_array_update_string(&definition, SL("bindType"), &_21$$15, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/mysql.zep", 222)) { ZEPHIR_INIT_NVAR(_22$$16); ZVAL_LONG(_22$$16, 7); zephir_array_update_string(&definition, SL("type"), &_22$$16, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_23$$16); ZVAL_LONG(_23$$16, 32); zephir_array_update_string(&definition, SL("bindType"), &_23$$16, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("bit"), "phalcon/db/adapter/pdo/mysql.zep", 232)) { ZEPHIR_INIT_NVAR(_24$$17); ZVAL_LONG(_24$$17, 8); zephir_array_update_string(&definition, SL("type"), &_24$$17, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_25$$17); ZVAL_LONG(_25$$17, 5); zephir_array_update_string(&definition, SL("bindType"), &_25$$17, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("tinyblob"), "phalcon/db/adapter/pdo/mysql.zep", 241)) { ZEPHIR_INIT_NVAR(_26$$18); ZVAL_LONG(_26$$18, 10); zephir_array_update_string(&definition, SL("type"), &_26$$18, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_27$$18); ZVAL_LONG(_27$$18, 5); zephir_array_update_string(&definition, SL("bindType"), &_27$$18, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("mediumblob"), "phalcon/db/adapter/pdo/mysql.zep", 250)) { ZEPHIR_INIT_NVAR(_28$$19); ZVAL_LONG(_28$$19, 12); zephir_array_update_string(&definition, SL("type"), &_28$$19, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("longblob"), "phalcon/db/adapter/pdo/mysql.zep", 258)) { ZEPHIR_INIT_NVAR(_29$$20); ZVAL_LONG(_29$$20, 13); zephir_array_update_string(&definition, SL("type"), &_29$$20, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("blob"), "phalcon/db/adapter/pdo/mysql.zep", 266)) { ZEPHIR_INIT_NVAR(_30$$21); ZVAL_LONG(_30$$21, 11); zephir_array_update_string(&definition, SL("type"), &_30$$21, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_31$$4); ZVAL_LONG(_31$$4, 2); zephir_array_update_string(&definition, SL("type"), &_31$$4, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/mysql.zep", 281)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_32$$22); zephir_preg_match(_32$$22, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_32$$22)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_33$$24); ZVAL_LONG(_33$$24, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_33$$24, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_34$$25); ZVAL_LONG(_34$$25, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_34$$25, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/mysql.zep", 296)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_35$$3, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 312 TSRMLS_CC); if (ZEPHIR_IS_STRING(_35$$3, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_36$$3, field, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 319 TSRMLS_CC); if (ZEPHIR_IS_STRING(_36$$3, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_37$$3, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 326 TSRMLS_CC); if (ZEPHIR_IS_STRING(_37$$3, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_38$$3); zephir_array_fetch_long(&_38$$3, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 333 TSRMLS_CC); if (Z_TYPE_P(_38$$3) != IS_NULL) { zephir_array_fetch_long(&_39$$32, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 334 TSRMLS_CC); zephir_array_update_string(&definition, SL("default"), &_39$$32, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 340 TSRMLS_CC); ZEPHIR_INIT_NVAR(_40$$3); object_init_ex(_40$$3, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _40$$3, "__construct", &_41, 137, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _40$$3, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 341); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Update row(s) of table and returns the number of updated rows */ PHP_METHOD(Lynx_DBAL_Connection, update) { zephir_nts_static zephir_fcall_cache_entry *_12 = NULL, *_15 = NULL; int ZEPHIR_LAST_CALL_STATUS; HashTable *_3; HashPosition _2; zval *data = NULL, *identifiers = NULL, *types = NULL; zval *table_param = NULL, *data_param = NULL, *identifiers_param = NULL, *types_param = NULL, *set, *stmt = NULL, *columnName = NULL, *_0 = NULL, *_1, **_4, *_5, *_6 = NULL, *_7 = NULL, *_8, *cnt, *_9, *_10 = NULL, *_11 = NULL, *_13, *_14; zval *table = NULL, *query = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 3, 1, &table_param, &data_param, &identifiers_param, &types_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); } data = data_param; identifiers = identifiers_param; if (!types_param) { ZEPHIR_INIT_VAR(types); array_init(types); } else { types = types_param; } ZEPHIR_INIT_VAR(set); array_init(set); ZEPHIR_INIT_VAR(_1); zephir_array_keys(_1, data TSRMLS_CC); zephir_is_iterable(_1, &_3, &_2, 0, 0, "lynx/DBAL/Connection.zep", 88); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(columnName, _4); _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, columnName); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_VS(_7, _6, " = ?"); zephir_array_append(&set, _7, PH_SEPARATE, "lynx/DBAL/Connection.zep", 85); } _5 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_6, _5, "wrap", NULL, table); zephir_check_call_status(); ZEPHIR_INIT_VAR(_8); zephir_fast_join_str(_8, SL(", "), set TSRMLS_CC); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_SVSV(_7, "UPDATE ", _6, " SET ", _8); zephir_get_strval(query, _7); ZEPHIR_INIT_VAR(cnt); ZVAL_LONG(cnt, zephir_fast_count_int(identifiers TSRMLS_CC)); if (ZEPHIR_GT_LONG(cnt, 0)) { zephir_concat_self_str(&query, " WHERE ", sizeof(" WHERE ")-1 TSRMLS_CC); if (ZEPHIR_IS_LONG(cnt, 1)) { _9 = zephir_fetch_nproperty_this(this_ptr, SL("platform"), PH_NOISY_CC); Z_SET_ISREF_P(identifiers); ZEPHIR_CALL_FUNCTION(&_11, "key", &_12, identifiers); Z_UNSET_ISREF_P(identifiers); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_10, _9, "wrap", NULL, _11); zephir_check_call_status(); ZEPHIR_INIT_VAR(_13); ZEPHIR_CONCAT_VS(_13, _10, " = ?"); zephir_concat_self(&query, _13 TSRMLS_CC); } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(zend_exception_get_default(TSRMLS_C), "It's not implemented", "lynx/DBAL/Connection.zep", 99); return; } } _5 = zephir_fetch_nproperty_this(this_ptr, SL("driver"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&stmt, _5, "prepare", NULL, query); zephir_check_call_status(); ZEPHIR_INIT_VAR(_14); ZEPHIR_CALL_FUNCTION(&_6, "array_values", &_15, data); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_10, "array_values", &_15, identifiers); zephir_check_call_status(); zephir_fast_array_merge(_14, &(_6), &(_10) TSRMLS_CC); ZEPHIR_RETURN_CALL_METHOD(stmt, "execute", NULL, _14); zephir_check_call_status(); RETURN_MM(); }
/** * Lists table indexes * * @param string table * @param string schema * @return Phalcon\Db\IndexInterface[] */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) { zephir_fcall_cache_entry *_17 = NULL; HashTable *_5, *_11, *_15; HashPosition _4, _10, _14; int ZEPHIR_LAST_CALL_STATUS; zval *table, *schema = NULL, *indexes, *index = NULL, *keyName = NULL, *indexObjects, *name = NULL, *indexColumns = NULL, *columns = NULL, *describe_index = NULL, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8, *_9 = NULL, **_12, *_13, **_16; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table, &schema); if (!schema) { schema = ZEPHIR_GLOBAL(global_null); } ZEPHIR_INIT_VAR(indexes); array_init(indexes); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describeindexes", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 323); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(index, _6); ZEPHIR_OBS_NVAR(keyName); zephir_array_fetch_long(&keyName, index, 1, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 309 TSRMLS_CC); if (!(zephir_array_isset(indexes, keyName))) { ZEPHIR_INIT_NVAR(columns); array_init(columns); } else { ZEPHIR_OBS_NVAR(columns); zephir_array_fetch(&columns, indexes, keyName, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 313 TSRMLS_CC); } _8 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_9, _8, "describeindex", NULL, 0, keyName); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_7, this_ptr, "fetchall", NULL, 0, _9, _3); zephir_check_call_status(); zephir_is_iterable(_7, &_11, &_10, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 320); for ( ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS ; zephir_hash_move_forward_ex(_11, &_10) ) { ZEPHIR_GET_HVALUE(describe_index, _12); zephir_array_fetch_long(&_13, describe_index, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 317 TSRMLS_CC); zephir_array_append(&columns, _13, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 317); } zephir_array_update_zval(&indexes, keyName, &columns, PH_COPY | PH_SEPARATE); } ZEPHIR_INIT_VAR(indexObjects); array_init(indexObjects); zephir_is_iterable(indexes, &_15, &_14, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 328); for ( ; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS ; zephir_hash_move_forward_ex(_15, &_14) ) { ZEPHIR_GET_HMKEY(name, _15, _14); ZEPHIR_GET_HVALUE(indexColumns, _16); ZEPHIR_INIT_NVAR(_3); object_init_ex(_3, phalcon_db_index_ce); ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_17, 15, name, indexColumns); zephir_check_call_status(); zephir_array_update_zval(&indexObjects, name, &_3, PH_COPY | PH_SEPARATE); } RETURN_CCTOR(indexObjects); }
/** * Extracts parameters from a string * * @param string pattern */ PHP_METHOD(Test_Router_Route, extractNamedParams) { zend_bool notValid; int tmp, cursor, cursorVar, marker, bracketCount = 0, parenthesesCount = 0, foundPattern = 0, intermediate = 0, numberMatches = 0, _1, _7, _12; char ch; zval *pattern_param = NULL, *matches, _0, _2 = zval_used_for_init, _3 = zval_used_for_init, _4 = zval_used_for_init, *_5 = NULL, *_8 = NULL, *_10 = NULL; zephir_str *pattern = NULL, *route = NULL, *item = NULL, *variable = NULL, *regexp = NULL, *_6 = NULL, *_9 = NULL, *_11 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &pattern_param); zephir_get_strval(pattern_param, &pattern); ZEPHIR_SINIT_VAR(_0); ZVAL_STRINGL(&_0, pattern->str, pattern->len, 0); if ((zephir_fast_strlen_ev(&_0) <= 0)) { RETURN_MM_BOOL(0); } ZEPHIR_INIT_VAR(matches); array_init(matches); for (_1 = 0; _1 < pattern->len; _1++) { cursor = _1; ch = pattern->str[_1]; if ((parenthesesCount == 0)) { if ((ch == '{')) { if ((bracketCount == 0)) { marker = (cursor + 1); intermediate = 0; notValid = 0; } bracketCount++; } else { if ((ch == '}')) { bracketCount--; if ((intermediate > 0)) { if ((bracketCount == 0)) { numberMatches++; zephir_str_assign(variable, "", sizeof("")-1); zephir_str_assign(regexp, "", sizeof("")-1); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRINGL(&_2, pattern->str, pattern->len, 0); ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, marker); ZEPHIR_SINIT_NVAR(_4); ZVAL_LONG(&_4, (cursor - marker)); ZEPHIR_INIT_NVAR(_5); zephir_call_func_p3(_5, "substr", &_2, &_3, &_4); zephir_get_strval(_5, &_6); zephir_str_assign(item, _6->str, _6->len); for (_7 = 0; _7 < item->len; _7++) { cursorVar = _7; ch = item->str[_7]; if ((ch == '\0')) { break; } if (((cursorVar == 0) && !(((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z'))))))) { notValid = 1; break; } if (((((((((ch >= 'a') && (ch <= 'z'))) || (((ch >= 'A') && (ch <= 'Z')))) || (((ch >= '0') && (ch <= '9')))) || (ch == '-')) || (ch == '_')) || (ch == ':'))) { if ((ch == ':')) { ZEPHIR_SINIT_NVAR(_2); ZVAL_STRINGL(&_2, item->str, item->len, 0); ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, 0); ZEPHIR_SINIT_NVAR(_4); ZVAL_LONG(&_4, cursorVar); ZEPHIR_INIT_NVAR(_8); zephir_call_func_p3(_8, "substr", &_2, &_3, &_4); zephir_get_strval(_8, &_9); zephir_str_assign(variable, _9->str, _9->len); ZEPHIR_SINIT_NVAR(_2); ZVAL_STRINGL(&_2, item->str, item->len, 0); ZEPHIR_SINIT_NVAR(_3); ZVAL_LONG(&_3, (cursorVar + 1)); ZEPHIR_INIT_NVAR(_10); zephir_call_func_p2(_10, "substr", &_2, &_3); zephir_get_strval(_10, &_11); zephir_str_assign(regexp, _11->str, _11->len); break; } } else { notValid = 1; break; } } if (!(notValid)) { tmp = numberMatches; if ((variable && variable->len) && (regexp && regexp->len)) { foundPattern = 0; for (_12 = 0; _12 < regexp->len; _12++) { ch = regexp->str[_12]; if ((ch == '\0')) { break; } if (!(foundPattern)) { if ((ch == '(')) { foundPattern = 1; } } else { if ((ch == ')')) { foundPattern = 2; break; } } } if ((foundPattern != 2)) { zephir_str_append_char(route, '('); zephir_str_append(route, regexp->str, regexp->len); zephir_str_append_char(route, ')'); } else { zephir_str_append(route, regexp->str, regexp->len); } ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, tmp); zephir_array_update_string(&matches, variable->str, variable->len, &_8, PH_COPY | PH_SEPARATE); } else { zephir_str_append(route, "([^/]*)", sizeof("([^/]*)")-1); ZEPHIR_INIT_NVAR(_10); ZVAL_LONG(_10, tmp); zephir_array_update_string(&matches, item->str, item->len, &_10, PH_COPY | PH_SEPARATE); } } else { zephir_str_append_char(route, '{'); zephir_str_append(route, item->str, item->len); zephir_str_append_char(route, '}'); } continue; } } } } } if ((bracketCount == 0)) { if ((ch == '(')) { parenthesesCount++; } else { if ((ch == ')')) { parenthesesCount--; if ((parenthesesCount == 0)) { numberMatches++; } } } } if ((bracketCount > 0)) { intermediate++; } else { zephir_str_append_char(route, ch); } } array_init(return_value); ZEPHIR_INIT_NVAR(_5); ZVAL_STRINGL(_5, route->str, route->len, 1); zephir_array_append(&return_value, _5, 0); zephir_array_append(&return_value, matches, 0); RETURN_MM(); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) { zephir_fcall_cache_entry *_16 = NULL, *_20 = NULL, *_21 = NULL; zend_bool _9; HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_10, *_11 = NULL, *_12, *_13, _14 = zval_used_for_init, *_15 = NULL, *_17, *_18, *_19 = NULL; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(sizePattern); ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 291); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 108 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("tinyint(1)"), "phalcon/db/adapter/pdo/sqlite.zep", 115)) { ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 8); zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("bindType"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(columnType); ZVAL_STRING(columnType, "boolean", 1); break; } if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/sqlite.zep", 125)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 14); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } _9 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 135); if (!(_9)) { _9 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 135); } if (_9) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 141 TSRMLS_CC); if (zephir_is_true(_10)) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } break; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/sqlite.zep", 150)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/sqlite.zep", 158)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/sqlite.zep", 166)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/sqlite.zep", 174)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 3); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/sqlite.zep", 184)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/sqlite.zep", 192)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 4); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/sqlite.zep", 200)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/sqlite.zep", 208)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 7); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 3); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/sqlite.zep", 218)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/sqlite.zep", 233)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_8); zephir_preg_match(_8, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_8)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_11, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_11); ZVAL_LONG(_11, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_11, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/sqlite.zep", 248)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 264 TSRMLS_CC); if (zephir_is_true(_10)) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_12, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 271 TSRMLS_CC); if (zephir_is_true(_12)) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_13, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); ZEPHIR_SINIT_NVAR(_14); ZVAL_STRING(&_14, "null", 0); ZEPHIR_CALL_FUNCTION(&_15, "strcasecmp", &_16, 19, _13, &_14); zephir_check_call_status(); _9 = !ZEPHIR_IS_LONG(_15, 0); if (_9) { zephir_array_fetch_long(&_17, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC); _9 = !ZEPHIR_IS_STRING(_17, ""); } if (_9) { zephir_array_fetch_long(&_18, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 280 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); ZVAL_STRING(_7, "/^'|'$/", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_INIT_NVAR(_8); ZVAL_STRING(_8, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_19, "preg_replace", &_20, 29, _7, _8, _18); zephir_check_temp_parameter(_7); zephir_check_temp_parameter(_8); zephir_check_call_status(); zephir_array_update_string(&definition, SL("default"), &_19, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 1, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 286 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_21, 140, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 287); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Returns an array of Phalcon\Db\Column objects describing a table * * <code> * print_r($connection->describeColumns("posts")); * </code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, describeColumns) { zephir_fcall_cache_entry *_15 = NULL; HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zval *table_param = NULL, *schema_param = NULL, *columns, *columnType = NULL, *field = NULL, *definition = NULL, *oldColumn = NULL, *sizePattern, *matches = NULL, *matchOne = NULL, *matchTwo = NULL, *columnName, *_0 = NULL, *_1, *_2 = NULL, *_3 = NULL, **_6, *_7 = NULL, *_8 = NULL, *_9 = NULL, *_10, *_11, *_12, *_13 = NULL, *_14; zval *table = NULL, *schema = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &table_param, &schema_param); zephir_get_strval(table, table_param); if (!schema_param) { ZEPHIR_INIT_VAR(schema); ZVAL_EMPTY_STRING(schema); } else { zephir_get_strval(schema, schema_param); } ZEPHIR_INIT_VAR(oldColumn); ZVAL_NULL(oldColumn); ZEPHIR_INIT_VAR(sizePattern); ZVAL_STRING(sizePattern, "#\\(([0-9]+)(?:,\\s*([0-9]+))*\\)#", 1); ZEPHIR_INIT_VAR(columns); array_init(columns); _1 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC); ZEPHIR_CALL_METHOD(&_2, _1, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); ZEPHIR_INIT_VAR(_3); ZVAL_LONG(_3, 3); ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, 0, _2, _3); zephir_check_call_status(); zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/mysql.zep", 329); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(field, _6); ZEPHIR_INIT_NVAR(definition); zephir_create_array(definition, 1, 0 TSRMLS_CC); add_assoc_long_ex(definition, SS("bindType"), 2); ZEPHIR_OBS_NVAR(columnType); zephir_array_fetch_long(&columnType, field, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 111 TSRMLS_CC); while (1) { if (zephir_memnstr_str(columnType, SL("bigint"), "phalcon/db/adapter/pdo/mysql.zep", 118)) { ZEPHIR_INIT_NVAR(_3); ZVAL_LONG(_3, 14); zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("bindType"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/mysql.zep", 128)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 0); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 1); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/mysql.zep", 138)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/mysql.zep", 146)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 4); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/mysql.zep", 154)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/mysql.zep", 162)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 5); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/mysql.zep", 170)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 1); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/mysql.zep", 178)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 6); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/mysql.zep", 186)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 3); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("double"), "phalcon/db/adapter/pdo/mysql.zep", 196)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 9); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/mysql.zep", 206)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 7); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); zephir_array_update_string(&definition, SL("isNumeric"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 32); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("bit"), "phalcon/db/adapter/pdo/mysql.zep", 216)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 8); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 5); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("tinyblob"), "phalcon/db/adapter/pdo/mysql.zep", 225)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 10); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_8); ZVAL_LONG(_8, 5); zephir_array_update_string(&definition, SL("bindType"), &_8, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("mediumblob"), "phalcon/db/adapter/pdo/mysql.zep", 234)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 12); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("longblob"), "phalcon/db/adapter/pdo/mysql.zep", 242)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 13); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("blob"), "phalcon/db/adapter/pdo/mysql.zep", 250)) { ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 11); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } ZEPHIR_INIT_NVAR(_7); ZVAL_LONG(_7, 2); zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE); break; } if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/mysql.zep", 265)) { ZEPHIR_INIT_NVAR(matches); ZVAL_NULL(matches); ZEPHIR_INIT_NVAR(_8); zephir_preg_match(_8, sizePattern, columnType, matches, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_8)) { ZEPHIR_OBS_NVAR(matchOne); if (zephir_array_isset_long_fetch(&matchOne, matches, 1, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_9); ZVAL_LONG(_9, zephir_get_intval(matchOne)); zephir_array_update_string(&definition, SL("size"), &_9, PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(matchTwo); if (zephir_array_isset_long_fetch(&matchTwo, matches, 2, 0 TSRMLS_CC)) { ZEPHIR_INIT_NVAR(_9); ZVAL_LONG(_9, zephir_get_intval(matchTwo)); zephir_array_update_string(&definition, SL("scale"), &_9, PH_COPY | PH_SEPARATE); } } } if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/mysql.zep", 280)) { zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } if (Z_TYPE_P(oldColumn) == IS_NULL) { zephir_array_update_string(&definition, SL("first"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } else { zephir_array_update_string(&definition, SL("after"), &oldColumn, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_10, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 296 TSRMLS_CC); if (ZEPHIR_IS_STRING(_10, "PRI")) { zephir_array_update_string(&definition, SL("primary"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_11, field, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 303 TSRMLS_CC); if (ZEPHIR_IS_STRING(_11, "NO")) { zephir_array_update_string(&definition, SL("notNull"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&_12, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 310 TSRMLS_CC); if (ZEPHIR_IS_STRING(_12, "auto_increment")) { zephir_array_update_string(&definition, SL("autoIncrement"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_OBS_NVAR(_13); zephir_array_fetch_long(&_13, field, 4, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 317 TSRMLS_CC); if (Z_TYPE_P(_13) != IS_NULL) { zephir_array_fetch_long(&_14, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 318 TSRMLS_CC); zephir_array_update_string(&definition, SL("default"), &_14, PH_COPY | PH_SEPARATE); } zephir_array_fetch_long(&columnName, field, 0, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/mysql.zep", 324 TSRMLS_CC); ZEPHIR_INIT_NVAR(_7); object_init_ex(_7, phalcon_db_column_ce); ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_15, 140, columnName, definition); zephir_check_call_status(); zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/mysql.zep", 325); ZEPHIR_CPY_WRT(oldColumn, columnName); } RETURN_CCTOR(columns); }
/** * Shows a backtrace item */ PHP_METHOD(Phalcon_Debug, showTraceItem) { zend_bool _40$$24; HashTable *_18$$14; HashPosition _17$$14; zval *_1, *_26$$16 = NULL; zephir_fcall_cache_entry *_21 = NULL, *_47 = NULL; zval *trace = NULL; zval *n_param = NULL, *trace_param = NULL, *className = NULL, *prepareInternalClass = NULL, *preparedFunctionName = NULL, *html = NULL, *classReflection = NULL, *prepareUriClass = NULL, *functionName = NULL, *functionReflection = NULL, *traceArgs = NULL, *arguments = NULL, *argument = NULL, *filez = NULL, *line = NULL, *showFiles = NULL, *lines = NULL, *numberLines = NULL, *showFileFragment = NULL, *beforeLine = NULL, *afterLine = NULL, *lastLine = NULL, *linePosition = NULL, *currentLine = NULL, *classNameWithLink = NULL, *functionNameWithLink = NULL, _0, *_16, *_2$$3, *_3$$3, _4$$3, *_11$$3, *_12$$3, _5$$4, _6$$4, *_7$$5 = NULL, *_8$$6, _9$$6, _10$$6, *_13$$10 = NULL, _14$$11, _15$$11, **_19$$14, *_23$$14, *_24$$14, *_20$$15 = NULL, *_22$$15 = NULL, *_25$$16, *_27$$16, _28$$18, _29$$18, *_30$$18, _31$$23, *_32$$23, *_33$$26 = NULL, *_34$$26 = NULL, *_35$$26 = NULL, _36$$26 = zval_used_for_init, *_37$$27 = NULL, _38$$27 = zval_used_for_init, _39$$27 = zval_used_for_init, *_41$$29 = NULL, _42$$29 = zval_used_for_init, _43$$29 = zval_used_for_init, _44$$29 = zval_used_for_init, _45$$29 = zval_used_for_init, *_46$$29 = NULL; int n, ZEPHIR_LAST_CALL_STATUS, firstLine = 0, i = 0; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &n_param, &trace_param); n = zephir_get_intval(n_param); trace = trace_param; ZEPHIR_SINIT_VAR(_0); ZVAL_LONG(&_0, n); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "<tr><td align=\"right\" valign=\"top\" class=\"error-number\">#", &_0, "</td><td>"); ZEPHIR_CPY_WRT(html, _1); ZEPHIR_OBS_VAR(className); if (zephir_array_isset_string_fetch(&className, trace, SS("class"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(_2$$3); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_SINIT_VAR(_4$$3); ZVAL_STRING(&_4$$3, "/^Phalcon/", 0); zephir_preg_match(_3$$3, &_4$$3, className, _2$$3, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_3$$3)) { ZEPHIR_SINIT_VAR(_5$$4); ZVAL_STRING(&_5$$4, "\\", 0); ZEPHIR_SINIT_VAR(_6$$4); ZVAL_STRING(&_6$$4, "/", 0); ZEPHIR_INIT_VAR(prepareUriClass); zephir_fast_str_replace(&prepareUriClass, &_5$$4, &_6$$4, className TSRMLS_CC); ZEPHIR_INIT_VAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"//api.phalconphp.com/class/", prepareUriClass, ".html\">", className, "</a>"); } else { ZEPHIR_INIT_VAR(classReflection); object_init_ex(classReflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, classReflection, "__construct", NULL, 91, className); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_7$$5, classReflection, "isinternal", NULL, 163); zephir_check_call_status(); if (zephir_is_true(_7$$5)) { ZEPHIR_INIT_VAR(_8$$6); zephir_fast_strtolower(_8$$6, className); ZEPHIR_SINIT_VAR(_9$$6); ZVAL_STRING(&_9$$6, "_", 0); ZEPHIR_SINIT_VAR(_10$$6); ZVAL_STRING(&_10$$6, "-", 0); ZEPHIR_INIT_VAR(prepareInternalClass); zephir_fast_str_replace(&prepareInternalClass, &_9$$6, &_10$$6, _8$$6 TSRMLS_CC); ZEPHIR_INIT_NVAR(classNameWithLink); ZEPHIR_CONCAT_SVSVS(classNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/class.", prepareInternalClass, ".php\">", className, "</a>"); } else { ZEPHIR_CPY_WRT(classNameWithLink, className); } } ZEPHIR_INIT_VAR(_11$$3); ZEPHIR_CONCAT_SVS(_11$$3, "<span class=\"error-class\">", classNameWithLink, "</span>"); zephir_concat_self(&html, _11$$3 TSRMLS_CC); zephir_array_fetch_string(&_12$$3, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 386 TSRMLS_CC); zephir_concat_self(&html, _12$$3 TSRMLS_CC); } ZEPHIR_OBS_VAR(functionName); zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 392 TSRMLS_CC); if (zephir_array_isset_string(trace, SS("class"))) { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } else { if ((zephir_function_exists(functionName TSRMLS_CC) == SUCCESS)) { ZEPHIR_INIT_VAR(functionReflection); object_init_ex(functionReflection, zephir_get_internal_ce(SS("reflectionfunction") TSRMLS_CC)); ZEPHIR_CALL_METHOD(NULL, functionReflection, "__construct", NULL, 82, functionName); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_13$$10, functionReflection, "isinternal", NULL, 164); zephir_check_call_status(); if (zephir_is_true(_13$$10)) { ZEPHIR_SINIT_VAR(_14$$11); ZVAL_STRING(&_14$$11, "_", 0); ZEPHIR_SINIT_VAR(_15$$11); ZVAL_STRING(&_15$$11, "-", 0); ZEPHIR_INIT_VAR(preparedFunctionName); zephir_fast_str_replace(&preparedFunctionName, &_14$$11, &_15$$11, functionName TSRMLS_CC); ZEPHIR_INIT_NVAR(functionNameWithLink); ZEPHIR_CONCAT_SVSVS(functionNameWithLink, "<a target=\"_new\" href=\"http://php.net/manual/en/function.", preparedFunctionName, ".php\">", functionName, "</a>"); } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } else { ZEPHIR_CPY_WRT(functionNameWithLink, functionName); } } ZEPHIR_INIT_VAR(_16); ZEPHIR_CONCAT_SVS(_16, "<span class=\"error-function\">", functionNameWithLink, "</span>"); zephir_concat_self(&html, _16 TSRMLS_CC); ZEPHIR_OBS_VAR(traceArgs); if (zephir_array_isset_string_fetch(&traceArgs, trace, SS("args"), 0 TSRMLS_CC)) { ZEPHIR_INIT_VAR(arguments); array_init(arguments); zephir_is_iterable(traceArgs, &_18$$14, &_17$$14, 0, 0, "phalcon/debug.zep", 441); for ( ; zend_hash_get_current_data_ex(_18$$14, (void**) &_19$$14, &_17$$14) == SUCCESS ; zend_hash_move_forward_ex(_18$$14, &_17$$14) ) { ZEPHIR_GET_HVALUE(argument, _19$$14); ZEPHIR_CALL_METHOD(&_20$$15, this_ptr, "_getvardump", &_21, 0, argument); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_22$$15); ZEPHIR_CONCAT_SVS(_22$$15, "<span class=\"error-parameter\">", _20$$15, "</span>"); zephir_array_append(&arguments, _22$$15, PH_SEPARATE, "phalcon/debug.zep", 435); } ZEPHIR_INIT_VAR(_23$$14); zephir_fast_join_str(_23$$14, SL(", "), arguments TSRMLS_CC); ZEPHIR_INIT_VAR(_24$$14); ZEPHIR_CONCAT_SVS(_24$$14, "(", _23$$14, ")"); zephir_concat_self(&html, _24$$14 TSRMLS_CC); } ZEPHIR_OBS_VAR(filez); if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) { ZEPHIR_OBS_VAR(_25$$16); zephir_array_fetch_string(&_25$$16, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 449 TSRMLS_CC); zephir_get_strval(_26$$16, _25$$16); ZEPHIR_CPY_WRT(line, _26$$16); ZEPHIR_INIT_VAR(_27$$16); ZEPHIR_CONCAT_SVSVS(_27$$16, "<br/><div class=\"error-file\">", filez, " (", line, ")</div>"); zephir_concat_self(&html, _27$$16 TSRMLS_CC); ZEPHIR_OBS_VAR(showFiles); zephir_read_property_this(&showFiles, this_ptr, SL("_showFiles"), PH_NOISY_CC); if (zephir_is_true(showFiles)) { ZEPHIR_CALL_FUNCTION(&lines, "file", NULL, 165, filez); zephir_check_call_status(); ZEPHIR_INIT_VAR(numberLines); ZVAL_LONG(numberLines, zephir_fast_count_int(lines TSRMLS_CC)); ZEPHIR_OBS_VAR(showFileFragment); zephir_read_property_this(&showFileFragment, this_ptr, SL("_showFileFragment"), PH_NOISY_CC); if (zephir_is_true(showFileFragment)) { ZEPHIR_INIT_VAR(beforeLine); ZVAL_LONG(beforeLine, (zephir_get_numberval(line) - 7)); if (ZEPHIR_LT_LONG(beforeLine, 1)) { firstLine = 1; } else { firstLine = zephir_get_numberval(beforeLine); } ZEPHIR_INIT_VAR(afterLine); ZVAL_LONG(afterLine, (zephir_get_numberval(line) + 5)); if (ZEPHIR_GT(afterLine, numberLines)) { ZEPHIR_CPY_WRT(lastLine, numberLines); } else { ZEPHIR_CPY_WRT(lastLine, afterLine); } ZEPHIR_SINIT_VAR(_28$$18); ZVAL_LONG(&_28$$18, firstLine); ZEPHIR_SINIT_VAR(_29$$18); ZVAL_LONG(&_29$$18, firstLine); ZEPHIR_INIT_VAR(_30$$18); ZEPHIR_CONCAT_SVSVSVS(_30$$18, "<pre class=\"prettyprint highlight:", &_28$$18, ":", line, " linenums:", &_29$$18, "\">"); zephir_concat_self(&html, _30$$18 TSRMLS_CC); } else { firstLine = 1; ZEPHIR_CPY_WRT(lastLine, numberLines); ZEPHIR_SINIT_VAR(_31$$23); ZVAL_LONG(&_31$$23, firstLine); ZEPHIR_INIT_VAR(_32$$23); ZEPHIR_CONCAT_SVSVS(_32$$23, "<pre class=\"prettyprint highlight:", &_31$$23, ":", line, " linenums error-scroll\">"); zephir_concat_self(&html, _32$$23 TSRMLS_CC); } i = firstLine; while (1) { if (!(ZEPHIR_GE_LONG(lastLine, i))) { break; } ZEPHIR_INIT_NVAR(linePosition); ZVAL_LONG(linePosition, (i - 1)); ZEPHIR_OBS_NVAR(currentLine); zephir_array_fetch(¤tLine, lines, linePosition, PH_NOISY, "phalcon/debug.zep", 522 TSRMLS_CC); if (zephir_is_true(showFileFragment)) { if (i == firstLine) { ZEPHIR_INIT_NVAR(_33$$26); ZEPHIR_INIT_NVAR(_34$$26); ZEPHIR_INIT_NVAR(_35$$26); zephir_fast_trim(_35$$26, currentLine, NULL , ZEPHIR_TRIM_RIGHT TSRMLS_CC); ZEPHIR_SINIT_NVAR(_36$$26); ZVAL_STRING(&_36$$26, "#\\*\\/#", 0); zephir_preg_match(_34$$26, &_36$$26, _35$$26, _33$$26, 0, 0 , 0 TSRMLS_CC); if (zephir_is_true(_34$$26)) { ZEPHIR_INIT_NVAR(_37$$27); ZEPHIR_SINIT_NVAR(_38$$27); ZVAL_STRING(&_38$$27, "* /", 0); ZEPHIR_SINIT_NVAR(_39$$27); ZVAL_STRING(&_39$$27, " ", 0); zephir_fast_str_replace(&_37$$27, &_38$$27, &_39$$27, currentLine TSRMLS_CC); ZEPHIR_CPY_WRT(currentLine, _37$$27); } } } _40$$24 = ZEPHIR_IS_STRING(currentLine, "\n"); if (!(_40$$24)) { _40$$24 = ZEPHIR_IS_STRING(currentLine, "\r\n"); } if (_40$$24) { zephir_concat_self_str(&html, SL(" \n") TSRMLS_CC); } else { ZEPHIR_INIT_NVAR(_41$$29); ZEPHIR_SINIT_NVAR(_42$$29); ZVAL_STRING(&_42$$29, "\t", 0); ZEPHIR_SINIT_NVAR(_43$$29); ZVAL_STRING(&_43$$29, " ", 0); zephir_fast_str_replace(&_41$$29, &_42$$29, &_43$$29, currentLine TSRMLS_CC); ZEPHIR_SINIT_NVAR(_44$$29); ZVAL_LONG(&_44$$29, 2); ZEPHIR_SINIT_NVAR(_45$$29); ZVAL_STRING(&_45$$29, "UTF-8", 0); ZEPHIR_CALL_FUNCTION(&_46$$29, "htmlentities", &_47, 158, _41$$29, &_44$$29, &_45$$29); zephir_check_call_status(); zephir_concat_self(&html, _46$$29 TSRMLS_CC); } i++; } zephir_concat_self_str(&html, SL("</pre>") TSRMLS_CC); } } zephir_concat_self_str(&html, SL("</td></tr>") TSRMLS_CC); RETURN_CCTOR(html); }
/** * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. * Call it when you need to restore a database connection * *<code> * //Make a connection * $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array( * 'host' => '192.168.0.11', * 'username' => 'sigma', * 'password' => 'secret', * 'dbname' => 'blog', * )); * * //Reconnect * $connection->connect(); * </code> * * @param array descriptor * @return boolean */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, connect) { int ZEPHIR_LAST_CALL_STATUS; HashTable *_1; HashPosition _0; zval *descriptor = NULL, *username = NULL, *password = NULL, *dsnParts, *dsnAttributes = NULL, *persistent, *options = NULL, *key = NULL, *value = NULL, **_2, *_3 = NULL, *_4, *_5, *_6; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 0, 1, &descriptor); if (!descriptor) { ZEPHIR_CPY_WRT(descriptor, ZEPHIR_GLOBAL(global_null)); } else { ZEPHIR_SEPARATE_PARAM(descriptor); } if (Z_TYPE_P(descriptor) == IS_NULL) { ZEPHIR_OBS_NVAR(descriptor); zephir_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC); } ZEPHIR_OBS_VAR(username); if (zephir_array_isset_string_fetch(&username, descriptor, SS("username"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("username"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(username); ZVAL_NULL(username); } ZEPHIR_OBS_VAR(password); if (zephir_array_isset_string_fetch(&password, descriptor, SS("password"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("password"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(password); ZVAL_NULL(password); } ZEPHIR_OBS_VAR(options); if (zephir_array_isset_string_fetch(&options, descriptor, SS("options"), 0 TSRMLS_CC)) { zephir_array_unset_string(&descriptor, SS("options"), PH_SEPARATE); } else { ZEPHIR_INIT_NVAR(options); array_init(options); } ZEPHIR_OBS_VAR(dsnAttributes); if (!(zephir_array_isset_string_fetch(&dsnAttributes, descriptor, SS("dsn"), 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(dsnParts); array_init(dsnParts); zephir_is_iterable(descriptor, &_1, &_0, 0, 0, "phalcon/db/adapter/pdo.zep", 130); for ( ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS ; zephir_hash_move_forward_ex(_1, &_0) ) { ZEPHIR_GET_HMKEY(key, _1, _0); ZEPHIR_GET_HVALUE(value, _2); ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VSV(_3, key, "=", value); zephir_array_append(&dsnParts, _3, PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 128); } ZEPHIR_INIT_NVAR(dsnAttributes); zephir_fast_join_str(dsnAttributes, SL(";"), dsnParts TSRMLS_CC); } ZEPHIR_INIT_VAR(_4); ZVAL_LONG(_4, 2); zephir_array_update_long(&options, 3, &_4, PH_COPY | PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 133); if (zephir_array_isset_string_fetch(&persistent, descriptor, SS("persistent"), 1 TSRMLS_CC)) { if (zephir_is_true(persistent)) { zephir_array_update_long(&options, 12, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 140); } } ZEPHIR_INIT_VAR(_5); object_init_ex(_5, php_pdo_get_dbh_ce()); _6 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC); ZEPHIR_INIT_LNVAR(_3); ZEPHIR_CONCAT_VSV(_3, _6, ":", dsnAttributes); ZEPHIR_CALL_METHOD(NULL, _5, "__construct", NULL, 0, _3, username, password, options); zephir_check_call_status(); zephir_update_property_this(this_ptr, SL("_pdo"), _5 TSRMLS_CC); ZEPHIR_MM_RESTORE(); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_27; HashPosition _26; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard, *_0, *_1, *_2, *_3, *_4, *_5, *_6, *_7, *_8, *_9, *_10, *_11, *_12, *_13, *_14, *_15, *_16, *_17, *_18, *_19, *_20, *_21, *_22, *_23, _24, *_25 = NULL, **_28, *_29 = NULL, *_30 = NULL, *_31; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(variants); array_init(variants); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_BNVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE); ZEPHIR_INIT_VAR(_1); ZVAL_STRING(_1, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _1, PH_SEPARATE); ZEPHIR_INIT_VAR(_2); ZVAL_STRING(_2, "/D/S", 1); zephir_array_append(&vIUB, _2, PH_SEPARATE); ZEPHIR_INIT_VAR(_3); ZVAL_STRING(_3, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _3, PH_SEPARATE); ZEPHIR_INIT_VAR(_4); ZVAL_STRING(_4, "/H/S", 1); zephir_array_append(&vIUB, _4, PH_SEPARATE); ZEPHIR_INIT_VAR(_5); ZVAL_STRING(_5, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _5, PH_SEPARATE); ZEPHIR_INIT_VAR(_6); ZVAL_STRING(_6, "/K/S", 1); zephir_array_append(&vIUB, _6, PH_SEPARATE); ZEPHIR_INIT_VAR(_7); ZVAL_STRING(_7, "(g|t)", 1); zephir_array_append(&vIUBnew, _7, PH_SEPARATE); ZEPHIR_INIT_VAR(_8); ZVAL_STRING(_8, "/M/S", 1); zephir_array_append(&vIUB, _8, PH_SEPARATE); ZEPHIR_INIT_VAR(_9); ZVAL_STRING(_9, "(a|c)", 1); zephir_array_append(&vIUBnew, _9, PH_SEPARATE); ZEPHIR_INIT_VAR(_10); ZVAL_STRING(_10, "/N/S", 1); zephir_array_append(&vIUB, _10, PH_SEPARATE); ZEPHIR_INIT_VAR(_11); ZVAL_STRING(_11, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _11, PH_SEPARATE); ZEPHIR_INIT_VAR(_12); ZVAL_STRING(_12, "/R/S", 1); zephir_array_append(&vIUB, _12, PH_SEPARATE); ZEPHIR_INIT_VAR(_13); ZVAL_STRING(_13, "(a|g)", 1); zephir_array_append(&vIUBnew, _13, PH_SEPARATE); ZEPHIR_INIT_VAR(_14); ZVAL_STRING(_14, "/S/S", 1); zephir_array_append(&vIUB, _14, PH_SEPARATE); ZEPHIR_INIT_VAR(_15); ZVAL_STRING(_15, "(c|g)", 1); zephir_array_append(&vIUBnew, _15, PH_SEPARATE); ZEPHIR_INIT_VAR(_16); ZVAL_STRING(_16, "/V/S", 1); zephir_array_append(&vIUB, _16, PH_SEPARATE); ZEPHIR_INIT_VAR(_17); ZVAL_STRING(_17, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _17, PH_SEPARATE); ZEPHIR_INIT_VAR(_18); ZVAL_STRING(_18, "/W/S", 1); zephir_array_append(&vIUB, _18, PH_SEPARATE); ZEPHIR_INIT_VAR(_19); ZVAL_STRING(_19, "(a|t)", 1); zephir_array_append(&vIUBnew, _19, PH_SEPARATE); ZEPHIR_INIT_VAR(_20); ZVAL_STRING(_20, "/Y/S", 1); zephir_array_append(&vIUB, _20, PH_SEPARATE); ZEPHIR_INIT_VAR(_21); ZVAL_STRING(_21, "(c|t)", 1); zephir_array_append(&vIUBnew, _21, PH_SEPARATE); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_call_func_p1(contents, "file_get_contents", path); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_22); ZEPHIR_CONCAT_SV(_22, "/", stuffToRemove); ZEPHIR_INIT_VAR(_23); ZEPHIR_CONCAT_VS(_23, _22, "/mS"); ZEPHIR_SINIT_VAR(_24); ZVAL_STRING(&_24, "", 0); ZEPHIR_INIT_VAR(_25); zephir_call_func_p3(_25, "preg_replace", _23, &_24, contents); ZEPHIR_CPY_WRT(contents, _25); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_27, &_26, 0, 0); for ( ; zend_hash_get_current_data_ex(_27, (void**) &_28, &_26) == SUCCESS ; zend_hash_move_forward_ex(_27, &_26) ) { ZEPHIR_GET_HVALUE(regex, _28); zend_print_zval(regex, 0); php_printf(" "); ZEPHIR_INIT_LNVAR(_29); ZEPHIR_CONCAT_SV(_29, "/", regex); ZEPHIR_INIT_LNVAR(_30); ZEPHIR_CONCAT_VS(_30, _29, "/iS"); Z_SET_ISREF_P(discard); ZEPHIR_INIT_NVAR(_25); zephir_call_func_p3(_25, "preg_match_all", _30, contents, discard); zend_print_zval(_25, 0); php_printf("%c", '\n'); } ZEPHIR_INIT_VAR(_31); zephir_call_func_p3(_31, "preg_replace", vIUB, vIUBnew, contents); ZEPHIR_CPY_WRT(contents, _31); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
/** * Converts bound parameters such as :name: or ?1 into PDO bind params ? * *<code> * print_r($connection->convertBoundParams('SELECT * FROM robots WHERE name = :name:', array('Bender'))); *</code> */ PHP_METHOD(Phalcon_Db_Adapter_Pdo, convertBoundParams) { HashTable *_3; HashPosition _2; int setOrder, ZEPHIR_LAST_CALL_STATUS; zval *params = NULL; zval *sql_param = NULL, *params_param = NULL, *boundSql = NULL, *placeHolders, *bindPattern, *matches, *placeMatch = NULL, *value = NULL, *_0 = NULL, *_1 = NULL, **_4, *_5, *_6; zval *sql = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 1, &sql_param, ¶ms_param); if (unlikely(Z_TYPE_P(sql_param) != IS_STRING && Z_TYPE_P(sql_param) != IS_NULL)) { zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sql' must be a string") TSRMLS_CC); RETURN_MM_NULL(); } if (likely(Z_TYPE_P(sql_param) == IS_STRING)) { zephir_get_strval(sql, sql_param); } else { ZEPHIR_INIT_VAR(sql); ZVAL_EMPTY_STRING(sql); } if (!params_param) { ZEPHIR_INIT_VAR(params); array_init(params); } else { zephir_get_arrval(params, params_param); } ZEPHIR_INIT_VAR(placeHolders); array_init(placeHolders); ZEPHIR_INIT_VAR(bindPattern); ZVAL_STRING(bindPattern, "/\\?([0-9]+)|:([a-zA-Z0-9_]+):/", 1); ZEPHIR_INIT_VAR(matches); ZVAL_NULL(matches); setOrder = 2; ZEPHIR_INIT_VAR(_0); ZVAL_LONG(_0, setOrder); Z_SET_ISREF_P(matches); ZEPHIR_CALL_FUNCTION(&_1, "preg_match_all", NULL, 81, bindPattern, sql, matches, _0); Z_UNSET_ISREF_P(matches); zephir_check_call_status(); if (zephir_is_true(_1)) { zephir_is_iterable(matches, &_3, &_2, 0, 0, "phalcon/db/adapter/pdo.zep", 427); for ( ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS ; zephir_hash_move_forward_ex(_3, &_2) ) { ZEPHIR_GET_HVALUE(placeMatch, _4); ZEPHIR_OBS_NVAR(value); zephir_array_fetch_long(&_5, placeMatch, 1, PH_READONLY, "phalcon/db/adapter/pdo.zep", 413 TSRMLS_CC); if (!(zephir_array_isset_fetch(&value, params, _5, 0 TSRMLS_CC))) { if (zephir_array_isset_long(placeMatch, 2)) { ZEPHIR_OBS_NVAR(value); zephir_array_fetch_long(&_6, placeMatch, 2, PH_READONLY, "phalcon/db/adapter/pdo.zep", 415 TSRMLS_CC); if (!(zephir_array_isset_fetch(&value, params, _6, 0 TSRMLS_CC))) { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 416); return; } } else { ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Matched parameter wasn't found in parameters list", "phalcon/db/adapter/pdo.zep", 419); return; } } zephir_array_append(&placeHolders, value, PH_SEPARATE, "phalcon/db/adapter/pdo.zep", 423); } ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "?", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&boundSql, "preg_replace", NULL, 82, bindPattern, _0, sql); zephir_check_temp_parameter(_0); zephir_check_call_status(); } else { ZEPHIR_CPY_WRT(boundSql, sql); } zephir_create_array(return_value, 2, 0 TSRMLS_CC); zephir_array_update_string(&return_value, SL("sql"), &boundSql, PH_COPY | PH_SEPARATE); zephir_array_update_string(&return_value, SL("params"), &placeHolders, PH_COPY | PH_SEPARATE); RETURN_MM(); }
/** * Resolves an annotation expression * * @param array expr * @return mixed */ PHP_METHOD(Phalcon_Annotations_Annotation, getExpression) { HashTable *_2$$7; HashPosition _1$$7; zephir_fcall_cache_entry *_5 = NULL; int ZEPHIR_LAST_CALL_STATUS; zval *expr_param = NULL, *value = NULL, *item = NULL, *resolvedItem = NULL, *arrayValue = NULL, *name = NULL, *type = NULL, *_0$$7, **_3$$7, *_4$$8, *_6$$12, *_7$$12; zval *expr = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &expr_param); expr = expr_param; ZEPHIR_OBS_VAR(type); zephir_array_fetch_string(&type, expr, SL("type"), PH_NOISY, "phalcon/annotations/annotation.zep", 96 TSRMLS_CC); do { if (ZEPHIR_IS_LONG(type, 301) || ZEPHIR_IS_LONG(type, 302) || ZEPHIR_IS_LONG(type, 303) || ZEPHIR_IS_LONG(type, 307)) { ZEPHIR_OBS_VAR(value); zephir_array_fetch_string(&value, expr, SL("value"), PH_NOISY, "phalcon/annotations/annotation.zep", 103 TSRMLS_CC); break; } if (ZEPHIR_IS_LONG(type, 304)) { ZEPHIR_INIT_NVAR(value); ZVAL_NULL(value); break; } if (ZEPHIR_IS_LONG(type, 305)) { ZEPHIR_INIT_NVAR(value); ZVAL_BOOL(value, 0); break; } if (ZEPHIR_IS_LONG(type, 306)) { ZEPHIR_INIT_NVAR(value); ZVAL_BOOL(value, 1); break; } if (ZEPHIR_IS_LONG(type, 308)) { ZEPHIR_INIT_VAR(arrayValue); array_init(arrayValue); zephir_array_fetch_string(&_0$$7, expr, SL("items"), PH_NOISY | PH_READONLY, "phalcon/annotations/annotation.zep", 120 TSRMLS_CC); zephir_is_iterable(_0$$7, &_2$$7, &_1$$7, 0, 0, "phalcon/annotations/annotation.zep", 128); for ( ; zephir_hash_get_current_data_ex(_2$$7, (void**) &_3$$7, &_1$$7) == SUCCESS ; zephir_hash_move_forward_ex(_2$$7, &_1$$7) ) { ZEPHIR_GET_HVALUE(item, _3$$7); zephir_array_fetch_string(&_4$$8, item, SL("expr"), PH_NOISY | PH_READONLY, "phalcon/annotations/annotation.zep", 121 TSRMLS_CC); ZEPHIR_CALL_METHOD(&resolvedItem, this_ptr, "getexpression", &_5, 87, _4$$8); zephir_check_call_status(); ZEPHIR_OBS_NVAR(name); if (zephir_array_isset_string_fetch(&name, item, SS("name"), 0 TSRMLS_CC)) { zephir_array_update_zval(&arrayValue, name, &resolvedItem, PH_COPY | PH_SEPARATE); } else { zephir_array_append(&arrayValue, resolvedItem, PH_SEPARATE, "phalcon/annotations/annotation.zep", 125); } } RETURN_CCTOR(arrayValue); } if (ZEPHIR_IS_LONG(type, 300)) { object_init_ex(return_value, phalcon_annotations_annotation_ce); ZEPHIR_CALL_METHOD(NULL, return_value, "__construct", NULL, 88, expr); zephir_check_call_status(); RETURN_MM(); } ZEPHIR_INIT_VAR(_6$$12); object_init_ex(_6$$12, phalcon_annotations_exception_ce); ZEPHIR_INIT_VAR(_7$$12); ZEPHIR_CONCAT_SVS(_7$$12, "The expression ", type, " is unknown"); ZEPHIR_CALL_METHOD(NULL, _6$$12, "__construct", NULL, 9, _7$$12); zephir_check_call_status(); zephir_throw_exception_debug(_6$$12, "phalcon/annotations/annotation.zep", 134 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } while(0); RETURN_CCTOR(value); }
PHP_METHOD(Test_RegexDNA, process) { HashTable *_5; HashPosition _4; int ZEPHIR_LAST_CALL_STATUS; zephir_fcall_cache_entry *_3 = NULL; zval *path, *variants, *vIUB, *vIUBnew, *stuffToRemove, *contents = NULL, *initialLength, *regex = NULL, *codeLength, *discard = NULL, *_0 = NULL, *_1, *_2 = NULL, **_6, *_7 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &path); ZEPHIR_INIT_VAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(variants); zephir_create_array(variants, 9, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "agggtaaa|tttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "[cgt]gggtaaa|tttaccc[acg]", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "a[act]ggtaaa|tttacc[agt]t", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "ag[act]gtaaa|tttac[agt]ct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agg[act]taaa|ttta[agt]cct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "aggg[acg]aaa|ttt[cgt]ccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggt[cgt]aa|tt[acg]accct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggta[cgt]a|t[acg]taccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "agggtaa[cgt]|[acg]ttaccct", 1); zephir_array_fast_append(variants, _0); ZEPHIR_INIT_VAR(vIUB); array_init(vIUB); ZEPHIR_INIT_VAR(vIUBnew); array_init(vIUBnew); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/B/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 30); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/D/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 31); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/H/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 32); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/K/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 33); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/M/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 34); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/N/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 35); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/R/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 36); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/S/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 37); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/V/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|c|g)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 38); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/W/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(a|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 39); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "/Y/S", 1); zephir_array_append(&vIUB, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "(c|t)", 1); zephir_array_append(&vIUBnew, _0, PH_SEPARATE, "test/regexdna.zep", 40); ZEPHIR_INIT_VAR(stuffToRemove); ZVAL_STRING(stuffToRemove, "^>.*$|\n", 1); ZEPHIR_INIT_NVAR(discard); ZVAL_NULL(discard); ZEPHIR_INIT_VAR(contents); zephir_file_get_contents(contents, path TSRMLS_CC); ZEPHIR_INIT_VAR(initialLength); ZVAL_LONG(initialLength, zephir_fast_strlen_ev(contents)); ZEPHIR_INIT_VAR(_1); ZEPHIR_CONCAT_SVS(_1, "/", stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, _1, _0, contents); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); ZEPHIR_INIT_VAR(codeLength); ZVAL_LONG(codeLength, zephir_fast_strlen_ev(contents)); zephir_is_iterable(variants, &_5, &_4, 0, 0, "test/regexdna.zep", 59); for ( ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS ; zephir_hash_move_forward_ex(_5, &_4) ) { ZEPHIR_GET_HVALUE(regex, _6); zend_print_zval(regex, 0); php_printf("%s", " "); ZEPHIR_INIT_NVAR(_0); ZEPHIR_INIT_LNVAR(_7); ZEPHIR_CONCAT_SVS(_7, "/", regex, "/iS"); zephir_preg_match(_0, _7, contents, discard, 1, 0 , 0 TSRMLS_CC); zend_print_zval(_0, 0); php_printf("%c", '\n'); } ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 53, vIUB, vIUBnew, contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(contents, _2); php_printf("%c", '\n'); zend_print_zval(initialLength, 0); php_printf("%c", '\n'); zend_print_zval(codeLength, 0); php_printf("%c", '\n'); php_printf("%d", zephir_fast_strlen_ev(contents)); php_printf("%c", '\n'); ZEPHIR_MM_RESTORE(); }
/** * Executes the validator */ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) { HashTable *_2$$5, *_22$$16; HashPosition _1$$5, _21$$16; zend_class_entry *_33; zephir_fcall_cache_entry *_6 = NULL, *_12 = NULL, *_31 = NULL; int ZEPHIR_LAST_CALL_STATUS, number = 0; zval *record, *field = NULL, *dependencyInjector = NULL, *metaData = NULL, *message = NULL, *bindTypes = NULL, *bindDataTypes = NULL, *columnMap = NULL, *conditions = NULL, *bindParams = NULL, *composeField = NULL, *columnField = NULL, *bindType = NULL, *primaryField = NULL, *attributeField = NULL, *params = NULL, *className = NULL, *replacePairs = NULL, *_0 = NULL, *_19 = NULL, *_32 = NULL, **_3$$5, *_4$$8 = NULL, *_5$$8 = NULL, *_7$$10 = NULL, *_8$$10 = NULL, _9$$6 = zval_used_for_init, *_10$$6 = NULL, *_11$$6 = NULL, *_13$$13, *_14$$13, *_15$$15, *_16$$15, *_17$$11, *_18$$11 = NULL, *_20$$16 = NULL, **_23$$16, *_24$$20 = NULL, *_25$$20 = NULL, *_26$$22 = NULL, *_27$$22 = NULL, _28$$19 = zval_used_for_init, *_29$$19 = NULL, *_30$$19 = NULL, *_34$$24 = NULL, *_36$$24 = NULL, *_35$$25; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 1, 0, &record); ZEPHIR_CALL_METHOD(&dependencyInjector, record, "getdi", NULL, 0); zephir_check_call_status(); ZEPHIR_INIT_VAR(_0); ZVAL_STRING(_0, "modelsMetadata", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&metaData, dependencyInjector, "getshared", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(bindTypes); array_init(bindTypes); ZEPHIR_CALL_METHOD(&bindDataTypes, metaData, "getbindtypes", NULL, 0, record); zephir_check_call_status(); if (ZEPHIR_GLOBAL(orm).column_renaming) { ZEPHIR_CALL_METHOD(&columnMap, metaData, "getreversecolumnmap", NULL, 0, record); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(columnMap); ZVAL_NULL(columnMap); } ZEPHIR_INIT_VAR(conditions); array_init(conditions); ZEPHIR_INIT_VAR(bindParams); array_init(bindParams); number = 0; ZEPHIR_INIT_NVAR(_0); ZVAL_STRING(_0, "field", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&field, this_ptr, "getoption", NULL, 0, _0); zephir_check_temp_parameter(_0); zephir_check_call_status(); if (Z_TYPE_P(field) == IS_ARRAY) { zephir_is_iterable(field, &_2$$5, &_1$$5, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 127); for ( ; zephir_hash_get_current_data_ex(_2$$5, (void**) &_3$$5, &_1$$5) == SUCCESS ; zephir_hash_move_forward_ex(_2$$5, &_1$$5) ) { ZEPHIR_GET_HVALUE(composeField, _3$$5); if (Z_TYPE_P(columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(columnField); if (!(zephir_array_isset_fetch(&columnField, columnMap, composeField, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_4$$8); object_init_ex(_4$$8, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_5$$8); ZEPHIR_CONCAT_SVS(_5$$8, "Column '", composeField, "' isn't part of the column map"); ZEPHIR_CALL_METHOD(NULL, _4$$8, "__construct", &_6, 9, _5$$8); zephir_check_call_status(); zephir_throw_exception_debug(_4$$8, "phalcon/mvc/model/validator/uniqueness.zep", 104 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_CPY_WRT(columnField, composeField); } ZEPHIR_OBS_NVAR(bindType); if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_7$$10); object_init_ex(_7$$10, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_8$$10); ZEPHIR_CONCAT_SVS(_8$$10, "Column '", columnField, "' isn't part of the table columns"); ZEPHIR_CALL_METHOD(NULL, _7$$10, "__construct", &_6, 9, _8$$10); zephir_check_call_status(); zephir_throw_exception_debug(_7$$10, "phalcon/mvc/model/validator/uniqueness.zep", 114 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_SINIT_NVAR(_9$$6); ZVAL_LONG(&_9$$6, number); ZEPHIR_INIT_LNVAR(_10$$6); ZEPHIR_CONCAT_SVSV(_10$$6, "[", composeField, "] = ?", &_9$$6); zephir_array_append(&conditions, _10$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 120); ZEPHIR_CALL_METHOD(&_11$$6, record, "readattribute", &_12, 0, composeField); zephir_check_call_status(); zephir_array_append(&bindParams, _11$$6, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 121); zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 122); number++; } } else { if (Z_TYPE_P(columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(columnField); if (!(zephir_array_isset_fetch(&columnField, columnMap, field, 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(_13$$13); object_init_ex(_13$$13, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_14$$13); ZEPHIR_CONCAT_SVS(_14$$13, "Column '", field, "' isn't part of the column map"); ZEPHIR_CALL_METHOD(NULL, _13$$13, "__construct", &_6, 9, _14$$13); zephir_check_call_status(); zephir_throw_exception_debug(_13$$13, "phalcon/mvc/model/validator/uniqueness.zep", 134 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_CPY_WRT(columnField, field); } ZEPHIR_OBS_NVAR(bindType); if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, columnField, 0 TSRMLS_CC))) { ZEPHIR_INIT_VAR(_15$$15); object_init_ex(_15$$15, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_16$$15); ZEPHIR_CONCAT_SVS(_16$$15, "Column '", columnField, "' isn't part of the table columns"); ZEPHIR_CALL_METHOD(NULL, _15$$15, "__construct", &_6, 9, _16$$15); zephir_check_call_status(); zephir_throw_exception_debug(_15$$15, "phalcon/mvc/model/validator/uniqueness.zep", 144 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(_17$$11); ZEPHIR_CONCAT_SVS(_17$$11, "[", field, "] = ?0"); zephir_array_append(&conditions, _17$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 150); ZEPHIR_CALL_METHOD(&_18$$11, record, "readattribute", NULL, 0, field); zephir_check_call_status(); zephir_array_append(&bindParams, _18$$11, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 151); zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 152); number++; } ZEPHIR_CALL_METHOD(&_19, record, "getoperationmade", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_LONG(_19, 2)) { if (ZEPHIR_GLOBAL(orm).column_renaming) { ZEPHIR_CALL_METHOD(&columnMap, metaData, "getcolumnmap", NULL, 0, record); zephir_check_call_status(); } else { ZEPHIR_INIT_NVAR(columnMap); ZVAL_NULL(columnMap); } ZEPHIR_CALL_METHOD(&_20$$16, metaData, "getprimarykeyattributes", NULL, 0, record); zephir_check_call_status(); zephir_is_iterable(_20$$16, &_22$$16, &_21$$16, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 197); for ( ; zephir_hash_get_current_data_ex(_22$$16, (void**) &_23$$16, &_21$$16) == SUCCESS ; zephir_hash_move_forward_ex(_22$$16, &_21$$16) ) { ZEPHIR_GET_HVALUE(primaryField, _23$$16); ZEPHIR_OBS_NVAR(bindType); if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, primaryField, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_24$$20); object_init_ex(_24$$20, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_25$$20); ZEPHIR_CONCAT_SVS(_25$$20, "Column '", primaryField, "' isn't part of the table columns"); ZEPHIR_CALL_METHOD(NULL, _24$$20, "__construct", &_6, 9, _25$$20); zephir_check_call_status(); zephir_throw_exception_debug(_24$$20, "phalcon/mvc/model/validator/uniqueness.zep", 174 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } if (Z_TYPE_P(columnMap) == IS_ARRAY) { ZEPHIR_OBS_NVAR(attributeField); if (!(zephir_array_isset_fetch(&attributeField, columnMap, primaryField, 0 TSRMLS_CC))) { ZEPHIR_INIT_NVAR(_26$$22); object_init_ex(_26$$22, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_LNVAR(_27$$22); ZEPHIR_CONCAT_SVS(_27$$22, "Column '", primaryField, "' isn't part of the column map"); ZEPHIR_CALL_METHOD(NULL, _26$$22, "__construct", &_6, 9, _27$$22); zephir_check_call_status(); zephir_throw_exception_debug(_26$$22, "phalcon/mvc/model/validator/uniqueness.zep", 182 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } } else { ZEPHIR_CPY_WRT(attributeField, primaryField); } ZEPHIR_SINIT_NVAR(_28$$19); ZVAL_LONG(&_28$$19, number); ZEPHIR_INIT_LNVAR(_29$$19); ZEPHIR_CONCAT_SVSV(_29$$19, "[", attributeField, "] <> ?", &_28$$19); zephir_array_append(&conditions, _29$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 191); ZEPHIR_CALL_METHOD(&_30$$19, record, "readattribute", &_31, 0, primaryField); zephir_check_call_status(); zephir_array_append(&bindParams, _30$$19, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 192); zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 193); number++; } } ZEPHIR_INIT_VAR(params); array_init(params); zephir_array_update_string(¶ms, SL("di"), &dependencyInjector, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_NVAR(_0); zephir_fast_join_str(_0, SL(" AND "), conditions TSRMLS_CC); zephir_array_update_string(¶ms, SL("conditions"), &_0, PH_COPY | PH_SEPARATE); zephir_array_update_string(¶ms, SL("bind"), &bindParams, PH_COPY | PH_SEPARATE); zephir_array_update_string(¶ms, SL("bindTypes"), &bindTypes, PH_COPY | PH_SEPARATE); ZEPHIR_INIT_VAR(className); zephir_get_class(className, record, 0 TSRMLS_CC); _33 = zephir_fetch_class(className TSRMLS_CC); ZEPHIR_CALL_CE_STATIC(&_32, _33, "count", NULL, 0, params); zephir_check_call_status(); if (!ZEPHIR_IS_LONG(_32, 0)) { ZEPHIR_INIT_VAR(_34$$24); ZVAL_STRING(_34$$24, "message", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(&message, this_ptr, "getoption", NULL, 0, _34$$24); zephir_check_temp_parameter(_34$$24); zephir_check_call_status(); ZEPHIR_INIT_VAR(replacePairs); if (Z_TYPE_P(field) == IS_ARRAY) { zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_35$$25); zephir_fast_join_str(_35$$25, SL(", "), field TSRMLS_CC); zephir_array_update_string(&replacePairs, SL(":fields"), &_35$$25, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_NVAR(message); ZVAL_STRING(message, "Value of fields: :fields are already present in another record", 1); } } else { zephir_create_array(replacePairs, 1, 0 TSRMLS_CC); zephir_array_update_string(&replacePairs, SL(":field"), &field, PH_COPY | PH_SEPARATE); if (ZEPHIR_IS_EMPTY(message)) { ZEPHIR_INIT_NVAR(message); ZVAL_STRING(message, "Value of field: ':field' is already present in another record", 1); } } ZEPHIR_CALL_FUNCTION(&_36$$24, "strtr", NULL, 26, message, replacePairs); zephir_check_call_status(); ZEPHIR_INIT_NVAR(_34$$24); ZVAL_STRING(_34$$24, "Unique", ZEPHIR_TEMP_PARAM_COPY); ZEPHIR_CALL_METHOD(NULL, this_ptr, "appendmessage", NULL, 0, _36$$24, field, _34$$24); zephir_check_temp_parameter(_34$$24); zephir_check_call_status(); RETURN_MM_BOOL(0); } RETURN_MM_BOOL(1); }
/** * The meta-data is obtained by reading the column descriptions from the database information schema */ PHP_METHOD(Phalcon_Mvc_Model_MetaData_Strategy_Introspection, getMetaData) { zend_bool _16$$9; HashTable *_8; HashPosition _7; zend_long ZEPHIR_LAST_CALL_STATUS; zval *model, *dependencyInjector, *schema = NULL, *table = NULL, *readConnection = NULL, *columns = NULL, *attributes = NULL, *primaryKeys = NULL, *nonPrimaryKeys = NULL, *completeTable = NULL, *numericTyped = NULL, *notNull = NULL, *fieldTypes = NULL, *automaticDefault = NULL, *identityField = NULL, *fieldBindTypes = NULL, *defaultValues = NULL, *column = NULL, *fieldName = NULL, *defaultValue = NULL, *emptyStringValues = NULL, *_0 = NULL, **_9, *_1$$3, *_2$$3, *_3$$3, *_4$$6, *_5$$6, *_6$$6, *_10$$9 = NULL, *_11$$9 = NULL, *_12$$9 = NULL, *_13$$9 = NULL, *_14$$9 = NULL, *_15$$9 = NULL, *_17$$9 = NULL, *_18$$15 = NULL; ZEPHIR_MM_GROW(); zephir_fetch_params(1, 2, 0, &model, &dependencyInjector); ZEPHIR_CALL_METHOD(&schema, model, "getschema", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&table, model, "getsource", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&readConnection, model, "getreadconnection", NULL, 0); zephir_check_call_status(); ZEPHIR_CALL_METHOD(&_0, readConnection, "tableexists", NULL, 0, table, schema); zephir_check_call_status(); if (!(zephir_is_true(_0))) { if (zephir_is_true(schema)) { ZEPHIR_INIT_VAR(completeTable); ZEPHIR_CONCAT_VSV(completeTable, schema, "'.'", table); } else { ZEPHIR_CPY_WRT(completeTable, table); } ZEPHIR_INIT_VAR(_1$$3); object_init_ex(_1$$3, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_2$$3); zephir_get_class(_2$$3, model, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_3$$3); ZEPHIR_CONCAT_SVSV(_3$$3, "Table '", completeTable, "' doesn't exist in database when dumping meta-data for ", _2$$3); ZEPHIR_CALL_METHOD(NULL, _1$$3, "__construct", NULL, 9, _3$$3); zephir_check_call_status(); zephir_throw_exception_debug(_1$$3, "phalcon/mvc/model/metadata/strategy/introspection.zep", 68 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_CALL_METHOD(&columns, readConnection, "describecolumns", NULL, 0, table, schema); zephir_check_call_status(); if (!(zephir_fast_count_int(columns TSRMLS_CC))) { if (zephir_is_true(schema)) { ZEPHIR_INIT_NVAR(completeTable); ZEPHIR_CONCAT_VSV(completeTable, schema, "'.'", table); } else { ZEPHIR_CPY_WRT(completeTable, table); } ZEPHIR_INIT_VAR(_4$$6); object_init_ex(_4$$6, phalcon_mvc_model_exception_ce); ZEPHIR_INIT_VAR(_5$$6); zephir_get_class(_5$$6, model, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(_6$$6); ZEPHIR_CONCAT_SVSV(_6$$6, "Cannot obtain table columns for the mapped source '", completeTable, "' used in model ", _5$$6); ZEPHIR_CALL_METHOD(NULL, _4$$6, "__construct", NULL, 9, _6$$6); zephir_check_call_status(); zephir_throw_exception_debug(_4$$6, "phalcon/mvc/model/metadata/strategy/introspection.zep", 88 TSRMLS_CC); ZEPHIR_MM_RESTORE(); return; } ZEPHIR_INIT_VAR(attributes); array_init(attributes); ZEPHIR_INIT_VAR(primaryKeys); array_init(primaryKeys); ZEPHIR_INIT_VAR(nonPrimaryKeys); array_init(nonPrimaryKeys); ZEPHIR_INIT_VAR(numericTyped); array_init(numericTyped); ZEPHIR_INIT_VAR(notNull); array_init(notNull); ZEPHIR_INIT_VAR(fieldTypes); array_init(fieldTypes); ZEPHIR_INIT_VAR(fieldBindTypes); array_init(fieldBindTypes); ZEPHIR_INIT_VAR(automaticDefault); array_init(automaticDefault); ZEPHIR_INIT_VAR(identityField); ZVAL_BOOL(identityField, 0); ZEPHIR_INIT_VAR(defaultValues); array_init(defaultValues); ZEPHIR_INIT_VAR(emptyStringValues); array_init(emptyStringValues); zephir_is_iterable(columns, &_8, &_7, 0, 0, "phalcon/mvc/model/metadata/strategy/introspection.zep", 165); for ( ; zend_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS ; zend_hash_move_forward_ex(_8, &_7) ) { ZEPHIR_GET_HVALUE(column, _9); ZEPHIR_CALL_METHOD(&fieldName, column, "getname", NULL, 0); zephir_check_call_status(); zephir_array_append(&attributes, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 109); ZEPHIR_CALL_METHOD(&_10$$9, column, "isprimary", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_10$$9)) { zephir_array_append(&primaryKeys, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 115); } else { zephir_array_append(&nonPrimaryKeys, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 117); } ZEPHIR_CALL_METHOD(&_11$$9, column, "isnumeric", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_11$$9)) { zephir_array_update_zval(&numericTyped, fieldName, &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE); } ZEPHIR_CALL_METHOD(&_12$$9, column, "isnotnull", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_12$$9)) { zephir_array_append(¬Null, fieldName, PH_SEPARATE, "phalcon/mvc/model/metadata/strategy/introspection.zep", 131); } ZEPHIR_CALL_METHOD(&_13$$9, column, "isautoincrement", NULL, 0); zephir_check_call_status(); if (ZEPHIR_IS_TRUE_IDENTICAL(_13$$9)) { ZEPHIR_CPY_WRT(identityField, fieldName); } ZEPHIR_CALL_METHOD(&_14$$9, column, "gettype", NULL, 0); zephir_check_call_status(); zephir_array_update_zval(&fieldTypes, fieldName, &_14$$9, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(&_15$$9, column, "getbindtype", NULL, 0); zephir_check_call_status(); zephir_array_update_zval(&fieldBindTypes, fieldName, &_15$$9, PH_COPY | PH_SEPARATE); ZEPHIR_CALL_METHOD(&defaultValue, column, "getdefault", NULL, 0); zephir_check_call_status(); _16$$9 = Z_TYPE_P(defaultValue) != IS_NULL; if (!(_16$$9)) { ZEPHIR_CALL_METHOD(&_17$$9, column, "isnotnull", NULL, 0); zephir_check_call_status(); _16$$9 = ZEPHIR_IS_FALSE_IDENTICAL(_17$$9); } if (_16$$9) { ZEPHIR_CALL_METHOD(&_18$$15, column, "isautoincrement", NULL, 0); zephir_check_call_status(); if (!(zephir_is_true(_18$$15))) { zephir_array_update_zval(&defaultValues, fieldName, &defaultValue, PH_COPY | PH_SEPARATE); } } } zephir_create_array(return_value, 12, 0 TSRMLS_CC); zephir_array_update_long(&return_value, 0, &attributes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 1, &primaryKeys, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 2, &nonPrimaryKeys, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 3, ¬Null, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 4, &fieldTypes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 5, &numericTyped, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 8, &identityField, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 9, &fieldBindTypes, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 10, &automaticDefault, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 11, &automaticDefault, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 12, &defaultValues, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); zephir_array_update_long(&return_value, 13, &emptyStringValues, PH_COPY ZEPHIR_DEBUG_PARAMS_DUMMY); RETURN_MM(); }