diff --git a/ext/kernel/concat.c b/ext/kernel/concat.c
index ec35f600177..10046e67586 100644
--- a/ext/kernel/concat.c
+++ b/ext/kernel/concat.c
@@ -1379,89 +1379,6 @@ void zephir_concat_vsvv(zval **result, zval *op1, const char *op2, zend_uint op2
}
-void zephir_concat_vsvvv(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, zval *op4, zval *op5, int self_var TSRMLS_DC){
-
- zval result_copy, op1_copy, op3_copy, op4_copy, op5_copy;
- int use_copy = 0, use_copy1 = 0, use_copy3 = 0, use_copy4 = 0, use_copy5 = 0;
- uint offset = 0, length;
-
- if (Z_TYPE_P(op1) != IS_STRING) {
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- if (use_copy1) {
- op1 = &op1_copy;
- }
- }
-
- if (Z_TYPE_P(op3) != IS_STRING) {
- zend_make_printable_zval(op3, &op3_copy, &use_copy3);
- if (use_copy3) {
- op3 = &op3_copy;
- }
- }
-
- if (Z_TYPE_P(op4) != IS_STRING) {
- zend_make_printable_zval(op4, &op4_copy, &use_copy4);
- if (use_copy4) {
- op4 = &op4_copy;
- }
- }
-
- if (Z_TYPE_P(op5) != IS_STRING) {
- zend_make_printable_zval(op5, &op5_copy, &use_copy5);
- if (use_copy5) {
- op5 = &op5_copy;
- }
- }
-
- length = Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3) + Z_STRLEN_P(op4) + Z_STRLEN_P(op5);
- if (self_var) {
-
- if (Z_TYPE_PP(result) != IS_STRING) {
- zend_make_printable_zval(*result, &result_copy, &use_copy);
- if (use_copy) {
- ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
- }
- }
-
- offset = Z_STRLEN_PP(result);
- length += offset;
- Z_STRVAL_PP(result) = (char *) str_erealloc(Z_STRVAL_PP(result), length + 1);
-
- } else {
- Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
- }
-
- memcpy(Z_STRVAL_PP(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1), op2, op2_len);
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + op2_len, Z_STRVAL_P(op3), Z_STRLEN_P(op3));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3), Z_STRVAL_P(op4), Z_STRLEN_P(op4));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + op2_len + Z_STRLEN_P(op3) + Z_STRLEN_P(op4), Z_STRVAL_P(op5), Z_STRLEN_P(op5));
- Z_STRVAL_PP(result)[length] = 0;
- Z_TYPE_PP(result) = IS_STRING;
- Z_STRLEN_PP(result) = length;
-
- if (use_copy1) {
- zval_dtor(op1);
- }
-
- if (use_copy3) {
- zval_dtor(op3);
- }
-
- if (use_copy4) {
- zval_dtor(op4);
- }
-
- if (use_copy5) {
- zval_dtor(op5);
- }
-
- if (use_copy) {
- zval_dtor(&result_copy);
- }
-
-}
-
void zephir_concat_vv(zval **result, zval *op1, zval *op2, int self_var TSRMLS_DC){
zval result_copy, op1_copy, op2_copy;
@@ -1720,89 +1637,6 @@ void zephir_concat_vvv(zval **result, zval *op1, zval *op2, zval *op3, int self_
}
-void zephir_concat_vvvsv(zval **result, zval *op1, zval *op2, zval *op3, const char *op4, zend_uint op4_len, zval *op5, int self_var TSRMLS_DC){
-
- zval result_copy, op1_copy, op2_copy, op3_copy, op5_copy;
- int use_copy = 0, use_copy1 = 0, use_copy2 = 0, use_copy3 = 0, use_copy5 = 0;
- uint offset = 0, length;
-
- if (Z_TYPE_P(op1) != IS_STRING) {
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- if (use_copy1) {
- op1 = &op1_copy;
- }
- }
-
- if (Z_TYPE_P(op2) != IS_STRING) {
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
- if (use_copy2) {
- op2 = &op2_copy;
- }
- }
-
- if (Z_TYPE_P(op3) != IS_STRING) {
- zend_make_printable_zval(op3, &op3_copy, &use_copy3);
- if (use_copy3) {
- op3 = &op3_copy;
- }
- }
-
- if (Z_TYPE_P(op5) != IS_STRING) {
- zend_make_printable_zval(op5, &op5_copy, &use_copy5);
- if (use_copy5) {
- op5 = &op5_copy;
- }
- }
-
- length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2) + Z_STRLEN_P(op3) + op4_len + Z_STRLEN_P(op5);
- if (self_var) {
-
- if (Z_TYPE_PP(result) != IS_STRING) {
- zend_make_printable_zval(*result, &result_copy, &use_copy);
- if (use_copy) {
- ZEPHIR_CPY_WRT_CTOR(*result, (&result_copy));
- }
- }
-
- offset = Z_STRLEN_PP(result);
- length += offset;
- Z_STRVAL_PP(result) = (char *) str_erealloc(Z_STRVAL_PP(result), length + 1);
-
- } else {
- Z_STRVAL_PP(result) = (char *) emalloc(length + 1);
- }
-
- memcpy(Z_STRVAL_PP(result) + offset, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + Z_STRLEN_P(op2), Z_STRVAL_P(op3), Z_STRLEN_P(op3));
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + Z_STRLEN_P(op2) + Z_STRLEN_P(op3), op4, op4_len);
- memcpy(Z_STRVAL_PP(result) + offset + Z_STRLEN_P(op1) + Z_STRLEN_P(op2) + Z_STRLEN_P(op3) + op4_len, Z_STRVAL_P(op5), Z_STRLEN_P(op5));
- Z_STRVAL_PP(result)[length] = 0;
- Z_TYPE_PP(result) = IS_STRING;
- Z_STRLEN_PP(result) = length;
-
- if (use_copy1) {
- zval_dtor(op1);
- }
-
- if (use_copy2) {
- zval_dtor(op2);
- }
-
- if (use_copy3) {
- zval_dtor(op3);
- }
-
- if (use_copy5) {
- zval_dtor(op5);
- }
-
- if (use_copy) {
- zval_dtor(&result_copy);
- }
-
-}
-
void zephir_concat_vvvv(zval **result, zval *op1, zval *op2, zval *op3, zval *op4, int self_var TSRMLS_DC){
zval result_copy, op1_copy, op2_copy, op3_copy, op4_copy;
diff --git a/ext/kernel/concat.h b/ext/kernel/concat.h
index c62a5fc22aa..76526475893 100644
--- a/ext/kernel/concat.h
+++ b/ext/kernel/concat.h
@@ -107,11 +107,6 @@
#define ZEPHIR_SCONCAT_VSVV(result, op1, op2, op3, op4) \
zephir_concat_vsvv(&result, op1, op2, sizeof(op2)-1, op3, op4, 1 TSRMLS_CC);
-#define ZEPHIR_CONCAT_VSVVV(result, op1, op2, op3, op4, op5) \
- zephir_concat_vsvvv(&result, op1, op2, sizeof(op2)-1, op3, op4, op5, 0 TSRMLS_CC);
-#define ZEPHIR_SCONCAT_VSVVV(result, op1, op2, op3, op4, op5) \
- zephir_concat_vsvvv(&result, op1, op2, sizeof(op2)-1, op3, op4, op5, 1 TSRMLS_CC);
-
#define ZEPHIR_CONCAT_VV(result, op1, op2) \
zephir_concat_vv(&result, op1, op2, 0 TSRMLS_CC);
#define ZEPHIR_SCONCAT_VV(result, op1, op2) \
@@ -132,11 +127,6 @@
#define ZEPHIR_SCONCAT_VVV(result, op1, op2, op3) \
zephir_concat_vvv(&result, op1, op2, op3, 1 TSRMLS_CC);
-#define ZEPHIR_CONCAT_VVVSV(result, op1, op2, op3, op4, op5) \
- zephir_concat_vvvsv(&result, op1, op2, op3, op4, sizeof(op4)-1, op5, 0 TSRMLS_CC);
-#define ZEPHIR_SCONCAT_VVVSV(result, op1, op2, op3, op4, op5) \
- zephir_concat_vvvsv(&result, op1, op2, op3, op4, sizeof(op4)-1, op5, 1 TSRMLS_CC);
-
#define ZEPHIR_CONCAT_VVVV(result, op1, op2, op3, op4) \
zephir_concat_vvvv(&result, op1, op2, op3, op4, 0 TSRMLS_CC);
#define ZEPHIR_SCONCAT_VVVV(result, op1, op2, op3, op4) \
@@ -173,12 +163,10 @@ void zephir_concat_vsvsv(zval **result, zval *op1, const char *op2, zend_uint op
void zephir_concat_vsvsvs(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, const char *op4, zend_uint op4_len, zval *op5, const char *op6, zend_uint op6_len, int self_var TSRMLS_DC);
void zephir_concat_vsvsvsv(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, const char *op4, zend_uint op4_len, zval *op5, const char *op6, zend_uint op6_len, zval *op7, int self_var TSRMLS_DC);
void zephir_concat_vsvv(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, zval *op4, int self_var TSRMLS_DC);
-void zephir_concat_vsvvv(zval **result, zval *op1, const char *op2, zend_uint op2_len, zval *op3, zval *op4, zval *op5, int self_var TSRMLS_DC);
void zephir_concat_vv(zval **result, zval *op1, zval *op2, int self_var TSRMLS_DC);
void zephir_concat_vvs(zval **result, zval *op1, zval *op2, const char *op3, zend_uint op3_len, int self_var TSRMLS_DC);
void zephir_concat_vvsv(zval **result, zval *op1, zval *op2, const char *op3, zend_uint op3_len, zval *op4, int self_var TSRMLS_DC);
void zephir_concat_vvv(zval **result, zval *op1, zval *op2, zval *op3, int self_var TSRMLS_DC);
-void zephir_concat_vvvsv(zval **result, zval *op1, zval *op2, zval *op3, const char *op4, zend_uint op4_len, zval *op5, int self_var TSRMLS_DC);
void zephir_concat_vvvv(zval **result, zval *op1, zval *op2, zval *op3, zval *op4, int self_var TSRMLS_DC);
void zephir_concat_vvvvsvv(zval **result, zval *op1, zval *op2, zval *op3, zval *op4, const char *op5, zend_uint op5_len, zval *op6, zval *op7, int self_var TSRMLS_DC);
void zephir_concat_vvvvv(zval **result, zval *op1, zval *op2, zval *op3, zval *op4, zval *op5, int self_var TSRMLS_DC);
diff --git a/ext/kernel/globals.h b/ext/kernel/globals.h
index 25dd1bac719..a15059ab5a4 100644
--- a/ext/kernel/globals.h
+++ b/ext/kernel/globals.h
@@ -164,7 +164,7 @@ typedef struct _zephir_function_cache {
#ifdef ZTS
#define zephir_nts_static
#else
-#define zephir_nts_static
+#define zephir_nts_static static
#endif
#else
#define zephir_nts_static
diff --git a/ext/kernel/object.c b/ext/kernel/object.c
index 03c97696e40..867b7607898 100644
--- a/ext/kernel/object.c
+++ b/ext/kernel/object.c
@@ -54,7 +54,7 @@ int zephir_get_class_constant(zval *return_value, zend_class_entry *ce, char *co
}
/**
- * Check if class is instance of
+ * Check if a zval is instance of a class returning its value in a zval
*/
int zephir_instance_of(zval *result, const zval *object, const zend_class_entry *ce TSRMLS_DC) {
@@ -68,6 +68,9 @@ int zephir_instance_of(zval *result, const zval *object, const zend_class_entry
return SUCCESS;
}
+/**
+ * Check if a zval is instance of a class returning an integer
+ */
int zephir_instance_of_ev(const zval *object, const zend_class_entry *ce TSRMLS_DC) {
if (Z_TYPE_P(object) != IS_OBJECT) {
@@ -101,6 +104,9 @@ int zephir_is_instance_of(zval *object, const char *class_name, unsigned int cla
return 0;
}
+/**
+ * Checks if a zval is traversable
+ */
int zephir_zval_is_traversable(zval *object TSRMLS_DC) {
zend_class_entry *ce;
@@ -1822,4 +1828,3 @@ int zephir_create_closure_ex(zval *return_value, zval *this_ptr, zend_class_entr
#endif
return SUCCESS;
}
-
diff --git a/ext/phalcon.c b/ext/phalcon.c
index 0ca662b8d53..d5143823e5e 100644
--- a/ext/phalcon.c
+++ b/ext/phalcon.c
@@ -33,6 +33,7 @@ zend_class_entry *phalcon_validation_validatorinterface_ce;
zend_class_entry *phalcon_mvc_model_validatorinterface_ce;
zend_class_entry *phalcon_cache_backendinterface_ce;
zend_class_entry *phalcon_cache_frontendinterface_ce;
+zend_class_entry *phalcon_db_dialectinterface_ce;
zend_class_entry *phalcon_dispatcherinterface_ce;
zend_class_entry *phalcon_mvc_model_metadatainterface_ce;
zend_class_entry *phalcon_annotations_adapterinterface_ce;
@@ -41,7 +42,6 @@ zend_class_entry *phalcon_logger_adapterinterface_ce;
zend_class_entry *phalcon_logger_formatterinterface_ce;
zend_class_entry *phalcon_mvc_model_resultsetinterface_ce;
zend_class_entry *phalcon_assets_filterinterface_ce;
-zend_class_entry *phalcon_db_dialectinterface_ce;
zend_class_entry *phalcon_diinterface_ce;
zend_class_entry *phalcon_mvc_viewbaseinterface_ce;
zend_class_entry *phalcon_paginator_adapterinterface_ce;
@@ -393,6 +393,7 @@ static PHP_MINIT_FUNCTION(phalcon)
ZEPHIR_INIT(Phalcon_Mvc_Model_ValidatorInterface);
ZEPHIR_INIT(Phalcon_Cache_BackendInterface);
ZEPHIR_INIT(Phalcon_Cache_FrontendInterface);
+ ZEPHIR_INIT(Phalcon_Db_DialectInterface);
ZEPHIR_INIT(Phalcon_DispatcherInterface);
ZEPHIR_INIT(Phalcon_Mvc_Model_MetaDataInterface);
ZEPHIR_INIT(Phalcon_Annotations_AdapterInterface);
@@ -401,7 +402,6 @@ static PHP_MINIT_FUNCTION(phalcon)
ZEPHIR_INIT(Phalcon_Logger_FormatterInterface);
ZEPHIR_INIT(Phalcon_Mvc_Model_ResultsetInterface);
ZEPHIR_INIT(Phalcon_Assets_FilterInterface);
- ZEPHIR_INIT(Phalcon_Db_DialectInterface);
ZEPHIR_INIT(Phalcon_DiInterface);
ZEPHIR_INIT(Phalcon_Mvc_ViewBaseInterface);
ZEPHIR_INIT(Phalcon_Paginator_AdapterInterface);
diff --git a/ext/phalcon/acl/adapter/memory.zep.c b/ext/phalcon/acl/adapter/memory.zep.c
index 10cb089318e..85b38d41a89 100644
--- a/ext/phalcon/acl/adapter/memory.zep.c
+++ b/ext/phalcon/acl/adapter/memory.zep.c
@@ -217,9 +217,11 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole) {
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) {
- zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
+ HashTable *_7;
+ HashPosition _6;
+ zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_9 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *roleName_param = NULL, *roleToInherit, *roleInheritName = NULL, *rolesNames, *_0 = NULL, *_3, *_4;
+ zval *roleName_param = NULL, *roleToInherit, *roleInheritName = NULL, *rolesNames, *deepInheritName = NULL, *_0 = NULL, *_3, *_4, *_5, **_8, *_10;
zval *roleName = NULL, *_1;
ZEPHIR_MM_GROW();
@@ -237,7 +239,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) {
ZEPHIR_CONCAT_SVS(_1, "Role '", roleName, "' does not exist in the role list");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_2, _1);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/acl/adapter/memory.zep", 193 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/acl/adapter/memory.zep", 192 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -247,14 +249,28 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addInherit) {
} else {
ZEPHIR_CPY_WRT(roleInheritName, roleToInherit);
}
+ _3 = zephir_fetch_nproperty_this(this_ptr, SL("_roleInherits"), PH_NOISY_CC);
+ if (zephir_array_isset(_3, roleInheritName)) {
+ _4 = zephir_fetch_nproperty_this(this_ptr, SL("_roleInherits"), PH_NOISY_CC);
+ zephir_array_fetch(&_5, _4, roleInheritName, PH_NOISY | PH_READONLY, "phalcon/acl/adapter/memory.zep", 205 TSRMLS_CC);
+ zephir_is_iterable(_5, &_7, &_6, 0, 0, "phalcon/acl/adapter/memory.zep", 208);
+ for (
+ ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS
+ ; zephir_hash_move_forward_ex(_7, &_6)
+ ) {
+ ZEPHIR_GET_HVALUE(deepInheritName, _8);
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "addinherit", &_9, roleName, deepInheritName);
+ zephir_check_call_status();
+ }
+ }
if (!(zephir_array_isset(rolesNames, roleInheritName))) {
ZEPHIR_INIT_NVAR(_0);
object_init_ex(_0, phalcon_acl_exception_ce);
- ZEPHIR_INIT_VAR(_3);
- ZEPHIR_CONCAT_SVS(_3, "Role '", roleInheritName, "' (to inherit) does not exist in the role list");
- ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_2, _3);
+ ZEPHIR_INIT_VAR(_10);
+ ZEPHIR_CONCAT_SVS(_10, "Role '", roleInheritName, "' (to inherit) does not exist in the role list");
+ ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_2, _10);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/acl/adapter/memory.zep", 206 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/acl/adapter/memory.zep", 214 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -390,7 +406,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addResourceAccess) {
ZEPHIR_CONCAT_SVS(_2, "Resource '", resourceName, "' does not exist in ACL");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 288 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 296 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -399,12 +415,12 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, addResourceAccess) {
_4 = Z_TYPE_P(accessList) != IS_STRING;
}
if (_4) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Invalid value for accessList", "phalcon/acl/adapter/memory.zep", 292);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_acl_exception_ce, "Invalid value for accessList", "phalcon/acl/adapter/memory.zep", 300);
return;
}
exists = 1;
if (Z_TYPE_P(accessList) == IS_ARRAY) {
- zephir_is_iterable(accessList, &_6, &_5, 0, 0, "phalcon/acl/adapter/memory.zep", 303);
+ zephir_is_iterable(accessList, &_6, &_5, 0, 0, "phalcon/acl/adapter/memory.zep", 311);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
@@ -450,7 +466,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, dropResourceAccess) {
if (Z_TYPE_P(accessList) == IS_ARRAY) {
- zephir_is_iterable(accessList, &_1, &_0, 0, 0, "phalcon/acl/adapter/memory.zep", 329);
+ zephir_is_iterable(accessList, &_1, &_0, 0, 0, "phalcon/acl/adapter/memory.zep", 337);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -504,7 +520,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, _allowOrDeny) {
ZEPHIR_CONCAT_SVS(_2, "Role '", roleName, "' does not exist in ACL");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 347 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 355 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -516,7 +532,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, _allowOrDeny) {
ZEPHIR_CONCAT_SVS(_2, "Resource '", resourceName, "' does not exist in ACL");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 351 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 359 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -527,7 +543,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, _allowOrDeny) {
ZEPHIR_OBS_VAR(internalAccess);
zephir_read_property_this(&internalAccess, this_ptr, SL("_access"), PH_NOISY_CC);
if (Z_TYPE_P(access) == IS_ARRAY) {
- zephir_is_iterable(access, &_6, &_5, 0, 0, "phalcon/acl/adapter/memory.zep", 367);
+ zephir_is_iterable(access, &_6, &_5, 0, 0, "phalcon/acl/adapter/memory.zep", 375);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
@@ -542,12 +558,12 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, _allowOrDeny) {
ZEPHIR_CONCAT_SVSVS(_8, "Access '", accessName, "' does not exist in resource '", resourceName, "'");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _8);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 363 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 371 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
}
- zephir_is_iterable(access, &_10, &_9, 0, 0, "phalcon/acl/adapter/memory.zep", 380);
+ zephir_is_iterable(access, &_10, &_9, 0, 0, "phalcon/acl/adapter/memory.zep", 388);
for (
; zephir_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS
; zephir_hash_move_forward_ex(_10, &_9)
@@ -576,7 +592,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, _allowOrDeny) {
ZEPHIR_CONCAT_SVSVS(_8, "Access '", access, "' does not exist in resource '", resourceName, "'");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _8);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 385 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/acl/adapter/memory.zep", 393 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -643,7 +659,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, allow) {
} else {
_2 = zephir_fetch_nproperty_this(this_ptr, SL("_rolesNames"), PH_NOISY_CC);
ZEPHIR_INIT_NVAR(_0);
- zephir_is_iterable(_2, &_4, &_3, 0, 0, "phalcon/acl/adapter/memory.zep", 441);
+ zephir_is_iterable(_2, &_4, &_3, 0, 0, "phalcon/acl/adapter/memory.zep", 449);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
@@ -705,7 +721,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, deny) {
} else {
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_rolesNames"), PH_NOISY_CC);
ZEPHIR_INIT_NVAR(_0);
- zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/acl/adapter/memory.zep", 474);
+ zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/acl/adapter/memory.zep", 482);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -779,7 +795,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CPY_WRT(accessKey, _3);
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 520 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 528 TSRMLS_CC);
}
if (Z_TYPE_P(haveAccess) == IS_NULL) {
ZEPHIR_OBS_VAR(roleInherits);
@@ -787,7 +803,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_OBS_VAR(inheritedRoles);
if (zephir_array_isset_fetch(&inheritedRoles, roleInherits, roleName, 0 TSRMLS_CC)) {
if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
- zephir_is_iterable(inheritedRoles, &_5, &_4, 0, 0, "phalcon/acl/adapter/memory.zep", 541);
+ zephir_is_iterable(inheritedRoles, &_5, &_4, 0, 0, "phalcon/acl/adapter/memory.zep", 549);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -797,7 +813,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CONCAT_VSVSV(accessKey, inheritedRole, "!", resourceName, "!", access);
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 538 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 546 TSRMLS_CC);
}
}
}
@@ -809,10 +825,10 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CPY_WRT(accessKey, _3);
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 556 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 564 TSRMLS_CC);
} else {
if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
- zephir_is_iterable(inheritedRoles, &_8, &_7, 0, 0, "phalcon/acl/adapter/memory.zep", 570);
+ zephir_is_iterable(inheritedRoles, &_8, &_7, 0, 0, "phalcon/acl/adapter/memory.zep", 578);
for (
; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
; zephir_hash_move_forward_ex(_8, &_7)
@@ -822,7 +838,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CONCAT_VSVS(accessKey, inheritedRole, "!", resourceName, "!*");
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 566 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 574 TSRMLS_CC);
break;
}
}
@@ -835,10 +851,10 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CPY_WRT(accessKey, _3);
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 585 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 593 TSRMLS_CC);
} else {
if (Z_TYPE_P(inheritedRoles) == IS_ARRAY) {
- zephir_is_iterable(inheritedRoles, &_11, &_10, 0, 0, "phalcon/acl/adapter/memory.zep", 599);
+ zephir_is_iterable(inheritedRoles, &_11, &_10, 0, 0, "phalcon/acl/adapter/memory.zep", 607);
for (
; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS
; zephir_hash_move_forward_ex(_11, &_10)
@@ -848,7 +864,7 @@ PHP_METHOD(Phalcon_Acl_Adapter_Memory, isAllowed) {
ZEPHIR_CONCAT_VS(accessKey, inheritedRole, "!*!*");
if (zephir_array_isset(accessList, accessKey)) {
ZEPHIR_OBS_NVAR(haveAccess);
- zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 595 TSRMLS_CC);
+ zephir_array_fetch(&haveAccess, accessList, accessKey, PH_NOISY, "phalcon/acl/adapter/memory.zep", 603 TSRMLS_CC);
break;
}
}
diff --git a/ext/phalcon/annotations/scanner.c b/ext/phalcon/annotations/scanner.c
index 496221aa8bf..b6e035d5a08 100644
--- a/ext/phalcon/annotations/scanner.c
+++ b/ext/phalcon/annotations/scanner.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.6 on Mon May 4 14:08:07 2015 */
+/* Generated by re2c 0.13.6 on Mon May 4 14:38:13 2015 */
// 1 "scanner.re"
/*
@@ -21,7 +21,7 @@
#include "php_phalcon.h"
-#include "annotations/scanner.h"
+#include "scanner.h"
#define AACTYPE unsigned char
#define AACURSOR (s->start)
diff --git a/ext/phalcon/cache/backend/redis.zep.c b/ext/phalcon/cache/backend/redis.zep.c
index da62596878e..ab7957112ec 100644
--- a/ext/phalcon/cache/backend/redis.zep.c
+++ b/ext/phalcon/cache/backend/redis.zep.c
@@ -141,10 +141,8 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, _connect) {
zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(redis);
object_init_ex(redis, zephir_get_internal_ce(SS("redis") TSRMLS_CC));
- if (zephir_has_constructor(redis TSRMLS_CC)) {
- ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL);
- zephir_check_call_status();
- }
+ ZEPHIR_CALL_METHOD(NULL, redis, "__construct", NULL);
+ zephir_check_call_status();
ZEPHIR_OBS_VAR(host);
_0 = !(zephir_array_isset_string_fetch(&host, options, SS("host"), 0 TSRMLS_CC));
if (!(_0)) {
@@ -380,7 +378,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, save) {
PHP_METHOD(Phalcon_Cache_Backend_Redis, delete) {
int ZEPHIR_LAST_CALL_STATUS;
- zval *keyName, *redis = NULL, *prefix, *prefixedKey, *lastKey, *options, *specialKey, *_0 = NULL;
+ zval *keyName, *redis = NULL, *prefix, *prefixedKey, *lastKey, *options, *specialKey;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &keyName);
@@ -411,12 +409,9 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, delete) {
zephir_array_fetch_string(&specialKey, options, SL("statsKey"), PH_NOISY, "phalcon/cache/backend/redis.zep", 296 TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, redis, "srem", NULL, specialKey, prefixedKey);
zephir_check_call_status();
- ZEPHIR_CALL_METHOD(&_0, redis, "delete", NULL, lastKey);
+ ZEPHIR_RETURN_CALL_METHOD(redis, "delete", NULL, lastKey);
zephir_check_call_status();
- if (!ZEPHIR_IS_LONG(_0, 1)) {
- RETURN_MM_BOOL(0);
- }
- RETURN_MM_BOOL(1);
+ RETURN_MM();
}
@@ -432,7 +427,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, queryKeys) {
HashTable *_1;
HashPosition _0;
int ZEPHIR_LAST_CALL_STATUS;
- zval *prefix = NULL, *redis = NULL, *options, *keys = NULL, *specialKey, *key = NULL, **_2;
+ zval *prefix = NULL, *redis = NULL, *options, *keys = NULL, *specialKey, *key = NULL, *value = NULL, **_2;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 0, 1, &prefix);
@@ -453,23 +448,24 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, queryKeys) {
ZEPHIR_OBS_VAR(options);
zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
if (!(zephir_array_isset_string(options, SS("statsKey")))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 329);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 326);
return;
}
ZEPHIR_OBS_VAR(specialKey);
- zephir_array_fetch_string(&specialKey, options, SL("statsKey"), PH_NOISY, "phalcon/cache/backend/redis.zep", 332 TSRMLS_CC);
+ zephir_array_fetch_string(&specialKey, options, SL("statsKey"), PH_NOISY, "phalcon/cache/backend/redis.zep", 329 TSRMLS_CC);
ZEPHIR_CALL_METHOD(&keys, redis, "smembers", NULL, specialKey);
zephir_check_call_status();
if (Z_TYPE_P(keys) == IS_ARRAY) {
- zephir_is_iterable(keys, &_1, &_0, 1, 0, "phalcon/cache/backend/redis.zep", 344);
+ zephir_is_iterable(keys, &_1, &_0, 1, 0, "phalcon/cache/backend/redis.zep", 341);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
) {
- ZEPHIR_GET_HVALUE(key, _2);
+ ZEPHIR_GET_HMKEY(key, _1, _0);
+ ZEPHIR_GET_HVALUE(value, _2);
_3 = zephir_is_true(prefix);
if (_3) {
- _3 = !(zephir_start_with(key, prefix, NULL));
+ _3 = !(zephir_start_with(value, prefix, NULL));
}
if (_3) {
zephir_array_unset(&keys, key, PH_SEPARATE);
@@ -654,11 +650,11 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, flush) {
ZEPHIR_OBS_VAR(options);
zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
if (!(zephir_array_isset_string(options, SS("statsKey")))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 459);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Unexpected inconsistency in options", "phalcon/cache/backend/redis.zep", 456);
return;
}
ZEPHIR_OBS_VAR(specialKey);
- zephir_array_fetch_string(&specialKey, options, SL("statsKey"), PH_NOISY, "phalcon/cache/backend/redis.zep", 462 TSRMLS_CC);
+ zephir_array_fetch_string(&specialKey, options, SL("statsKey"), PH_NOISY, "phalcon/cache/backend/redis.zep", 459 TSRMLS_CC);
ZEPHIR_OBS_VAR(redis);
zephir_read_property_this(&redis, this_ptr, SL("_redis"), PH_NOISY_CC);
if (Z_TYPE_P(redis) != IS_OBJECT) {
@@ -670,7 +666,7 @@ PHP_METHOD(Phalcon_Cache_Backend_Redis, flush) {
ZEPHIR_CALL_METHOD(&keys, redis, "smembers", NULL, specialKey);
zephir_check_call_status();
if (Z_TYPE_P(keys) == IS_ARRAY) {
- zephir_is_iterable(keys, &_1, &_0, 0, 0, "phalcon/cache/backend/redis.zep", 478);
+ zephir_is_iterable(keys, &_1, &_0, 0, 0, "phalcon/cache/backend/redis.zep", 475);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
diff --git a/ext/phalcon/config.zep.c b/ext/phalcon/config.zep.c
index 7304447f592..de3655f3955 100644
--- a/ext/phalcon/config.zep.c
+++ b/ext/phalcon/config.zep.c
@@ -297,9 +297,6 @@ PHP_METHOD(Phalcon_Config, offsetUnset) {
* $appConfig = new \Phalcon\Config(array('database' => array('host' => 'localhost')));
* $globalConfig->merge($config2);
*
- *
- * @param Config config
- * @return this merged config
*/
PHP_METHOD(Phalcon_Config, merge) {
@@ -339,7 +336,7 @@ PHP_METHOD(Phalcon_Config, toArray) {
array_init(arrayConfig);
ZEPHIR_CALL_FUNCTION(&_0, "get_object_vars", &_1, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/config.zep", 179);
+ zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/config.zep", 176);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -447,7 +444,7 @@ PHP_METHOD(Phalcon_Config, _merge) {
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&_0, "get_object_vars", &_1, config);
zephir_check_call_status();
- zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/config.zep", 238);
+ zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/config.zep", 235);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
diff --git a/ext/phalcon/db/adapter.zep.c b/ext/phalcon/db/adapter.zep.c
index fe689601a0b..7fa135b5b22 100644
--- a/ext/phalcon/db/adapter.zep.c
+++ b/ext/phalcon/db/adapter.zep.c
@@ -367,9 +367,8 @@ PHP_METHOD(Phalcon_Db_Adapter, fetchAll) {
zephir_check_call_status();
if (!(zephir_is_true(row))) {
break;
- } else {
- zephir_array_append(&results, row, PH_SEPARATE, "phalcon/db/adapter.zep", 238);
}
+ zephir_array_append(&results, row, PH_SEPARATE, "phalcon/db/adapter.zep", 239);
}
}
RETURN_CCTOR(results);
diff --git a/ext/phalcon/db/adapter/pdo/sqlite.zep.c b/ext/phalcon/db/adapter/pdo/sqlite.zep.c
index d56fee8b1e6..a50271cdeb1 100644
--- a/ext/phalcon/db/adapter/pdo/sqlite.zep.c
+++ b/ext/phalcon/db/adapter/pdo/sqlite.zep.c
@@ -77,12 +77,11 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, connect) {
ZEPHIR_OBS_NVAR(descriptor);
zephir_read_property_this(&descriptor, this_ptr, SL("_descriptor"), PH_NOISY_CC);
}
- if (!(zephir_array_isset_string(descriptor, SS("dbname")))) {
+ ZEPHIR_OBS_VAR(dbname);
+ if (!(zephir_array_isset_string_fetch(&dbname, descriptor, SS("dbname"), 0 TSRMLS_CC))) {
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "dbname must be specified", "phalcon/db/adapter/pdo/sqlite.zep", 69);
return;
}
- ZEPHIR_OBS_VAR(dbname);
- zephir_array_isset_string_fetch(&dbname, descriptor, SS("dbname"), 0 TSRMLS_CC);
zephir_array_update_string(&descriptor, SL("dsn"), &dbname, PH_COPY | PH_SEPARATE);
ZEPHIR_CALL_PARENT(NULL, phalcon_db_adapter_pdo_sqlite_ce, this_ptr, "connect", &_0, descriptor);
zephir_check_call_status();
@@ -137,7 +136,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3);
zephir_check_call_status();
- zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 286);
+ zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 284);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -147,9 +146,9 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
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", 113 TSRMLS_CC);
+ zephir_array_fetch_long(&columnType, field, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 111 TSRMLS_CC);
while (1) {
- if (zephir_memnstr_str(columnType, SL("tinyint(1)"), "phalcon/db/adapter/pdo/sqlite.zep", 120)) {
+ if (zephir_memnstr_str(columnType, SL("tinyint(1)"), "phalcon/db/adapter/pdo/sqlite.zep", 118)) {
ZEPHIR_INIT_NVAR(_3);
ZVAL_LONG(_3, 8);
zephir_array_update_string(&definition, SL("type"), &_3, PH_COPY | PH_SEPARATE);
@@ -160,9 +159,9 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
ZVAL_STRING(columnType, "boolean", 1);
break;
}
- _8 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 130);
+ _8 = zephir_memnstr_str(columnType, SL("int"), "phalcon/db/adapter/pdo/sqlite.zep", 128);
if (!(_8)) {
- _8 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 130);
+ _8 = zephir_memnstr_str(columnType, SL("INT"), "phalcon/db/adapter/pdo/sqlite.zep", 128);
}
if (_8) {
ZEPHIR_INIT_NVAR(_7);
@@ -172,31 +171,31 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
ZEPHIR_INIT_NVAR(_9);
ZVAL_LONG(_9, 1);
zephir_array_update_string(&definition, SL("bindType"), &_9, PH_COPY | PH_SEPARATE);
- zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 136 TSRMLS_CC);
+ zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 134 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", 145)) {
+ if (zephir_memnstr_str(columnType, SL("varchar"), "phalcon/db/adapter/pdo/sqlite.zep", 143)) {
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", 153)) {
+ if (zephir_memnstr_str(columnType, SL("date"), "phalcon/db/adapter/pdo/sqlite.zep", 151)) {
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", 161)) {
+ if (zephir_memnstr_str(columnType, SL("timestamp"), "phalcon/db/adapter/pdo/sqlite.zep", 159)) {
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", 169)) {
+ if (zephir_memnstr_str(columnType, SL("decimal"), "phalcon/db/adapter/pdo/sqlite.zep", 167)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 3);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
@@ -206,25 +205,25 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
zephir_array_update_string(&definition, SL("bindType"), &_9, PH_COPY | PH_SEPARATE);
break;
}
- if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/sqlite.zep", 179)) {
+ if (zephir_memnstr_str(columnType, SL("char"), "phalcon/db/adapter/pdo/sqlite.zep", 177)) {
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", 187)) {
+ if (zephir_memnstr_str(columnType, SL("datetime"), "phalcon/db/adapter/pdo/sqlite.zep", 185)) {
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", 195)) {
+ if (zephir_memnstr_str(columnType, SL("text"), "phalcon/db/adapter/pdo/sqlite.zep", 193)) {
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", 203)) {
+ if (zephir_memnstr_str(columnType, SL("float"), "phalcon/db/adapter/pdo/sqlite.zep", 201)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 7);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
@@ -234,7 +233,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
zephir_array_update_string(&definition, SL("bindType"), &_9, PH_COPY | PH_SEPARATE);
break;
}
- if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/sqlite.zep", 213)) {
+ if (zephir_memnstr_str(columnType, SL("enum"), "phalcon/db/adapter/pdo/sqlite.zep", 211)) {
ZEPHIR_INIT_NVAR(_7);
ZVAL_LONG(_7, 5);
zephir_array_update_string(&definition, SL("type"), &_7, PH_COPY | PH_SEPARATE);
@@ -245,7 +244,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
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", 228)) {
+ if (zephir_memnstr_str(columnType, SL("("), "phalcon/db/adapter/pdo/sqlite.zep", 226)) {
ZEPHIR_INIT_NVAR(matches);
ZVAL_NULL(matches);
ZEPHIR_INIT_NVAR(_9);
@@ -265,7 +264,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
}
}
}
- if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/sqlite.zep", 243)) {
+ if (zephir_memnstr_str(columnType, SL("unsigned"), "phalcon/db/adapter/pdo/sqlite.zep", 241)) {
zephir_array_update_string(&definition, SL("unsigned"), &ZEPHIR_GLOBAL(global_true), PH_COPY | PH_SEPARATE);
}
if (Z_TYPE_P(oldColumn) == IS_NULL) {
@@ -273,26 +272,26 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
} 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", 259 TSRMLS_CC);
+ zephir_array_fetch_long(&_10, field, 5, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 257 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", 266 TSRMLS_CC);
+ zephir_array_fetch_long(&_12, field, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 264 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", 274 TSRMLS_CC);
+ zephir_array_fetch_long(&_13, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 272 TSRMLS_CC);
ZEPHIR_SINIT_NVAR(_14);
ZVAL_STRING(&_14, "null", 0);
ZEPHIR_CALL_FUNCTION(&_15, "strcasecmp", &_16, _13, &_14);
zephir_check_call_status();
_8 = !ZEPHIR_IS_LONG(_15, 0);
if (_8) {
- zephir_array_fetch_long(&_17, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 274 TSRMLS_CC);
+ zephir_array_fetch_long(&_17, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 272 TSRMLS_CC);
_8 = !ZEPHIR_IS_STRING(_17, "");
}
if (_8) {
- zephir_array_fetch_long(&_18, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 275 TSRMLS_CC);
+ zephir_array_fetch_long(&_18, field, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 273 TSRMLS_CC);
ZEPHIR_INIT_NVAR(_7);
ZVAL_STRING(_7, "/^'|'$/", ZEPHIR_TEMP_PARAM_COPY);
ZEPHIR_INIT_NVAR(_9);
@@ -303,12 +302,12 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeColumns) {
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", 281 TSRMLS_CC);
+ zephir_array_fetch_long(&columnName, field, 1, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 279 TSRMLS_CC);
ZEPHIR_INIT_NVAR(_7);
object_init_ex(_7, phalcon_db_column_ce);
ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_21, columnName, definition);
zephir_check_call_status();
- zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 282);
+ zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 280);
ZEPHIR_CPY_WRT(oldColumn, columnName);
}
RETURN_CCTOR(columns);
@@ -347,20 +346,20 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) {
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3);
zephir_check_call_status();
- zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 318);
+ zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 316);
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", 304 TSRMLS_CC);
+ zephir_array_fetch_long(&keyName, index, 1, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 302 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", 308 TSRMLS_CC);
+ zephir_array_fetch(&columns, indexes, keyName, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 306 TSRMLS_CC);
}
_8 = zephir_fetch_nproperty_this(this_ptr, SL("_dialect"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(&_9, _8, "describeindex", NULL, keyName);
@@ -369,20 +368,20 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeIndexes) {
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_7, this_ptr, "fetchall", &_10, _9, _3);
zephir_check_call_status();
- zephir_is_iterable(_7, &_12, &_11, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 315);
+ zephir_is_iterable(_7, &_12, &_11, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 313);
for (
; zephir_hash_get_current_data_ex(_12, (void**) &_13, &_11) == SUCCESS
; zephir_hash_move_forward_ex(_12, &_11)
) {
ZEPHIR_GET_HVALUE(describe_index, _13);
- zephir_array_fetch_long(&_14, describe_index, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 312 TSRMLS_CC);
- zephir_array_append(&columns, _14, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 312);
+ zephir_array_fetch_long(&_14, describe_index, 2, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 310 TSRMLS_CC);
+ zephir_array_append(&columns, _14, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 310);
}
zephir_array_update_zval(&indexes, keyName, &columns, PH_COPY | PH_SEPARATE);
}
ZEPHIR_INIT_VAR(indexObjects);
array_init(indexObjects);
- zephir_is_iterable(indexes, &_16, &_15, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 323);
+ zephir_is_iterable(indexes, &_16, &_15, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 321);
for (
; zephir_hash_get_current_data_ex(_16, (void**) &_17, &_15) == SUCCESS
; zephir_hash_move_forward_ex(_16, &_15)
@@ -432,7 +431,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) {
ZVAL_LONG(_3, 3);
ZEPHIR_CALL_METHOD(&_0, this_ptr, "fetchall", NULL, _2, _3);
zephir_check_call_status();
- zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 368);
+ zephir_is_iterable(_0, &_5, &_4, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 366);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -445,29 +444,29 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) {
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", 347 TSRMLS_CC);
+ zephir_array_fetch_long(&referencedTable, reference, 2, PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 345 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", 351 TSRMLS_CC);
+ zephir_array_fetch(&_7, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 349 TSRMLS_CC);
ZEPHIR_OBS_NVAR(referencedSchema);
- zephir_array_fetch_string(&referencedSchema, _7, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 351 TSRMLS_CC);
- zephir_array_fetch(&_8, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 352 TSRMLS_CC);
+ zephir_array_fetch_string(&referencedSchema, _7, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 349 TSRMLS_CC);
+ zephir_array_fetch(&_8, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 350 TSRMLS_CC);
ZEPHIR_OBS_NVAR(referencedTable);
- zephir_array_fetch_string(&referencedTable, _8, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 352 TSRMLS_CC);
- zephir_array_fetch(&_9, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 353 TSRMLS_CC);
+ zephir_array_fetch_string(&referencedTable, _8, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 350 TSRMLS_CC);
+ zephir_array_fetch(&_9, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 351 TSRMLS_CC);
ZEPHIR_OBS_NVAR(columns);
- zephir_array_fetch_string(&columns, _9, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 353 TSRMLS_CC);
- zephir_array_fetch(&_10, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 354 TSRMLS_CC);
+ zephir_array_fetch_string(&columns, _9, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 351 TSRMLS_CC);
+ zephir_array_fetch(&_10, references, constraintName, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 352 TSRMLS_CC);
ZEPHIR_OBS_NVAR(referencedColumns);
- zephir_array_fetch_string(&referencedColumns, _10, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 354 TSRMLS_CC);
+ zephir_array_fetch_string(&referencedColumns, _10, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 352 TSRMLS_CC);
}
- zephir_array_fetch_long(&_7, reference, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 357 TSRMLS_CC);
- zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 357);
- zephir_array_fetch_long(&_8, reference, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 358 TSRMLS_CC);
- zephir_array_append(&referencedColumns, _8, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 358);
+ zephir_array_fetch_long(&_7, reference, 3, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 355 TSRMLS_CC);
+ zephir_array_append(&columns, _7, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 355);
+ zephir_array_fetch_long(&_8, reference, 4, PH_NOISY | PH_READONLY, "phalcon/db/adapter/pdo/sqlite.zep", 356 TSRMLS_CC);
+ zephir_array_append(&referencedColumns, _8, PH_SEPARATE, "phalcon/db/adapter/pdo/sqlite.zep", 356);
ZEPHIR_INIT_NVAR(_11);
zephir_create_array(_11, 4, 0 TSRMLS_CC);
zephir_array_update_string(&_11, SL("referencedSchema"), &referencedSchema, PH_COPY | PH_SEPARATE);
@@ -478,7 +477,7 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) {
}
ZEPHIR_INIT_VAR(referenceObjects);
array_init(referenceObjects);
- zephir_is_iterable(references, &_13, &_12, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 378);
+ zephir_is_iterable(references, &_13, &_12, 0, 0, "phalcon/db/adapter/pdo/sqlite.zep", 376);
for (
; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS
; zephir_hash_move_forward_ex(_13, &_12)
@@ -490,16 +489,16 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo_Sqlite, describeReferences) {
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", 371 TSRMLS_CC);
+ zephir_array_fetch_string(&_15, arrayReference, SL("referencedSchema"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 369 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", 372 TSRMLS_CC);
+ zephir_array_fetch_string(&_15, arrayReference, SL("referencedTable"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 370 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", 373 TSRMLS_CC);
+ zephir_array_fetch_string(&_15, arrayReference, SL("columns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 371 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", 375 TSRMLS_CC);
+ zephir_array_fetch_string(&_15, arrayReference, SL("referencedColumns"), PH_NOISY, "phalcon/db/adapter/pdo/sqlite.zep", 373 TSRMLS_CC);
zephir_array_update_string(&_11, SL("referencedColumns"), &_15, PH_COPY | PH_SEPARATE);
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_16, name, _11);
zephir_check_call_status();
diff --git a/ext/phalcon/db/dialect.zep.c b/ext/phalcon/db/dialect.zep.c
index 6230401b715..6362c9d814c 100644
--- a/ext/phalcon/db/dialect.zep.c
+++ b/ext/phalcon/db/dialect.zep.c
@@ -14,13 +14,13 @@
#include "kernel/main.h"
#include "kernel/operators.h"
#include "kernel/memory.h"
-#include "kernel/concat.h"
-#include "ext/spl/spl_exceptions.h"
-#include "kernel/exception.h"
#include "kernel/object.h"
+#include "kernel/string.h"
#include "kernel/hash.h"
+#include "kernel/concat.h"
#include "kernel/array.h"
-#include "kernel/string.h"
+#include "ext/spl/spl_exceptions.h"
+#include "kernel/exception.h"
#include "kernel/fcall.h"
@@ -28,7 +28,7 @@
* Phalcon\Db\Dialect
*
* This is the base class to each database dialect. This implements
- * common methods to transform intermediate code into its RDBM related syntax
+ * common methods to transform intermediate code into its RDBMS related syntax
*/
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect) {
@@ -36,26 +36,108 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect) {
zend_declare_property_null(phalcon_db_dialect_ce, SL("_escapeChar"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_class_implements(phalcon_db_dialect_ce TSRMLS_CC, 1, phalcon_db_dialectinterface_ce);
return SUCCESS;
}
+/**
+ * Escape identifiers
+ */
+PHP_METHOD(Phalcon_Db_Dialect, escape) {
+
+ HashTable *_6;
+ HashPosition _5;
+ zval *_4 = NULL;
+ zend_bool isEscape, _8, _9, _10;
+ zval *str_param = NULL, *escapeChar_param = NULL, *parts = NULL, *key = NULL, *part = NULL, *_0, *_2, *_3, **_7, *_11 = NULL;
+ zval *str = NULL, *escapeChar = NULL, *_1 = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &str_param, &escapeChar_param);
+
+ if (unlikely(Z_TYPE_P(str_param) != IS_STRING && Z_TYPE_P(str_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'str' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(str_param) == IS_STRING)) {
+ zephir_get_strval(str, str_param);
+ } else {
+ ZEPHIR_INIT_VAR(str);
+ ZVAL_EMPTY_STRING(str);
+ }
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (ZEPHIR_IS_STRING(escapeChar, "")) {
+ ZEPHIR_OBS_VAR(_0);
+ zephir_read_property_this(&_0, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
+ zephir_get_strval(_1, _0);
+ ZEPHIR_CPY_WRT(escapeChar, _1);
+ }
+ ZEPHIR_INIT_VAR(_2);
+ ZEPHIR_INIT_VAR(_3);
+ zephir_fast_trim(_3, str, escapeChar, ZEPHIR_TRIM_BOTH TSRMLS_CC);
+ zephir_fast_explode_str(_2, SL("."), _3, LONG_MAX TSRMLS_CC);
+ zephir_get_arrval(_4, _2);
+ ZEPHIR_CPY_WRT(parts, _4);
+ isEscape = ZEPHIR_GLOBAL(db).escape_identifiers;
+ zephir_is_iterable(parts, &_6, &_5, 1, 0, "phalcon/db/dialect.zep", 57);
+ for (
+ ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
+ ; zephir_hash_move_forward_ex(_6, &_5)
+ ) {
+ ZEPHIR_GET_HMKEY(key, _6, _5);
+ ZEPHIR_GET_HVALUE(part, _7);
+ _8 = ZEPHIR_IS_STRING(escapeChar, "");
+ if (!(_8)) {
+ _8 = !isEscape;
+ }
+ _9 = _8;
+ if (!(_9)) {
+ _9 = ZEPHIR_IS_STRING(part, "");
+ }
+ _10 = _9;
+ if (!(_10)) {
+ _10 = ZEPHIR_IS_STRING(part, "*");
+ }
+ if (_10) {
+ continue;
+ }
+ ZEPHIR_INIT_LNVAR(_11);
+ ZEPHIR_CONCAT_VVV(_11, escapeChar, part, escapeChar);
+ zephir_array_update_zval(&parts, key, &_11, PH_COPY | PH_SEPARATE);
+ }
+ zephir_fast_join_str(return_value, SL("."), parts TSRMLS_CC);
+ RETURN_MM();
+
+}
+
/**
* Generates the SQL for LIMIT clause
*
- *
- * $sql = $dialect->limit('SELECT * FROM robots', 10);
- * echo $sql; // SELECT * FROM robots LIMIT 10
- *
+ *
+ * $sql = $dialect->limit('SELECT * FROM robots', 10);
+ * echo $sql; // SELECT * FROM robots LIMIT 10
+ *
+ * $sql = $dialect->limit('SELECT * FROM robots', [10, 50]);
+ * echo $sql; // SELECT * FROM robots LIMIT 10 OFFSET 50
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect, limit) {
- int number;
- zval *sqlQuery_param = NULL, *number_param = NULL, _0, _1;
+ zend_bool _2;
+ zval *sqlQuery_param = NULL, *number, *_0, *_1, *_3, *_4, *_5;
zval *sqlQuery = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number_param);
+ zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number);
if (unlikely(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be a string") TSRMLS_CC);
@@ -68,18 +150,29 @@ PHP_METHOD(Phalcon_Db_Dialect, limit) {
ZEPHIR_INIT_VAR(sqlQuery);
ZVAL_EMPTY_STRING(sqlQuery);
}
- number = zephir_get_intval(number_param);
- ZEPHIR_SINIT_VAR(_0);
- ZVAL_LONG(&_0, number);
- if (zephir_is_numeric(&_0)) {
- ZEPHIR_SINIT_VAR(_1);
- ZVAL_LONG(&_1, number);
- ZEPHIR_CONCAT_VSV(return_value, sqlQuery, " LIMIT ", &_1);
+ if (Z_TYPE_P(number) == IS_ARRAY) {
+ zephir_array_fetch_long(&_0, number, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 75 TSRMLS_CC);
+ ZEPHIR_INIT_VAR(_1);
+ ZEPHIR_CONCAT_SV(_1, " LIMIT ", _0);
+ zephir_concat_self(&sqlQuery, _1 TSRMLS_CC);
+ _2 = zephir_array_isset_long(number, 1);
+ if (_2) {
+ zephir_array_fetch_long(&_3, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 77 TSRMLS_CC);
+ _2 = (zephir_fast_strlen_ev(_3)) ? 1 : 0;
+ }
+ if (_2) {
+ zephir_array_fetch_long(&_4, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 78 TSRMLS_CC);
+ ZEPHIR_INIT_VAR(_5);
+ ZEPHIR_CONCAT_SV(_5, " OFFSET ", _4);
+ zephir_concat_self(&sqlQuery, _5 TSRMLS_CC);
+ }
+ RETURN_CTOR(sqlQuery);
+ } else {
+ ZEPHIR_CONCAT_VSV(return_value, sqlQuery, " LIMIT ", number);
RETURN_MM();
}
- RETURN_CTOR(sqlQuery);
}
@@ -154,15 +247,17 @@ PHP_METHOD(Phalcon_Db_Dialect, sharedLock) {
/**
* Gets a list of columns with escaped identifiers
*
- *
- * echo $dialect->getColumnList(array('column1', 'column'));
- *
+ *
+ * echo $dialect->getColumnList(array('column1', 'column'));
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect, getColumnList) {
+ zephir_nts_static zephir_fcall_cache_entry *_4 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
HashTable *_1;
HashPosition _0;
- zval *columnList_param = NULL, *strList, *escapeChar, *column = NULL, **_2, *_3 = NULL;
+ zval *columnList_param = NULL, *columns, *column = NULL, **_2, *_3 = NULL;
zval *columnList = NULL;
ZEPHIR_MM_GROW();
@@ -172,40 +267,109 @@ PHP_METHOD(Phalcon_Db_Dialect, getColumnList) {
- ZEPHIR_INIT_VAR(strList);
- array_init(strList);
- ZEPHIR_OBS_VAR(escapeChar);
- zephir_read_property_this(&escapeChar, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
- zephir_is_iterable(columnList, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 90);
+ ZEPHIR_INIT_VAR(columns);
+ array_init(columns);
+ zephir_is_iterable(columnList, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 130);
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_INIT_LNVAR(_3);
- ZEPHIR_CONCAT_VVV(_3, escapeChar, column, escapeChar);
- zephir_array_append(&strList, _3, PH_SEPARATE, "phalcon/db/dialect.zep", 88);
+ ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlcolumn", &_4, column);
+ zephir_check_call_status();
+ zephir_array_append(&columns, _3, PH_SEPARATE, "phalcon/db/dialect.zep", 127);
}
- zephir_fast_join_str(return_value, SL(", "), strList TSRMLS_CC);
+ zephir_fast_join_str(return_value, SL(", "), columns TSRMLS_CC);
RETURN_MM();
}
+/**
+ * Resolve Column expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlColumn) {
+
+ zephir_fcall_cache_entry *_2 = NULL;
+ zend_bool _0, _1;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *column = NULL, *columnExpression = NULL, *columnAlias = NULL, *columnField, *columnDomain;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 0, &column);
+
+ ZEPHIR_SEPARATE_PARAM(column);
+
+
+ if (Z_TYPE_P(column) != IS_ARRAY) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, column);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ if (!(zephir_array_isset_string(column, SS("type")))) {
+ ZEPHIR_OBS_VAR(columnField);
+ zephir_array_fetch_long(&columnField, column, 0, PH_NOISY, "phalcon/db/dialect.zep", 149 TSRMLS_CC);
+ if (Z_TYPE_P(columnField) == IS_ARRAY) {
+ ZEPHIR_INIT_VAR(columnExpression);
+ zephir_create_array(columnExpression, 2, 0 TSRMLS_CC);
+ add_assoc_stringl_ex(columnExpression, SS("type"), SL("scalar"), 1);
+ zephir_array_update_string(&columnExpression, SL("value"), &columnField, PH_COPY | PH_SEPARATE);
+ } else if (ZEPHIR_IS_STRING(columnField, "*")) {
+ ZEPHIR_INIT_NVAR(columnExpression);
+ zephir_create_array(columnExpression, 1, 0 TSRMLS_CC);
+ add_assoc_stringl_ex(columnExpression, SS("type"), SL("all"), 1);
+ } else {
+ ZEPHIR_INIT_NVAR(columnExpression);
+ zephir_create_array(columnExpression, 2, 0 TSRMLS_CC);
+ add_assoc_stringl_ex(columnExpression, SS("type"), SL("qualified"), 1);
+ zephir_array_update_string(&columnExpression, SL("name"), &columnField, PH_COPY | PH_SEPARATE);
+ }
+ ZEPHIR_OBS_VAR(columnDomain);
+ _0 = zephir_array_isset_long_fetch(&columnDomain, column, 1, 0 TSRMLS_CC);
+ if (_0) {
+ _0 = !ZEPHIR_IS_STRING(columnDomain, "");
+ }
+ if (_0) {
+ zephir_array_update_string(&columnExpression, SL("domain"), &columnDomain, PH_COPY | PH_SEPARATE);
+ }
+ ZEPHIR_OBS_VAR(columnAlias);
+ _1 = zephir_array_isset_long_fetch(&columnAlias, column, 2, 0 TSRMLS_CC);
+ if (_1) {
+ _1 = zephir_is_true(columnAlias);
+ }
+ if (_1) {
+ zephir_array_update_string(&columnExpression, SL("sqlAlias"), &columnAlias, PH_COPY | PH_SEPARATE);
+ }
+ } else {
+ ZEPHIR_CPY_WRT(columnExpression, column);
+ }
+ ZEPHIR_CALL_METHOD(&column, this_ptr, "getsqlexpression", NULL, columnExpression);
+ zephir_check_call_status();
+ ZEPHIR_OBS_NVAR(columnAlias);
+ _0 = zephir_array_isset_string_fetch(&columnAlias, columnExpression, SS("sqlAlias"), 0 TSRMLS_CC);
+ if (!(_0)) {
+ ZEPHIR_OBS_NVAR(columnAlias);
+ _0 = zephir_array_isset_string_fetch(&columnAlias, columnExpression, SS("alias"), 0 TSRMLS_CC);
+ }
+ if (_0) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", &_2, column, columnAlias);
+ zephir_check_call_status();
+ RETURN_MM();
+ } else {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparecolumnalias", &_2, column);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+
+}
+
/**
* Transforms an intermediate representation for a expression into a database system valid expression
- *
- * @param array expression
- * @param string escapeChar
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) {
- HashTable *_8, *_13;
- HashPosition _7, _12;
- zephir_nts_static zephir_fcall_cache_entry *_3 = NULL, *_17 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_1 = NULL, *_2 = NULL, *_4 = NULL, *_5 = NULL, *_7 = NULL, *_8 = NULL, *_9 = NULL, *_10 = NULL, *_11 = NULL, *_12 = NULL, *_15 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *_1 = NULL;
- zval *expression_param = NULL, *escapeChar = NULL, *type, *domain, *operator, *left = NULL, *right = NULL, *name = NULL, *sqlItems, *escapedName = NULL, *sqlArguments, *arguments, *argument = NULL, *item = NULL, *_0, *_2, *_4, *_5, *_6 = NULL, **_9, *_10 = NULL, *_11 = NULL, **_14, *_15 = NULL, *_16;
+ zval *expression_param = NULL, *escapeChar = NULL, *type, *_3, *_6 = NULL, *_13, *_14;
zval *expression = NULL;
ZEPHIR_MM_GROW();
@@ -214,177 +378,86 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) {
expression = expression_param;
if (!escapeChar) {
- ZEPHIR_CPY_WRT(escapeChar, ZEPHIR_GLOBAL(global_null));
- } else {
- ZEPHIR_SEPARATE_PARAM(escapeChar);
+ escapeChar = ZEPHIR_GLOBAL(global_null);
}
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- if (Z_TYPE_P(escapeChar) == IS_NULL) {
- ZEPHIR_OBS_VAR(_0);
- zephir_read_property_this(&_0, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
- zephir_get_strval(_1, _0);
- ZEPHIR_CPY_WRT(escapeChar, _1);
- }
- }
ZEPHIR_OBS_VAR(type);
if (!(zephir_array_isset_string_fetch(&type, expression, SS("type"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/db/dialect.zep", 112);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/db/dialect.zep", 209);
return;
}
- if (ZEPHIR_IS_STRING(type, "qualified")) {
- ZEPHIR_OBS_VAR(name);
- zephir_array_fetch_string(&name, expression, SL("name"), PH_NOISY, "phalcon/db/dialect.zep", 120 TSRMLS_CC);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_INIT_VAR(escapedName);
- ZEPHIR_CONCAT_VVV(escapedName, escapeChar, name, escapeChar);
- } else {
- ZEPHIR_CPY_WRT(escapedName, name);
+ do {
+ if (ZEPHIR_IS_STRING(type, "scalar")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionscalar", &_0, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
}
- ZEPHIR_OBS_VAR(domain);
- if (zephir_array_isset_string_fetch(&domain, expression, SS("domain"), 0 TSRMLS_CC)) {
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VVVSV(return_value, escapeChar, domain, escapeChar, ".", escapedName);
- RETURN_MM();
- } else {
- ZEPHIR_CONCAT_VSV(return_value, domain, ".", escapedName);
- RETURN_MM();
- }
+ if (ZEPHIR_IS_STRING(type, "object")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionobject", &_1, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
}
- RETURN_CCTOR(escapedName);
- }
- if (ZEPHIR_IS_STRING(type, "literal")) {
- zephir_array_fetch_string(&_2, expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 145 TSRMLS_CC);
- RETURN_CTOR(_2);
- }
- if (ZEPHIR_IS_STRING(type, "binary-op")) {
- zephir_array_fetch_string(&_2, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 153 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_3, _2, escapeChar);
- zephir_check_call_status();
- zephir_array_fetch_string(&_4, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 154 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_3, _4, escapeChar);
- zephir_check_call_status();
- zephir_array_fetch_string(&_5, expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 156 TSRMLS_CC);
- ZEPHIR_CONCAT_VSVSV(return_value, left, " ", _5, " ", right);
- RETURN_MM();
- }
- if (ZEPHIR_IS_STRING(type, "unary-op")) {
- ZEPHIR_OBS_VAR(operator);
- zephir_array_fetch_string(&operator, expression, SL("op"), PH_NOISY, "phalcon/db/dialect.zep", 164 TSRMLS_CC);
- ZEPHIR_OBS_NVAR(left);
- if (zephir_array_isset_string_fetch(&left, expression, SS("left"), 0 TSRMLS_CC)) {
- ZEPHIR_CALL_METHOD(&_6, this_ptr, "getsqlexpression", &_3, left, escapeChar);
+ if (ZEPHIR_IS_STRING(type, "qualified")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionqualified", &_2, expression, escapeChar);
zephir_check_call_status();
- ZEPHIR_CONCAT_VV(return_value, _6, operator);
RETURN_MM();
}
- ZEPHIR_OBS_NVAR(right);
- if (zephir_array_isset_string_fetch(&right, expression, SS("right"), 0 TSRMLS_CC)) {
- ZEPHIR_CALL_METHOD(&_6, this_ptr, "getsqlexpression", &_3, right, escapeChar);
+ if (ZEPHIR_IS_STRING(type, "literal") || ZEPHIR_IS_STRING(type, "placeholder")) {
+ zephir_array_fetch_string(&_3, expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 237 TSRMLS_CC);
+ RETURN_CTOR(_3);
+ }
+ if (ZEPHIR_IS_STRING(type, "binary-op")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionbinaryoperations", &_4, expression, escapeChar);
zephir_check_call_status();
- ZEPHIR_CONCAT_VV(return_value, operator, _6);
RETURN_MM();
}
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-unary expression", "phalcon/db/dialect.zep", 180);
- return;
- }
- if (ZEPHIR_IS_STRING(type, "placeholder")) {
- zephir_array_fetch_string(&_2, expression, SL("value"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 187 TSRMLS_CC);
- RETURN_CTOR(_2);
- }
- if (ZEPHIR_IS_STRING(type, "parentheses")) {
- zephir_array_fetch_string(&_2, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 194 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&_6, this_ptr, "getsqlexpression", &_3, _2, escapeChar);
- zephir_check_call_status();
- ZEPHIR_CONCAT_SVS(return_value, "(", _6, ")");
- RETURN_MM();
- }
- if (ZEPHIR_IS_STRING(type, "functionCall")) {
- ZEPHIR_OBS_NVAR(name);
- zephir_array_fetch_string(&name, expression, SL("name"), PH_NOISY, "phalcon/db/dialect.zep", 201 TSRMLS_CC);
- ZEPHIR_INIT_VAR(sqlArguments);
- array_init(sqlArguments);
- ZEPHIR_OBS_VAR(arguments);
- if (zephir_array_isset_string_fetch(&arguments, expression, SS("arguments"), 0 TSRMLS_CC)) {
- zephir_is_iterable(arguments, &_8, &_7, 0, 0, "phalcon/db/dialect.zep", 207);
- for (
- ; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
- ; zephir_hash_move_forward_ex(_8, &_7)
- ) {
- ZEPHIR_GET_HVALUE(argument, _9);
- ZEPHIR_CALL_METHOD(&_10, this_ptr, "getsqlexpression", &_3, argument, escapeChar);
- zephir_check_call_status();
- zephir_array_append(&sqlArguments, _10, PH_SEPARATE, "phalcon/db/dialect.zep", 205);
- }
- if (zephir_array_isset_string(expression, SS("distinct"))) {
- ZEPHIR_INIT_VAR(_11);
- zephir_fast_join_str(_11, SL(", "), sqlArguments TSRMLS_CC);
- ZEPHIR_CONCAT_VSVS(return_value, name, "(DISTINCT ", _11, ")");
- RETURN_MM();
- } else {
- ZEPHIR_INIT_NVAR(_11);
- zephir_fast_join_str(_11, SL(", "), sqlArguments TSRMLS_CC);
- ZEPHIR_CONCAT_VSVS(return_value, name, "(", _11, ")");
- RETURN_MM();
- }
- ZEPHIR_INIT_NVAR(_11);
- zephir_fast_join_str(_11, SL(", "), sqlArguments TSRMLS_CC);
- ZEPHIR_CONCAT_VSVS(return_value, name, "(", _11, ")");
+ if (ZEPHIR_IS_STRING(type, "unary-op")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionunaryoperations", &_5, expression, escapeChar);
+ zephir_check_call_status();
RETURN_MM();
}
- ZEPHIR_CONCAT_VS(return_value, name, "()");
- RETURN_MM();
- }
- if (ZEPHIR_IS_STRING(type, "list")) {
- ZEPHIR_INIT_VAR(sqlItems);
- array_init(sqlItems);
- zephir_array_fetch_long(&_2, expression, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 222 TSRMLS_CC);
- zephir_is_iterable(_2, &_13, &_12, 0, 0, "phalcon/db/dialect.zep", 225);
- for (
- ; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS
- ; zephir_hash_move_forward_ex(_13, &_12)
- ) {
- ZEPHIR_GET_HVALUE(item, _14);
- ZEPHIR_CALL_METHOD(&_6, this_ptr, "getsqlexpression", &_3, item, escapeChar);
+ if (ZEPHIR_IS_STRING(type, "parentheses")) {
+ zephir_array_fetch_string(&_3, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 255 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&_6, this_ptr, "getsqlexpression", &_7, _3, escapeChar);
zephir_check_call_status();
- zephir_array_append(&sqlItems, _6, PH_SEPARATE, "phalcon/db/dialect.zep", 223);
+ ZEPHIR_CONCAT_SVS(return_value, "(", _6, ")");
+ RETURN_MM();
}
- ZEPHIR_INIT_VAR(_15);
- zephir_fast_join_str(_15, SL(", "), sqlItems TSRMLS_CC);
- ZEPHIR_CONCAT_SVS(return_value, "(", _15, ")");
- RETURN_MM();
- }
- if (ZEPHIR_IS_STRING(type, "all")) {
- RETURN_MM_STRING("*", 1);
- }
- if (ZEPHIR_IS_STRING(type, "cast")) {
- zephir_array_fetch_string(&_2, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 240 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_3, _2, escapeChar);
- zephir_check_call_status();
- zephir_array_fetch_string(&_4, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 241 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_3, _4, escapeChar);
- zephir_check_call_status();
- ZEPHIR_CONCAT_SVSVS(return_value, "CAST(", left, " AS ", right, ")");
- RETURN_MM();
- }
- if (ZEPHIR_IS_STRING(type, "convert")) {
- zephir_array_fetch_string(&_2, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 251 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_3, _2, escapeChar);
- zephir_check_call_status();
- zephir_array_fetch_string(&_4, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 252 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_3, _4, escapeChar);
- zephir_check_call_status();
- ZEPHIR_CONCAT_SVSVS(return_value, "CONVERT(", left, " USING ", right, ")");
- RETURN_MM();
- }
- ZEPHIR_INIT_NVAR(_15);
- object_init_ex(_15, phalcon_db_exception_ce);
- ZEPHIR_INIT_VAR(_16);
- ZEPHIR_CONCAT_SVS(_16, "Invalid SQL expression type '", type, "'");
- ZEPHIR_CALL_METHOD(NULL, _15, "__construct", &_17, _16);
+ if (ZEPHIR_IS_STRING(type, "functionCall")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionfunctioncall", &_8, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ if (ZEPHIR_IS_STRING(type, "list")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionlist", &_9, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ if (ZEPHIR_IS_STRING(type, "all")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionall", &_10, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ if (ZEPHIR_IS_STRING(type, "cast")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressioncastvalue", &_11, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ if (ZEPHIR_IS_STRING(type, "convert")) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpressionconvertvalue", &_12, expression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ } while(0);
+
+ ZEPHIR_INIT_VAR(_13);
+ object_init_ex(_13, phalcon_db_exception_ce);
+ ZEPHIR_INIT_VAR(_14);
+ ZEPHIR_CONCAT_SVS(_14, "Invalid SQL expression type '", type, "'");
+ ZEPHIR_CALL_METHOD(NULL, _13, "__construct", &_15, _14);
zephir_check_call_status();
- zephir_throw_exception_debug(_15, "phalcon/db/dialect.zep", 260 TSRMLS_CC);
+ zephir_throw_exception_debug(_13, "phalcon/db/dialect.zep", 291 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
@@ -399,9 +472,9 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression) {
*/
PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) {
- zend_bool _2;
- zval *escapeChar = NULL, *_1 = NULL;
- zval *table, *escapeChar_param = NULL, *sqlTable = NULL, *sqlSchema = NULL, *aliasName, *sqlTableAlias = NULL, *schemaName, *tableName, *_0;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *table, *escapeChar_param = NULL, *tableName, *schemaName = NULL, *aliasName = NULL;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 1, &table, &escapeChar_param);
@@ -414,56 +487,26 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) {
}
- if (ZEPHIR_IS_STRING_IDENTICAL(escapeChar, "")) {
- ZEPHIR_OBS_VAR(_0);
- zephir_read_property_this(&_0, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
- zephir_get_strval(_1, _0);
- ZEPHIR_CPY_WRT(escapeChar, _1);
- }
if (Z_TYPE_P(table) == IS_ARRAY) {
ZEPHIR_OBS_VAR(tableName);
- zephir_array_fetch_long(&tableName, table, 0, PH_NOISY, "phalcon/db/dialect.zep", 284 TSRMLS_CC);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_INIT_VAR(sqlTable);
- ZEPHIR_CONCAT_VVV(sqlTable, escapeChar, tableName, escapeChar);
- } else {
- ZEPHIR_CPY_WRT(sqlTable, tableName);
- }
+ zephir_array_fetch_long(&tableName, table, 0, PH_NOISY, "phalcon/db/dialect.zep", 310 TSRMLS_CC);
ZEPHIR_OBS_VAR(schemaName);
- zephir_array_fetch_long(&schemaName, table, 1, PH_NOISY, "phalcon/db/dialect.zep", 295 TSRMLS_CC);
- _2 = Z_TYPE_P(schemaName) != IS_NULL;
- if (_2) {
- _2 = !ZEPHIR_IS_STRING(schemaName, "");
- }
- if (_2) {
- ZEPHIR_INIT_VAR(sqlSchema);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VVVSV(sqlSchema, escapeChar, schemaName, escapeChar, ".", sqlTable);
- } else {
- ZEPHIR_CONCAT_VSV(sqlSchema, schemaName, ".", sqlTable);
- }
- } else {
- ZEPHIR_CPY_WRT(sqlSchema, sqlTable);
+ if (!(zephir_array_isset_long_fetch(&schemaName, table, 1, 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(schemaName);
+ ZVAL_NULL(schemaName);
}
ZEPHIR_OBS_VAR(aliasName);
- if (zephir_array_isset_long_fetch(&aliasName, table, 2, 0 TSRMLS_CC)) {
- ZEPHIR_INIT_VAR(sqlTableAlias);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VSVVV(sqlTableAlias, sqlSchema, " AS ", escapeChar, aliasName, escapeChar);
- } else {
- ZEPHIR_CONCAT_VSV(sqlTableAlias, sqlSchema, " AS ", aliasName);
- }
- } else {
- ZEPHIR_CPY_WRT(sqlTableAlias, sqlSchema);
+ if (!(zephir_array_isset_long_fetch(&aliasName, table, 2, 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(aliasName);
+ ZVAL_NULL(aliasName);
}
- RETURN_CCTOR(sqlTableAlias);
- }
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VVV(return_value, escapeChar, table, escapeChar);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparetable", NULL, tableName, schemaName, aliasName, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ } else {
+ RETVAL_ZVAL(table, 1, 0);
RETURN_MM();
}
- RETVAL_ZVAL(table, 1, 0);
- RETURN_MM();
}
@@ -472,13 +515,11 @@ PHP_METHOD(Phalcon_Db_Dialect, getSqlTable) {
*/
PHP_METHOD(Phalcon_Db_Dialect, select) {
- zephir_nts_static zephir_fcall_cache_entry *_8 = NULL;
- zephir_fcall_cache_entry *_3 = NULL;
+ zend_bool _6, _11, _13, _15, _17, _19;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL, *_9 = NULL, *_12 = NULL, *_14 = NULL, *_16 = NULL, *_18 = NULL, *_21 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- HashTable *_1, *_5, *_11, *_16, *_23, *_27;
- HashPosition _0, _4, _10, _15, _22, _26;
- zval *definition_param = NULL, *tables, *columns, *escapeChar = NULL, *columnItem = NULL, *column = NULL, *selectedColumns, *columnSql = NULL, *columnDomainSql = NULL, *columnAlias = NULL, *selectedTables, *sqlJoin = NULL, *joinExpressions = NULL, *joinCondition = NULL, *joinConditionsArray = NULL, *tablesSql = NULL, *columnDomain = NULL, *columnAliasSql = NULL, *columnsSql = NULL, *table = NULL, *distinct, *sql = NULL, *joins, *join = NULL, *sqlTable = NULL, *whereConditions, *groupFields, *groupField = NULL, *groupItems, *havingConditions, *orderFields, *orderItem = NULL, *orderItems, *orderSqlItem = NULL, *sqlOrderType = NULL, *orderSqlItemType = NULL, *limitValue, *limitNumber = NULL, *limitNumberValue, *offset, *offsetNumber = NULL, **_2, **_6, *_7 = NULL, *_9 = NULL, **_12, *_13, *_14, **_17, *_18 = NULL, *_19 = NULL, *_20 = NULL, *_21 = NULL, **_24, *_25 = NULL, **_28, *_29;
- zval *definition = NULL;
+ zval *definition_param = NULL, *tables, *columns, *sql = NULL, *distinct, *joins, *where, *groupBy, *having, *orderBy, *limit, *_0 = NULL, *_2, *_3 = NULL, *_5, *_7 = NULL, *_8, *_10 = NULL;
+ zval *definition = NULL, *_20;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &definition_param);
@@ -489,287 +530,109 @@ PHP_METHOD(Phalcon_Db_Dialect, select) {
ZEPHIR_OBS_VAR(tables);
if (!(zephir_array_isset_string_fetch(&tables, definition, SS("tables"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'tables' is required in the definition array", "phalcon/db/dialect.zep", 345);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'tables' is required in the definition array", "phalcon/db/dialect.zep", 341);
return;
}
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.zep", 349);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/db/dialect.zep", 345);
return;
}
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_OBS_VAR(escapeChar);
- zephir_read_property_this(&escapeChar, this_ptr, SL("_escapeChar"), PH_NOISY_CC);
- } else {
- ZEPHIR_INIT_NVAR(escapeChar);
- ZVAL_NULL(escapeChar);
- }
- if (Z_TYPE_P(columns) == IS_ARRAY) {
- ZEPHIR_INIT_VAR(selectedColumns);
- array_init(selectedColumns);
- zephir_is_iterable(columns, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 416);
- 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_OBS_NVAR(columnItem);
- zephir_array_fetch_long(&columnItem, column, 0, PH_NOISY, "phalcon/db/dialect.zep", 366 TSRMLS_CC);
- if (Z_TYPE_P(columnItem) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&columnSql, this_ptr, "getsqlexpression", &_3, columnItem, escapeChar);
- zephir_check_call_status();
- } else {
- if (ZEPHIR_IS_STRING(columnItem, "*")) {
- ZEPHIR_CPY_WRT(columnSql, columnItem);
- } else {
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_INIT_NVAR(columnSql);
- ZEPHIR_CONCAT_VVV(columnSql, escapeChar, columnItem, escapeChar);
- } else {
- ZEPHIR_CPY_WRT(columnSql, columnItem);
- }
- }
- }
- ZEPHIR_OBS_NVAR(columnDomain);
- if (zephir_array_isset_long_fetch(&columnDomain, column, 1, 0 TSRMLS_CC)) {
- if (zephir_is_true(columnDomain)) {
- ZEPHIR_INIT_NVAR(columnDomainSql);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VVVSV(columnDomainSql, escapeChar, columnDomain, escapeChar, ".", columnSql);
- } else {
- ZEPHIR_CONCAT_VSV(columnDomainSql, columnDomain, ".", columnSql);
- }
- } else {
- ZEPHIR_CPY_WRT(columnDomainSql, columnSql);
- }
- } else {
- ZEPHIR_CPY_WRT(columnDomainSql, columnSql);
- }
- ZEPHIR_OBS_NVAR(columnAlias);
- if (zephir_array_isset_long_fetch(&columnAlias, column, 2, 0 TSRMLS_CC)) {
- if (zephir_is_true(columnAlias)) {
- ZEPHIR_INIT_NVAR(columnAliasSql);
- if (ZEPHIR_GLOBAL(db).escape_identifiers) {
- ZEPHIR_CONCAT_VSVVV(columnAliasSql, columnDomainSql, " AS ", escapeChar, columnAlias, escapeChar);
- } else {
- ZEPHIR_CONCAT_VSV(columnAliasSql, columnDomainSql, " AS ", columnAlias);
- }
- } else {
- ZEPHIR_CPY_WRT(columnAliasSql, columnDomainSql);
- }
- } else {
- ZEPHIR_CPY_WRT(columnAliasSql, columnDomainSql);
- }
- zephir_array_append(&selectedColumns, columnAliasSql, PH_SEPARATE, "phalcon/db/dialect.zep", 414);
- }
- ZEPHIR_INIT_VAR(columnsSql);
- zephir_fast_join_str(columnsSql, SL(", "), selectedColumns TSRMLS_CC);
- } else {
- ZEPHIR_CPY_WRT(columnsSql, columns);
- }
- if (Z_TYPE_P(tables) == IS_ARRAY) {
- ZEPHIR_INIT_VAR(selectedTables);
- array_init(selectedTables);
- zephir_is_iterable(tables, &_5, &_4, 0, 0, "phalcon/db/dialect.zep", 429);
- for (
- ; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
- ; zephir_hash_move_forward_ex(_5, &_4)
- ) {
- ZEPHIR_GET_HVALUE(table, _6);
- ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqltable", &_8, table, escapeChar);
- zephir_check_call_status();
- zephir_array_append(&selectedTables, _7, PH_SEPARATE, "phalcon/db/dialect.zep", 427);
- }
- ZEPHIR_INIT_VAR(tablesSql);
- zephir_fast_join_str(tablesSql, SL(", "), selectedTables TSRMLS_CC);
- } else {
- ZEPHIR_CPY_WRT(tablesSql, tables);
- }
ZEPHIR_OBS_VAR(distinct);
if (zephir_array_isset_string_fetch(&distinct, definition, SS("distinct"), 0 TSRMLS_CC)) {
- if (ZEPHIR_IS_LONG(distinct, 0)) {
- ZEPHIR_INIT_VAR(sql);
- ZVAL_STRING(sql, "SELECT ALL ", 1);
+ ZEPHIR_INIT_VAR(sql);
+ if (zephir_is_true(distinct)) {
+ ZVAL_STRING(sql, "SELECT DISTINCT", 1);
} else {
- ZEPHIR_INIT_NVAR(sql);
- if (ZEPHIR_IS_LONG(distinct, 1)) {
- ZVAL_STRING(sql, "SELECT DISTINCT ", 1);
- } else {
- ZVAL_STRING(sql, "SELECT ", 1);
- }
+ ZVAL_STRING(sql, "SELECT ALL", 1);
}
} else {
ZEPHIR_INIT_NVAR(sql);
- ZVAL_STRING(sql, "SELECT ", 1);
+ ZVAL_STRING(sql, "SELECT", 1);
}
- ZEPHIR_INIT_VAR(_9);
- ZEPHIR_CONCAT_VVSV(_9, sql, columnsSql, " FROM ", tablesSql);
- ZEPHIR_CPY_WRT(sql, _9);
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "getcolumnlist", &_1, columns);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_2);
+ ZEPHIR_CONCAT_SV(_2, " ", _0);
+ zephir_concat_self(&sql, _2 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpressionfrom", &_4, tables);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_5);
+ ZEPHIR_CONCAT_SV(_5, " ", _3);
+ zephir_concat_self(&sql, _5 TSRMLS_CC);
ZEPHIR_OBS_VAR(joins);
- if (zephir_array_isset_string_fetch(&joins, definition, SS("joins"), 0 TSRMLS_CC)) {
- zephir_is_iterable(joins, &_11, &_10, 0, 0, "phalcon/db/dialect.zep", 478);
- for (
- ; zephir_hash_get_current_data_ex(_11, (void**) &_12, &_10) == SUCCESS
- ; zephir_hash_move_forward_ex(_11, &_10)
- ) {
- ZEPHIR_GET_HVALUE(join, _12);
- zephir_array_fetch_string(&_13, join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 456 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&sqlTable, this_ptr, "getsqltable", &_8, _13, escapeChar);
- zephir_check_call_status();
- zephir_array_append(&selectedTables, sqlTable, PH_SEPARATE, "phalcon/db/dialect.zep", 457);
- zephir_array_fetch_string(&_14, join, SL("type"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 458 TSRMLS_CC);
- ZEPHIR_INIT_NVAR(sqlJoin);
- ZEPHIR_CONCAT_SVSV(sqlJoin, " ", _14, " JOIN ", sqlTable);
- ZEPHIR_OBS_NVAR(joinConditionsArray);
- if (zephir_array_isset_string_fetch(&joinConditionsArray, join, SS("conditions"), 0 TSRMLS_CC)) {
- if (zephir_fast_count_int(joinConditionsArray TSRMLS_CC)) {
- if (!(zephir_array_isset_long(joinConditionsArray, 0))) {
- ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpression", &_3, joinConditionsArray, escapeChar);
- zephir_check_call_status();
- ZEPHIR_INIT_LNVAR(_9);
- ZEPHIR_CONCAT_SVS(_9, " ON ", _7, " ");
- zephir_concat_self(&sqlJoin, _9 TSRMLS_CC);
- } else {
- ZEPHIR_INIT_NVAR(joinExpressions);
- array_init(joinExpressions);
- zephir_is_iterable(joinConditionsArray, &_16, &_15, 0, 0, "phalcon/db/dialect.zep", 472);
- for (
- ; zephir_hash_get_current_data_ex(_16, (void**) &_17, &_15) == SUCCESS
- ; zephir_hash_move_forward_ex(_16, &_15)
- ) {
- ZEPHIR_GET_HVALUE(joinCondition, _17);
- ZEPHIR_CALL_METHOD(&_18, this_ptr, "getsqlexpression", &_3, joinCondition, escapeChar);
- zephir_check_call_status();
- zephir_array_append(&joinExpressions, _18, PH_SEPARATE, "phalcon/db/dialect.zep", 470);
- }
- ZEPHIR_INIT_NVAR(_19);
- zephir_fast_join_str(_19, SL(" AND "), joinExpressions TSRMLS_CC);
- ZEPHIR_INIT_LNVAR(_20);
- ZEPHIR_CONCAT_SVS(_20, " ON ", _19, " ");
- zephir_concat_self(&sqlJoin, _20 TSRMLS_CC);
- }
- }
- }
- zephir_concat_self(&sql, sqlJoin TSRMLS_CC);
- }
+ _6 = zephir_array_isset_string_fetch(&joins, definition, SS("joins"), 0 TSRMLS_CC);
+ if (_6) {
+ _6 = zephir_is_true(joins);
}
- ZEPHIR_OBS_VAR(whereConditions);
- if (zephir_array_isset_string_fetch(&whereConditions, definition, SS("where"), 0 TSRMLS_CC)) {
- if (Z_TYPE_P(whereConditions) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpression", &_3, whereConditions, escapeChar);
- zephir_check_call_status();
- ZEPHIR_INIT_LNVAR(_20);
- ZEPHIR_CONCAT_SV(_20, " WHERE ", _7);
- zephir_concat_self(&sql, _20 TSRMLS_CC);
- } else {
- ZEPHIR_INIT_VAR(_21);
- ZEPHIR_CONCAT_SV(_21, " WHERE ", whereConditions);
- zephir_concat_self(&sql, _21 TSRMLS_CC);
- }
+ if (_6) {
+ zephir_array_fetch_string(&_8, definition, SL("joins"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 374 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpressionjoins", &_9, _8);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_10);
+ ZEPHIR_CONCAT_SV(_10, " ", _7);
+ zephir_concat_self(&sql, _10 TSRMLS_CC);
}
- ZEPHIR_OBS_VAR(groupFields);
- if (zephir_array_isset_string_fetch(&groupFields, definition, SS("group"), 0 TSRMLS_CC)) {
- ZEPHIR_INIT_VAR(groupItems);
- array_init(groupItems);
- zephir_is_iterable(groupFields, &_23, &_22, 0, 0, "phalcon/db/dialect.zep", 504);
- for (
- ; zephir_hash_get_current_data_ex(_23, (void**) &_24, &_22) == SUCCESS
- ; zephir_hash_move_forward_ex(_23, &_22)
- ) {
- ZEPHIR_GET_HVALUE(groupField, _24);
- if (Z_TYPE_P(groupField) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpression", &_3, groupField, escapeChar);
- zephir_check_call_status();
- zephir_array_append(&groupItems, _7, PH_SEPARATE, "phalcon/db/dialect.zep", 499);
- } else {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "?", "phalcon/db/dialect.zep", 501);
- return;
- }
- }
- ZEPHIR_INIT_NVAR(_19);
- zephir_fast_join_str(_19, SL(", "), groupItems TSRMLS_CC);
- ZEPHIR_INIT_LNVAR(_21);
- ZEPHIR_CONCAT_SV(_21, " GROUP BY ", _19);
- zephir_concat_self(&sql, _21 TSRMLS_CC);
- ZEPHIR_OBS_VAR(havingConditions);
- if (zephir_array_isset_string_fetch(&havingConditions, definition, SS("having"), 0 TSRMLS_CC)) {
- if (Z_TYPE_P(havingConditions) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpression", &_3, havingConditions, escapeChar);
- zephir_check_call_status();
- ZEPHIR_INIT_VAR(_25);
- ZEPHIR_CONCAT_SV(_25, " HAVING ", _7);
- zephir_concat_self(&sql, _25 TSRMLS_CC);
- } else {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "?", "phalcon/db/dialect.zep", 513);
- return;
- }
- }
+ ZEPHIR_OBS_VAR(where);
+ _11 = zephir_array_isset_string_fetch(&where, definition, SS("where"), 0 TSRMLS_CC);
+ if (_11) {
+ _11 = zephir_is_true(where);
}
- ZEPHIR_OBS_VAR(orderFields);
- if (zephir_array_isset_string_fetch(&orderFields, definition, SS("order"), 0 TSRMLS_CC)) {
- ZEPHIR_INIT_VAR(orderItems);
- array_init(orderItems);
- zephir_is_iterable(orderFields, &_27, &_26, 0, 0, "phalcon/db/dialect.zep", 542);
- for (
- ; zephir_hash_get_current_data_ex(_27, (void**) &_28, &_26) == SUCCESS
- ; zephir_hash_move_forward_ex(_27, &_26)
- ) {
- ZEPHIR_GET_HVALUE(orderItem, _28);
- if (Z_TYPE_P(orderItem) == IS_ARRAY) {
- zephir_array_fetch_long(&_13, orderItem, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 526 TSRMLS_CC);
- ZEPHIR_CALL_METHOD(&orderSqlItem, this_ptr, "getsqlexpression", &_3, _13, escapeChar);
- zephir_check_call_status();
- } else {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "?", "phalcon/db/dialect.zep", 528);
- return;
- }
- ZEPHIR_OBS_NVAR(sqlOrderType);
- if (zephir_array_isset_long_fetch(&sqlOrderType, orderItem, 1, 0 TSRMLS_CC)) {
- ZEPHIR_INIT_NVAR(orderSqlItemType);
- ZEPHIR_CONCAT_VSV(orderSqlItemType, orderSqlItem, " ", sqlOrderType);
- } else {
- ZEPHIR_CPY_WRT(orderSqlItemType, orderSqlItem);
- }
- zephir_array_append(&orderItems, orderSqlItemType, PH_SEPARATE, "phalcon/db/dialect.zep", 540);
- }
- ZEPHIR_INIT_VAR(_29);
- zephir_fast_join_str(_29, SL(", "), orderItems TSRMLS_CC);
- ZEPHIR_INIT_LNVAR(_21);
- ZEPHIR_CONCAT_SV(_21, " ORDER BY ", _29);
- zephir_concat_self(&sql, _21 TSRMLS_CC);
- }
- ZEPHIR_OBS_VAR(limitValue);
- if (zephir_array_isset_string_fetch(&limitValue, definition, SS("limit"), 0 TSRMLS_CC)) {
- if (Z_TYPE_P(limitValue) == IS_ARRAY) {
- ZEPHIR_OBS_VAR(limitNumberValue);
- zephir_array_fetch_string(&limitNumberValue, limitValue, SL("number"), PH_NOISY, "phalcon/db/dialect.zep", 552 TSRMLS_CC);
- if (Z_TYPE_P(limitNumberValue) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&limitNumber, this_ptr, "getsqlexpression", &_3, limitNumberValue, escapeChar);
- zephir_check_call_status();
- } else {
- ZEPHIR_CPY_WRT(limitNumber, limitNumberValue);
- }
- ZEPHIR_OBS_VAR(offset);
- if (zephir_array_isset_string_fetch(&offset, limitValue, SS("offset"), 0 TSRMLS_CC)) {
- if (Z_TYPE_P(offset) == IS_ARRAY) {
- ZEPHIR_CALL_METHOD(&offsetNumber, this_ptr, "getsqlexpression", &_3, offset, escapeChar);
- zephir_check_call_status();
- } else {
- ZEPHIR_CPY_WRT(offsetNumber, offset);
- }
- ZEPHIR_INIT_LNVAR(_25);
- ZEPHIR_CONCAT_SVSV(_25, " LIMIT ", limitNumber, " OFFSET ", offsetNumber);
- zephir_concat_self(&sql, _25 TSRMLS_CC);
- } else {
- ZEPHIR_INIT_LNVAR(_25);
- ZEPHIR_CONCAT_SV(_25, " LIMIT ", limitNumber);
- zephir_concat_self(&sql, _25 TSRMLS_CC);
- }
- } else {
- ZEPHIR_INIT_LNVAR(_21);
- ZEPHIR_CONCAT_SV(_21, " LIMIT ", limitValue);
- zephir_concat_self(&sql, _21 TSRMLS_CC);
- }
+ if (_11) {
+ ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpressionwhere", &_12, where);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_10);
+ ZEPHIR_CONCAT_SV(_10, " ", _7);
+ zephir_concat_self(&sql, _10 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_VAR(groupBy);
+ _13 = zephir_array_isset_string_fetch(&groupBy, definition, SS("group"), 0 TSRMLS_CC);
+ if (_13) {
+ _13 = zephir_is_true(groupBy);
+ }
+ if (_13) {
+ ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpressiongroupby", &_14, groupBy);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_10);
+ ZEPHIR_CONCAT_SV(_10, " ", _7);
+ zephir_concat_self(&sql, _10 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_VAR(having);
+ _15 = zephir_array_isset_string_fetch(&having, definition, SS("having"), 0 TSRMLS_CC);
+ if (_15) {
+ _15 = zephir_is_true(having);
+ }
+ if (_15) {
+ ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpressionhaving", &_16, having);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_10);
+ ZEPHIR_CONCAT_SV(_10, " ", _7);
+ zephir_concat_self(&sql, _10 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_VAR(orderBy);
+ _17 = zephir_array_isset_string_fetch(&orderBy, definition, SS("order"), 0 TSRMLS_CC);
+ if (_17) {
+ _17 = zephir_is_true(orderBy);
+ }
+ if (_17) {
+ ZEPHIR_CALL_METHOD(&_7, this_ptr, "getsqlexpressionorderby", &_18, orderBy);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_10);
+ ZEPHIR_CONCAT_SV(_10, " ", _7);
+ zephir_concat_self(&sql, _10 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_VAR(limit);
+ _19 = zephir_array_isset_string_fetch(&limit, definition, SS("limit"), 0 TSRMLS_CC);
+ if (_19) {
+ _19 = zephir_is_true(limit);
+ }
+ if (_19) {
+ ZEPHIR_INIT_VAR(_20);
+ zephir_create_array(_20, 2, 0 TSRMLS_CC);
+ zephir_array_update_string(&_20, SL("sql"), &sql, PH_COPY | PH_SEPARATE);
+ zephir_array_update_string(&_20, SL("value"), &limit, PH_COPY | PH_SEPARATE);
+ ZEPHIR_CALL_METHOD(&sql, this_ptr, "getsqlexpressionlimit", &_21, _20);
+ zephir_check_call_status();
}
RETURN_CCTOR(sql);
@@ -887,3 +750,993 @@ PHP_METHOD(Phalcon_Db_Dialect, rollbackSavepoint) {
}
+/**
+ * Resolve Column expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *value, *_0;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (zephir_array_isset_string(expression, SS("column"))) {
+ zephir_array_fetch_string(&_0, expression, SL("column"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 463 TSRMLS_CC);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlcolumn", &_1, _0);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+ ZEPHIR_OBS_VAR(value);
+ if (!(zephir_array_isset_string_fetch(&value, expression, SS("value"), 0 TSRMLS_CC))) {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL expression", "phalcon/db/dialect.zep", 467);
+ return;
+ }
+ if (Z_TYPE_P(value) == IS_ARRAY) {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, value, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ } else {
+ RETURN_CCTOR(value);
+ }
+
+}
+
+/**
+ * Resolve object expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionObject) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zend_bool _0, _1;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *domain = NULL, *objectExpression;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+ ZEPHIR_INIT_VAR(domain);
+ ZVAL_NULL(domain);
+
+
+ ZEPHIR_INIT_VAR(objectExpression);
+ zephir_create_array(objectExpression, 1, 0 TSRMLS_CC);
+ add_assoc_stringl_ex(objectExpression, SS("type"), SL("all"), 1);
+ ZEPHIR_OBS_NVAR(domain);
+ _0 = zephir_array_isset_string_fetch(&domain, expression, SS("balias"), 0 TSRMLS_CC);
+ if (!(_0)) {
+ ZEPHIR_OBS_NVAR(domain);
+ _0 = zephir_array_isset_string_fetch(&domain, expression, SS("domain"), 0 TSRMLS_CC);
+ }
+ _1 = _0;
+ if (_1) {
+ _1 = !ZEPHIR_IS_STRING(domain, "");
+ }
+ if (_1) {
+ zephir_array_update_string(&objectExpression, SL("domain"), &domain, PH_COPY | PH_SEPARATE);
+ }
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "getsqlexpression", NULL, objectExpression, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve qualified expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionQualified) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *column, *domain = NULL;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_OBS_VAR(column);
+ zephir_array_fetch_string(&column, expression, SL("name"), PH_NOISY, "phalcon/db/dialect.zep", 501 TSRMLS_CC);
+ ZEPHIR_OBS_VAR(domain);
+ if (!(zephir_array_isset_string_fetch(&domain, expression, SS("domain"), 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(domain);
+ ZVAL_NULL(domain);
+ }
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, column, domain, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve binary operations expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations) {
+
+ zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *left = NULL, *right = NULL, *_0, *_2, *_3;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ zephir_array_fetch_string(&_0, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 520 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_1, _0, escapeChar);
+ zephir_check_call_status();
+ zephir_array_fetch_string(&_2, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 521 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_1, _2, escapeChar);
+ zephir_check_call_status();
+ zephir_array_fetch_string(&_3, expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 523 TSRMLS_CC);
+ ZEPHIR_CONCAT_VSVSV(return_value, left, " ", _3, " ", right);
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve unary operations expressions
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations) {
+
+ zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *left, *right, *_0 = NULL, *_2;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_OBS_VAR(left);
+ if (zephir_array_isset_string_fetch(&left, expression, SS("left"), 0 TSRMLS_CC)) {
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", &_1, left, escapeChar);
+ zephir_check_call_status();
+ zephir_array_fetch_string(&_2, expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 537 TSRMLS_CC);
+ ZEPHIR_CONCAT_VSV(return_value, _0, " ", _2);
+ RETURN_MM();
+ }
+ ZEPHIR_OBS_VAR(right);
+ if (zephir_array_isset_string_fetch(&right, expression, SS("right"), 0 TSRMLS_CC)) {
+ zephir_array_fetch_string(&_2, expression, SL("op"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 544 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", &_1, right, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_VSV(return_value, _2, " ", _0);
+ RETURN_MM();
+ }
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-unary expression", "phalcon/db/dialect.zep", 547);
+ return;
+
+}
+
+/**
+ * Resolve function calls
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFunctionCall) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zend_bool _0, _2;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *arguments = NULL, *_3, *_4;
+ zval *expression = NULL, *_1;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_OBS_VAR(arguments);
+ _0 = zephir_array_isset_string_fetch(&arguments, expression, SS("arguments"), 0 TSRMLS_CC);
+ if (_0) {
+ _0 = Z_TYPE_P(arguments) == IS_ARRAY;
+ }
+ if (_0) {
+ ZEPHIR_INIT_VAR(_1);
+ zephir_create_array(_1, 3, 0 TSRMLS_CC);
+ add_assoc_stringl_ex(_1, SS("type"), SL("list"), 1);
+ zephir_array_update_string(&_1, SL("parentheses"), &ZEPHIR_GLOBAL(global_false), PH_COPY | PH_SEPARATE);
+ zephir_array_update_string(&_1, SL("value"), &arguments, PH_COPY | PH_SEPARATE);
+ ZEPHIR_CALL_METHOD(&arguments, this_ptr, "getsqlexpression", NULL, _1, escapeChar);
+ zephir_check_call_status();
+ _2 = zephir_array_isset_string(expression, SS("distinct"));
+ if (_2) {
+ zephir_array_fetch_string(&_3, expression, SL("distinct"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 565 TSRMLS_CC);
+ _2 = zephir_is_true(_3);
+ }
+ if (_2) {
+ zephir_array_fetch_string(&_4, expression, SL("name"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 566 TSRMLS_CC);
+ ZEPHIR_CONCAT_VSVS(return_value, _4, "(DISTINCT ", arguments, ")");
+ RETURN_MM();
+ } else {
+ zephir_array_fetch_string(&_4, expression, SL("name"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 568 TSRMLS_CC);
+ ZEPHIR_CONCAT_VSVS(return_value, _4, "(", arguments, ")");
+ RETURN_MM();
+ }
+ }
+ zephir_array_fetch_string(&_3, expression, SL("name"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 573 TSRMLS_CC);
+ ZEPHIR_CONCAT_VS(return_value, _3, "()");
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve Lists
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList) {
+
+ zephir_fcall_cache_entry *_6 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ HashTable *_3;
+ HashPosition _2;
+ zend_bool _0, _1, _7;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *items, *item = NULL, *values = NULL, *separator = NULL, **_4, *_5 = NULL, *_8, *_9;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_INIT_VAR(items);
+ array_init(items);
+ ZEPHIR_INIT_VAR(separator);
+ ZVAL_STRING(separator, ", ", 1);
+ if (zephir_array_isset_string(expression, SS("separator"))) {
+ ZEPHIR_OBS_NVAR(separator);
+ zephir_array_fetch_string(&separator, expression, SL("separator"), PH_NOISY, "phalcon/db/dialect.zep", 587 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_VAR(values);
+ _0 = zephir_array_isset_long_fetch(&values, expression, 0, 0 TSRMLS_CC);
+ if (!(_0)) {
+ ZEPHIR_OBS_NVAR(values);
+ _0 = zephir_array_isset_string_fetch(&values, expression, SS("value"), 0 TSRMLS_CC);
+ }
+ _1 = _0;
+ if (_1) {
+ _1 = Z_TYPE_P(values) == IS_ARRAY;
+ }
+ if (_1) {
+ zephir_is_iterable(values, &_3, &_2, 0, 0, "phalcon/db/dialect.zep", 596);
+ for (
+ ; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
+ ; zephir_hash_move_forward_ex(_3, &_2)
+ ) {
+ ZEPHIR_GET_HVALUE(item, _4);
+ ZEPHIR_CALL_METHOD(&_5, this_ptr, "getsqlexpression", &_6, item, escapeChar);
+ zephir_check_call_status();
+ zephir_array_append(&items, _5, PH_SEPARATE, "phalcon/db/dialect.zep", 593);
+ }
+ _7 = zephir_array_isset_string(expression, SS("parentheses"));
+ if (_7) {
+ zephir_array_fetch_string(&_8, expression, SL("parentheses"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 596 TSRMLS_CC);
+ _7 = ZEPHIR_IS_FALSE_IDENTICAL(_8);
+ }
+ if (_7) {
+ zephir_fast_join(return_value, separator, items TSRMLS_CC);
+ RETURN_MM();
+ } else {
+ ZEPHIR_INIT_VAR(_9);
+ zephir_fast_join(_9, separator, items TSRMLS_CC);
+ ZEPHIR_CONCAT_SVS(return_value, "(", _9, ")");
+ RETURN_MM();
+ }
+ }
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-list expression", "phalcon/db/dialect.zep", 603);
+ return;
+
+}
+
+/**
+ * Resolve *
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionAll) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *domain = NULL, *_0;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_OBS_VAR(domain);
+ if (!(zephir_array_isset_string_fetch(&domain, expression, SS("domain"), 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(domain);
+ ZVAL_NULL(domain);
+ }
+ ZEPHIR_INIT_VAR(_0);
+ ZVAL_STRING(_0, "*", ZEPHIR_TEMP_PARAM_COPY);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "preparequalified", NULL, _0, domain, escapeChar);
+ zephir_check_temp_parameter(_0);
+ zephir_check_call_status();
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve CAST of values
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue) {
+
+ zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *left = NULL, *right = NULL, *_0, *_2;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ zephir_array_fetch_string(&_0, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 627 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_1, _0, escapeChar);
+ zephir_check_call_status();
+ zephir_array_fetch_string(&_2, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 628 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_1, _2, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "CAST(", left, " AS ", right, ")");
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve CONVERT of values encodings
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue) {
+
+ zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression_param = NULL, *escapeChar_param = NULL, *left = NULL, *right = NULL, *_0, *_2;
+ zval *expression = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression_param, &escapeChar_param);
+
+ expression = expression_param;
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ zephir_array_fetch_string(&_0, expression, SL("left"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 640 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&left, this_ptr, "getsqlexpression", &_1, _0, escapeChar);
+ zephir_check_call_status();
+ zephir_array_fetch_string(&_2, expression, SL("right"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 641 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&right, this_ptr, "getsqlexpression", &_1, _2, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "CONVERT(", left, " USING ", right, ")");
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve a FROM clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_4 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ HashTable *_1;
+ HashPosition _0;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *table = NULL, *tables = NULL, **_2, *_3 = NULL, *_5;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (Z_TYPE_P(expression) == IS_ARRAY) {
+ ZEPHIR_INIT_VAR(tables);
+ array_init(tables);
+ zephir_is_iterable(expression, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 661);
+ for (
+ ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
+ ; zephir_hash_move_forward_ex(_1, &_0)
+ ) {
+ ZEPHIR_GET_HVALUE(table, _2);
+ ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqltable", &_4, table);
+ zephir_check_call_status();
+ zephir_array_append(&tables, _3, PH_SEPARATE, "phalcon/db/dialect.zep", 658);
+ }
+ ZEPHIR_INIT_VAR(_5);
+ zephir_fast_join_str(_5, SL(", "), tables TSRMLS_CC);
+ ZEPHIR_CPY_WRT(tables, _5);
+ } else {
+ ZEPHIR_CPY_WRT(tables, expression);
+ }
+ ZEPHIR_CONCAT_SV(return_value, "FROM ", tables);
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve a JOINs clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_12 = NULL;
+ zephir_fcall_cache_entry *_4 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zend_bool _3, _10;
+ HashTable *_1, *_6;
+ HashPosition _0, _5;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *join = NULL, *sql, *joinCondition = NULL, *joinTable = NULL, *joinType = NULL, *joinConditionsArray = NULL, **_2, *condition = NULL, **_7, *_8 = NULL, *_9 = NULL, *_11, *_13 = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+ ZEPHIR_INIT_VAR(sql);
+ ZVAL_STRING(sql, "", 1);
+ ZEPHIR_INIT_VAR(joinType);
+ ZVAL_STRING(joinType, "", 1);
+
+
+ zephir_is_iterable(expression, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 710);
+ for (
+ ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
+ ; zephir_hash_move_forward_ex(_1, &_0)
+ ) {
+ ZEPHIR_GET_HVALUE(join, _2);
+ ZEPHIR_OBS_NVAR(joinConditionsArray);
+ _3 = zephir_array_isset_string_fetch(&joinConditionsArray, join, SS("conditions"), 0 TSRMLS_CC);
+ if (_3) {
+ _3 = !(ZEPHIR_IS_EMPTY(joinConditionsArray));
+ }
+ if (_3) {
+ if (!(zephir_array_isset_long(joinConditionsArray, 0))) {
+ ZEPHIR_CALL_METHOD(&joinCondition, this_ptr, "getsqlexpression", &_4, joinConditionsArray, escapeChar);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_INIT_NVAR(joinCondition);
+ array_init(joinCondition);
+ zephir_is_iterable(joinConditionsArray, &_6, &_5, 0, 0, "phalcon/db/dialect.zep", 695);
+ for (
+ ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
+ ; zephir_hash_move_forward_ex(_6, &_5)
+ ) {
+ ZEPHIR_GET_HVALUE(condition, _7);
+ ZEPHIR_CALL_METHOD(&_8, this_ptr, "getsqlexpression", &_4, condition, escapeChar);
+ zephir_check_call_status();
+ zephir_array_append(&joinCondition, _8, PH_SEPARATE, "phalcon/db/dialect.zep", 692);
+ }
+ ZEPHIR_INIT_NVAR(_9);
+ zephir_fast_join_str(_9, SL(" AND "), joinCondition TSRMLS_CC);
+ ZEPHIR_CPY_WRT(joinCondition, _9);
+ }
+ } else {
+ ZEPHIR_INIT_NVAR(joinCondition);
+ ZVAL_LONG(joinCondition, 1);
+ }
+ ZEPHIR_OBS_NVAR(joinType);
+ _10 = zephir_array_isset_string_fetch(&joinType, join, SS("type"), 0 TSRMLS_CC);
+ if (_10) {
+ _10 = zephir_is_true(joinType);
+ }
+ if (_10) {
+ zephir_concat_self_str(&joinType, SL(" ") TSRMLS_CC);
+ }
+ zephir_array_fetch_string(&_11, join, SL("source"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 705 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&joinTable, this_ptr, "getsqltable", &_12, _11, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_13);
+ ZEPHIR_CONCAT_SVSVSV(_13, " ", joinType, "JOIN ", joinTable, " ON ", joinCondition);
+ zephir_concat_self(&sql, _13 TSRMLS_CC);
+ }
+ RETURN_CCTOR(sql);
+
+}
+
+/**
+ * Resolve a WHERE clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionWhere) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *whereSql = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (Z_TYPE_P(expression) == IS_ARRAY) {
+ ZEPHIR_CALL_METHOD(&whereSql, this_ptr, "getsqlexpression", NULL, expression, escapeChar);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_CPY_WRT(whereSql, expression);
+ }
+ ZEPHIR_CONCAT_SV(return_value, "WHERE ", whereSql);
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve a GROUP BY clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy) {
+
+ zephir_fcall_cache_entry *_4 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ HashTable *_1;
+ HashPosition _0;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *filed = NULL, *fields = NULL, **_2, *_3 = NULL, *_5;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (Z_TYPE_P(expression) == IS_ARRAY) {
+ ZEPHIR_INIT_VAR(fields);
+ array_init(fields);
+ zephir_is_iterable(expression, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 748);
+ for (
+ ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
+ ; zephir_hash_move_forward_ex(_1, &_0)
+ ) {
+ ZEPHIR_GET_HVALUE(filed, _2);
+ if (unlikely(Z_TYPE_P(filed) != IS_ARRAY)) {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-GROUP-BY expression", "phalcon/db/dialect.zep", 742);
+ return;
+ } else {
+ ZEPHIR_CALL_METHOD(&_3, this_ptr, "getsqlexpression", &_4, filed, escapeChar);
+ zephir_check_call_status();
+ zephir_array_append(&fields, _3, PH_SEPARATE, "phalcon/db/dialect.zep", 744);
+ }
+ }
+ ZEPHIR_INIT_VAR(_5);
+ zephir_fast_join_str(_5, SL(", "), fields TSRMLS_CC);
+ ZEPHIR_CPY_WRT(fields, _5);
+ } else {
+ ZEPHIR_CPY_WRT(fields, expression);
+ }
+ ZEPHIR_CONCAT_SV(return_value, "GROUP BY ", fields);
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve a HAVING clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionHaving) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *_0 = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (Z_TYPE_P(expression) == IS_ARRAY) {
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "getsqlexpression", NULL, expression, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SV(return_value, "HAVING ", _0);
+ RETURN_MM();
+ } else {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-HAVING expression", "phalcon/db/dialect.zep", 765);
+ return;
+ }
+
+}
+
+/**
+ * Resolve a ORDER BY clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy) {
+
+ zend_bool _5;
+ zephir_fcall_cache_entry *_4 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ HashTable *_1;
+ HashPosition _0;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *filed = NULL, *fields = NULL, *type = NULL, *fieldSql = NULL, **_2, *_3, *_6 = NULL, *_7;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+ ZEPHIR_INIT_VAR(fieldSql);
+ ZVAL_NULL(fieldSql);
+
+
+ if (Z_TYPE_P(expression) == IS_ARRAY) {
+ ZEPHIR_INIT_VAR(fields);
+ array_init(fields);
+ zephir_is_iterable(expression, &_1, &_0, 0, 0, "phalcon/db/dialect.zep", 798);
+ for (
+ ; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
+ ; zephir_hash_move_forward_ex(_1, &_0)
+ ) {
+ ZEPHIR_GET_HVALUE(filed, _2);
+ if (unlikely(Z_TYPE_P(filed) != IS_ARRAY)) {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Invalid SQL-ORDER-BY expression", "phalcon/db/dialect.zep", 783);
+ return;
+ } else {
+ zephir_array_fetch_long(&_3, filed, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 785 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&fieldSql, this_ptr, "getsqlexpression", &_4, _3, escapeChar);
+ zephir_check_call_status();
+ }
+ ZEPHIR_OBS_NVAR(type);
+ _5 = zephir_array_isset_long_fetch(&type, filed, 1, 0 TSRMLS_CC);
+ if (_5) {
+ _5 = !ZEPHIR_IS_STRING(type, "");
+ }
+ if (_5) {
+ ZEPHIR_INIT_LNVAR(_6);
+ ZEPHIR_CONCAT_SV(_6, " ", type);
+ zephir_concat_self(&fieldSql, _6 TSRMLS_CC);
+ }
+ zephir_array_append(&fields, fieldSql, PH_SEPARATE, "phalcon/db/dialect.zep", 795);
+ }
+ ZEPHIR_INIT_VAR(_7);
+ zephir_fast_join_str(_7, SL(", "), fields TSRMLS_CC);
+ ZEPHIR_CPY_WRT(fields, _7);
+ } else {
+ ZEPHIR_CPY_WRT(fields, expression);
+ }
+ ZEPHIR_CONCAT_SV(return_value, "ORDER BY ", fields);
+ RETURN_MM();
+
+}
+
+/**
+ * Resolve a LIMIT clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit) {
+
+ zval *_5;
+ zend_bool _3;
+ zephir_fcall_cache_entry *_2 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *escapeChar = NULL;
+ zval *expression, *escapeChar_param = NULL, *sql = NULL, *value, *limit = NULL, *offset = NULL, *_0, *_1, *_4 = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &expression, &escapeChar_param);
+
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+ ZEPHIR_INIT_VAR(sql);
+ ZVAL_STRING(sql, "", 1);
+ ZEPHIR_INIT_VAR(offset);
+ ZVAL_NULL(offset);
+
+
+ ZEPHIR_OBS_VAR(value);
+ zephir_array_fetch_string(&value, expression, SL("value"), PH_NOISY, "phalcon/db/dialect.zep", 813 TSRMLS_CC);
+ if (zephir_array_isset_string(expression, SS("sql"))) {
+ ZEPHIR_OBS_NVAR(sql);
+ zephir_array_fetch_string(&sql, expression, SL("sql"), PH_NOISY, "phalcon/db/dialect.zep", 816 TSRMLS_CC);
+ }
+ if (Z_TYPE_P(value) == IS_ARRAY) {
+ ZEPHIR_OBS_VAR(_0);
+ zephir_array_fetch_string(&_0, value, SL("number"), PH_NOISY, "phalcon/db/dialect.zep", 821 TSRMLS_CC);
+ if (Z_TYPE_P(_0) == IS_ARRAY) {
+ zephir_array_fetch_string(&_1, value, SL("number"), PH_NOISY | PH_READONLY, "phalcon/db/dialect.zep", 822 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&limit, this_ptr, "getsqlexpression", &_2, _1);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_OBS_NVAR(limit);
+ zephir_array_fetch_string(&limit, value, SL("number"), PH_NOISY, "phalcon/db/dialect.zep", 824 TSRMLS_CC);
+ }
+ ZEPHIR_OBS_NVAR(offset);
+ _3 = zephir_array_isset_string_fetch(&offset, value, SS("offset"), 0 TSRMLS_CC);
+ if (_3) {
+ _3 = Z_TYPE_P(offset) == IS_ARRAY;
+ }
+ if (_3) {
+ ZEPHIR_CALL_METHOD(&_4, this_ptr, "getsqlexpression", &_2, offset);
+ zephir_check_call_status();
+ ZEPHIR_CPY_WRT(offset, _4);
+ }
+ } else {
+ ZEPHIR_CPY_WRT(limit, value);
+ }
+ ZEPHIR_INIT_VAR(_5);
+ zephir_create_array(_5, 2, 0 TSRMLS_CC);
+ zephir_array_fast_append(_5, limit);
+ zephir_array_fast_append(_5, offset);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "limit", NULL, sql, _5);
+ zephir_check_call_status();
+ RETURN_MM();
+
+}
+
+/**
+ * Prepares column for this RDBMS
+ */
+PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *qualified_param = NULL, *alias_param = NULL, *_0 = NULL;
+ zval *qualified = NULL, *alias = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &qualified_param, &alias_param);
+
+ if (unlikely(Z_TYPE_P(qualified_param) != IS_STRING && Z_TYPE_P(qualified_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'qualified' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(qualified_param) == IS_STRING)) {
+ zephir_get_strval(qualified, qualified_param);
+ } else {
+ ZEPHIR_INIT_VAR(qualified);
+ ZVAL_EMPTY_STRING(qualified);
+ }
+ if (!alias_param) {
+ ZEPHIR_INIT_VAR(alias);
+ ZVAL_EMPTY_STRING(alias);
+ } else {
+ zephir_get_strval(alias, alias_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(alias, "")) {
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", &_1, alias);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_VSV(return_value, qualified, " AS ", _0);
+ RETURN_MM();
+ } else {
+ RETURN_CTOR(qualified);
+ }
+
+}
+
+/**
+ * Prepares table for this RDBMS
+ */
+PHP_METHOD(Phalcon_Db_Dialect, prepareTable) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *table_param = NULL, *schema_param = NULL, *alias_param = NULL, *escapeChar_param = NULL, *_0 = NULL, *_2 = NULL, *_3 = NULL;
+ zval *table = NULL, *schema = NULL, *alias = NULL, *escapeChar = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 3, &table_param, &schema_param, &alias_param, &escapeChar_param);
+
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
+ }
+ if (!alias_param) {
+ ZEPHIR_INIT_VAR(alias);
+ ZVAL_EMPTY_STRING(alias);
+ } else {
+ zephir_get_strval(alias, alias_param);
+ }
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", &_1, table, escapeChar);
+ zephir_check_call_status();
+ zephir_get_strval(table, _0);
+ if (!ZEPHIR_IS_STRING(schema, "")) {
+ ZEPHIR_CALL_METHOD(&_2, this_ptr, "escape", &_1, schema, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_3);
+ ZEPHIR_CONCAT_VSV(_3, _2, ".", table);
+ zephir_get_strval(table, _3);
+ }
+ if (!ZEPHIR_IS_STRING(alias, "")) {
+ ZEPHIR_CALL_METHOD(&_2, this_ptr, "escape", &_1, alias, escapeChar);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_3);
+ ZEPHIR_CONCAT_VSV(_3, table, " AS ", _2);
+ zephir_get_strval(table, _3);
+ }
+ RETURN_CTOR(table);
+
+}
+
+/**
+ * Prepares qualified for this RDBMS
+ */
+PHP_METHOD(Phalcon_Db_Dialect, prepareQualified) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *column_param = NULL, *domain_param = NULL, *escapeChar_param = NULL;
+ zval *column = NULL, *domain = NULL, *escapeChar = NULL, *_0;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 2, &column_param, &domain_param, &escapeChar_param);
+
+ if (unlikely(Z_TYPE_P(column_param) != IS_STRING && Z_TYPE_P(column_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'column' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(column_param) == IS_STRING)) {
+ zephir_get_strval(column, column_param);
+ } else {
+ ZEPHIR_INIT_VAR(column);
+ ZVAL_EMPTY_STRING(column);
+ }
+ if (!domain_param) {
+ ZEPHIR_INIT_VAR(domain);
+ ZVAL_EMPTY_STRING(domain);
+ } else {
+ zephir_get_strval(domain, domain_param);
+ }
+ if (!escapeChar_param) {
+ ZEPHIR_INIT_VAR(escapeChar);
+ ZVAL_EMPTY_STRING(escapeChar);
+ } else {
+ zephir_get_strval(escapeChar, escapeChar_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(domain, "")) {
+ ZEPHIR_INIT_VAR(_0);
+ ZEPHIR_CONCAT_VSV(_0, domain, ".", column);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", &_1, _0, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ } else {
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "escape", &_1, column, escapeChar);
+ zephir_check_call_status();
+ RETURN_MM();
+ }
+
+}
+
diff --git a/ext/phalcon/db/dialect.zep.h b/ext/phalcon/db/dialect.zep.h
index 56ed82fca48..9fc4d1be0ef 100644
--- a/ext/phalcon/db/dialect.zep.h
+++ b/ext/phalcon/db/dialect.zep.h
@@ -3,10 +3,12 @@ extern zend_class_entry *phalcon_db_dialect_ce;
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect);
+PHP_METHOD(Phalcon_Db_Dialect, escape);
PHP_METHOD(Phalcon_Db_Dialect, limit);
PHP_METHOD(Phalcon_Db_Dialect, forUpdate);
PHP_METHOD(Phalcon_Db_Dialect, sharedLock);
PHP_METHOD(Phalcon_Db_Dialect, getColumnList);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlColumn);
PHP_METHOD(Phalcon_Db_Dialect, getSqlExpression);
PHP_METHOD(Phalcon_Db_Dialect, getSqlTable);
PHP_METHOD(Phalcon_Db_Dialect, select);
@@ -15,6 +17,31 @@ PHP_METHOD(Phalcon_Db_Dialect, supportsReleaseSavepoints);
PHP_METHOD(Phalcon_Db_Dialect, createSavepoint);
PHP_METHOD(Phalcon_Db_Dialect, releaseSavepoint);
PHP_METHOD(Phalcon_Db_Dialect, rollbackSavepoint);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionScalar);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionObject);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionQualified);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFunctionCall);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionList);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionAll);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionCastValue);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionConvertValue);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionFrom);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionJoins);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionWhere);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionGroupBy);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionHaving);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionOrderBy);
+PHP_METHOD(Phalcon_Db_Dialect, getSqlExpressionLimit);
+PHP_METHOD(Phalcon_Db_Dialect, prepareColumnAlias);
+PHP_METHOD(Phalcon_Db_Dialect, prepareTable);
+PHP_METHOD(Phalcon_Db_Dialect, prepareQualified);
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_escape, 0, 0, 1)
+ ZEND_ARG_INFO(0, str)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_limit, 0, 0, 2)
ZEND_ARG_INFO(0, sqlQuery)
@@ -33,6 +60,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getcolumnlist, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, columnList, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlcolumn, 0, 0, 1)
+ ZEND_ARG_INFO(0, column)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpression, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, expression, 0)
ZEND_ARG_INFO(0, escapeChar)
@@ -59,11 +90,116 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_rollbacksavepoint, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionscalar, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionobject, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionqualified, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionbinaryoperations, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionunaryoperations, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfunctioncall, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlist, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionall, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressioncastvalue, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionconvertvalue, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, expression, 0)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionfrom, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionjoins, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionwhere, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressiongroupby, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionhaving, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionorderby, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_getsqlexpressionlimit, 0, 0, 1)
+ ZEND_ARG_INFO(0, expression)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_preparecolumnalias, 0, 0, 1)
+ ZEND_ARG_INFO(0, qualified)
+ ZEND_ARG_INFO(0, alias)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_preparetable, 0, 0, 1)
+ ZEND_ARG_INFO(0, table)
+ ZEND_ARG_INFO(0, schema)
+ ZEND_ARG_INFO(0, alias)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_preparequalified, 0, 0, 1)
+ ZEND_ARG_INFO(0, column)
+ ZEND_ARG_INFO(0, domain)
+ ZEND_ARG_INFO(0, escapeChar)
+ZEND_END_ARG_INFO()
+
ZEPHIR_INIT_FUNCS(phalcon_db_dialect_method_entry) {
+ PHP_ME(Phalcon_Db_Dialect, escape, arginfo_phalcon_db_dialect_escape, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Db_Dialect, limit, arginfo_phalcon_db_dialect_limit, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, forUpdate, arginfo_phalcon_db_dialect_forupdate, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, sharedLock, arginfo_phalcon_db_dialect_sharedlock, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, getColumnList, arginfo_phalcon_db_dialect_getcolumnlist, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlColumn, arginfo_phalcon_db_dialect_getsqlcolumn, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Db_Dialect, getSqlExpression, arginfo_phalcon_db_dialect_getsqlexpression, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, getSqlTable, arginfo_phalcon_db_dialect_getsqltable, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Db_Dialect, select, arginfo_phalcon_db_dialect_select, ZEND_ACC_PUBLIC)
@@ -72,5 +208,25 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialect_method_entry) {
PHP_ME(Phalcon_Db_Dialect, createSavepoint, arginfo_phalcon_db_dialect_createsavepoint, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, releaseSavepoint, arginfo_phalcon_db_dialect_releasesavepoint, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect, rollbackSavepoint, arginfo_phalcon_db_dialect_rollbacksavepoint, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionScalar, arginfo_phalcon_db_dialect_getsqlexpressionscalar, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionObject, arginfo_phalcon_db_dialect_getsqlexpressionobject, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionQualified, arginfo_phalcon_db_dialect_getsqlexpressionqualified, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionBinaryOperations, arginfo_phalcon_db_dialect_getsqlexpressionbinaryoperations, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionUnaryOperations, arginfo_phalcon_db_dialect_getsqlexpressionunaryoperations, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionFunctionCall, arginfo_phalcon_db_dialect_getsqlexpressionfunctioncall, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionList, arginfo_phalcon_db_dialect_getsqlexpressionlist, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionAll, arginfo_phalcon_db_dialect_getsqlexpressionall, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionCastValue, arginfo_phalcon_db_dialect_getsqlexpressioncastvalue, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionConvertValue, arginfo_phalcon_db_dialect_getsqlexpressionconvertvalue, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionFrom, arginfo_phalcon_db_dialect_getsqlexpressionfrom, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionJoins, arginfo_phalcon_db_dialect_getsqlexpressionjoins, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionWhere, arginfo_phalcon_db_dialect_getsqlexpressionwhere, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionGroupBy, arginfo_phalcon_db_dialect_getsqlexpressiongroupby, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionHaving, arginfo_phalcon_db_dialect_getsqlexpressionhaving, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionOrderBy, arginfo_phalcon_db_dialect_getsqlexpressionorderby, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, getSqlExpressionLimit, arginfo_phalcon_db_dialect_getsqlexpressionlimit, ZEND_ACC_PROTECTED|ZEND_ACC_FINAL)
+ PHP_ME(Phalcon_Db_Dialect, prepareColumnAlias, arginfo_phalcon_db_dialect_preparecolumnalias, ZEND_ACC_PROTECTED)
+ PHP_ME(Phalcon_Db_Dialect, prepareTable, arginfo_phalcon_db_dialect_preparetable, ZEND_ACC_PROTECTED)
+ PHP_ME(Phalcon_Db_Dialect, prepareQualified, arginfo_phalcon_db_dialect_preparequalified, ZEND_ACC_PROTECTED)
PHP_FE_END
};
diff --git a/ext/phalcon/db/dialect/mysql.zep.c b/ext/phalcon/db/dialect/mysql.zep.c
index 02384d8f47f..df0dbec487f 100644
--- a/ext/phalcon/db/dialect/mysql.zep.c
+++ b/ext/phalcon/db/dialect/mysql.zep.c
@@ -26,7 +26,7 @@
/**
* Phalcon\Db\Dialect\Mysql
*
- * Generates database specific SQL for the MySQL RBDM
+ * Generates database specific SQL for the MySQL RDBMS
*/
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_MySQL) {
@@ -34,7 +34,6 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_MySQL) {
zend_declare_property_string(phalcon_db_dialect_mysql_ce, SL("_escapeChar"), "`", ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_class_implements(phalcon_db_dialect_mysql_ce TSRMLS_CC, 1, phalcon_db_dialectinterface_ce);
return SUCCESS;
}
@@ -415,7 +414,17 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropColumn) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
}
- zephir_get_strval(columnName, columnName_param);
+ if (unlikely(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(columnName_param) == IS_STRING)) {
+ zephir_get_strval(columnName, columnName_param);
+ } else {
+ ZEPHIR_INIT_VAR(columnName);
+ ZVAL_EMPTY_STRING(columnName);
+ }
ZEPHIR_INIT_VAR(sql);
@@ -580,8 +589,28 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, addPrimaryKey) {
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
- zephir_get_strval(tableName, tableName_param);
- zephir_get_strval(schemaName, schemaName_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);
+ }
ZEPHIR_INIT_VAR(sql);
@@ -746,19 +775,14 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, addForeignKey) {
/**
* Generates SQL to delete a foreign key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string referenceName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropForeignKey) {
- zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName, *sql = NULL;
- zval *tableName = NULL, *schemaName = NULL, *_0 = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL, *sql = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *referenceName = NULL, *_0 = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName);
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_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);
@@ -782,6 +806,17 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropForeignKey) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
}
+ if (unlikely(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(referenceName_param) == IS_STRING)) {
+ zephir_get_strval(referenceName, referenceName_param);
+ } else {
+ ZEPHIR_INIT_VAR(referenceName);
+ ZVAL_EMPTY_STRING(referenceName);
+ }
ZEPHIR_INIT_VAR(sql);
@@ -800,65 +835,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropForeignKey) {
}
/**
- * Generates SQL to add the table creation options
- *
- * @param array definition
- * @return array
- */
-PHP_METHOD(Phalcon_Db_Dialect_MySQL, _getTableOptions) {
-
- zval *definition, *options, *engine, *autoIncrement, *tableCollation, *collationParts, *tableOptions, *_0 = NULL, *_1, *_2;
-
- ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 0, &definition);
-
-
-
- ZEPHIR_OBS_VAR(options);
- if (zephir_array_isset_string_fetch(&options, definition, SS("options"), 0 TSRMLS_CC)) {
- ZEPHIR_INIT_VAR(tableOptions);
- array_init(tableOptions);
- ZEPHIR_OBS_VAR(engine);
- if (zephir_array_isset_string_fetch(&engine, options, SS("ENGINE"), 0 TSRMLS_CC)) {
- if (zephir_is_true(engine)) {
- ZEPHIR_INIT_VAR(_0);
- ZEPHIR_CONCAT_SV(_0, "ENGINE=", engine);
- zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 382);
- }
- }
- ZEPHIR_OBS_VAR(autoIncrement);
- if (zephir_array_isset_string_fetch(&autoIncrement, options, SS("AUTO_INCREMENT"), 0 TSRMLS_CC)) {
- if (zephir_is_true(autoIncrement)) {
- ZEPHIR_INIT_LNVAR(_0);
- ZEPHIR_CONCAT_SV(_0, "AUTO_INCREMENT=", autoIncrement);
- zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 391);
- }
- }
- ZEPHIR_OBS_VAR(tableCollation);
- if (zephir_array_isset_string_fetch(&tableCollation, options, SS("TABLE_COLLATION"), 0 TSRMLS_CC)) {
- if (zephir_is_true(tableCollation)) {
- ZEPHIR_INIT_VAR(collationParts);
- zephir_fast_explode_str(collationParts, SL("_"), tableCollation, LONG_MAX TSRMLS_CC);
- zephir_array_fetch_long(&_1, collationParts, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/mysql.zep", 401 TSRMLS_CC);
- ZEPHIR_INIT_LNVAR(_0);
- ZEPHIR_CONCAT_SV(_0, "DEFAULT CHARSET=", _1);
- zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 401);
- ZEPHIR_INIT_VAR(_2);
- ZEPHIR_CONCAT_SV(_2, "COLLATE=", tableCollation);
- zephir_array_append(&tableOptions, _2, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 402);
- }
- }
- if (zephir_fast_count_int(tableOptions TSRMLS_CC)) {
- zephir_fast_join_str(return_value, SL(" "), tableOptions TSRMLS_CC);
- RETURN_MM();
- }
- }
- RETURN_MM_STRING("", 1);
-
-}
-
-/**
- * Generates SQL to create a table in MySQL
+ * Generates SQL to create a table
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
@@ -902,7 +879,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
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/mysql.zep", 425);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'columns' is required in the definition array", "phalcon/db/dialect/mysql.zep", 368);
return;
}
ZEPHIR_INIT_VAR(table);
@@ -930,7 +907,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
}
ZEPHIR_INIT_VAR(createLines);
array_init(createLines);
- zephir_is_iterable(columns, &_2, &_1, 0, 0, "phalcon/db/dialect/mysql.zep", 488);
+ zephir_is_iterable(columns, &_2, &_1, 0, 0, "phalcon/db/dialect/mysql.zep", 431);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -968,11 +945,11 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
if (zephir_is_true(_8)) {
zephir_concat_self_str(&columnLine, SL(" PRIMARY KEY") TSRMLS_CC);
}
- zephir_array_append(&createLines, columnLine, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 482);
+ zephir_array_append(&createLines, columnLine, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 425);
}
ZEPHIR_OBS_VAR(indexes);
if (zephir_array_isset_string_fetch(&indexes, definition, SS("indexes"), 0 TSRMLS_CC)) {
- zephir_is_iterable(indexes, &_12, &_11, 0, 0, "phalcon/db/dialect/mysql.zep", 510);
+ zephir_is_iterable(indexes, &_12, &_11, 0, 0, "phalcon/db/dialect/mysql.zep", 453);
for (
; zephir_hash_get_current_data_ex(_12, (void**) &_13, &_11) == SUCCESS
; zephir_hash_move_forward_ex(_12, &_11)
@@ -1005,12 +982,12 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
ZEPHIR_CONCAT_SVSVS(indexSql, "KEY `", indexName, "` (", _15, ")");
}
}
- zephir_array_append(&createLines, indexSql, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 508);
+ zephir_array_append(&createLines, indexSql, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 451);
}
}
ZEPHIR_OBS_VAR(references);
if (zephir_array_isset_string_fetch(&references, definition, SS("references"), 0 TSRMLS_CC)) {
- zephir_is_iterable(references, &_18, &_17, 0, 0, "phalcon/db/dialect/mysql.zep", 532);
+ zephir_is_iterable(references, &_18, &_17, 0, 0, "phalcon/db/dialect/mysql.zep", 475);
for (
; zephir_hash_get_current_data_ex(_18, (void**) &_19, &_17) == SUCCESS
; zephir_hash_move_forward_ex(_18, &_17)
@@ -1044,7 +1021,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
ZEPHIR_CONCAT_SV(_21, " ON UPDATE ", onUpdate);
zephir_concat_self(&referenceSql, _21 TSRMLS_CC);
}
- zephir_array_append(&createLines, referenceSql, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 530);
+ zephir_array_append(&createLines, referenceSql, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 473);
}
}
ZEPHIR_INIT_VAR(_22);
@@ -1065,19 +1042,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable) {
/**
* Generates SQL to drop a table
- *
- * @param string tableName
- * @param string schemaName
- * @param boolean ifExists
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropTable) {
- zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists = NULL, *sql, *table = NULL;
+ zend_bool ifExists;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *sql, *table = NULL;
zval *tableName = NULL, *schemaName = NULL, *_0 = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &tableName_param, &schemaName_param, &ifExists);
+ zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param);
if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
@@ -1090,19 +1063,21 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropTable) {
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 {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
- if (!ifExists) {
- ifExists = ZEPHIR_GLOBAL(global_true);
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ ifExists = Z_BVAL_P(ifExists_param);
}
@@ -1117,7 +1092,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropTable) {
ZEPHIR_CPY_WRT(table, _0);
}
ZEPHIR_INIT_VAR(sql);
- if (zephir_is_true(ifExists)) {
+ if (ifExists) {
ZEPHIR_CONCAT_SV(sql, "DROP TABLE IF EXISTS ", table);
} else {
ZEPHIR_CONCAT_SV(sql, "DROP TABLE ", table);
@@ -1128,19 +1103,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropTable) {
/**
* Generates SQL to create a view
- *
- * @param string viewName
- * @param array definition
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, createView) {
- zval *viewName_param = NULL, *definition, *schemaName_param = NULL, *view = NULL, *viewSql;
+ zval *definition = NULL;
+ zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, *view = NULL, *viewSql;
zval *viewName = NULL, *schemaName = NULL, *_0 = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 3, 0, &viewName_param, &definition, &schemaName_param);
+ zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -1153,22 +1124,19 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, createView) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
- zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
- RETURN_MM_NULL();
- }
+ definition = definition_param;
- if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
- zephir_get_strval(schemaName, schemaName_param);
- } else {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
ZEPHIR_OBS_VAR(viewSql);
if (!(zephir_array_isset_string_fetch(&viewSql, definition, SS("sql"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/mysql.zep", 582);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/mysql.zep", 515);
return;
}
ZEPHIR_INIT_VAR(view);
@@ -1196,7 +1164,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropView) {
zval *viewName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &viewName_param, &schemaName_param, &ifExists_param);
+ zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -1209,21 +1177,21 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropView) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
- zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
- RETURN_MM_NULL();
- }
-
- if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
- zephir_get_strval(schemaName, schemaName_param);
- } else {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
if (!ifExists_param) {
ifExists = 1;
} else {
- ifExists = zephir_get_boolval(ifExists_param);
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ ifExists = Z_BVAL_P(ifExists_param);
}
@@ -1248,21 +1216,17 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropView) {
* Generates SQL checking for the existence of a schema.table
*
*
- * echo $dialect->tableExists("posts", "blog");
- * echo $dialect->tableExists("posts");
+ * echo $dialect->tableExists("posts", "blog");
+ * echo $dialect->tableExists("posts");
*
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableExists) {
- zval *tableName_param = NULL, *schemaName = NULL;
- zval *tableName = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName);
+ zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_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);
@@ -1275,12 +1239,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableExists) {
ZEPHIR_INIT_VAR(tableName);
ZVAL_EMPTY_STRING(tableName);
}
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
- if (zephir_is_true(schemaName)) {
+ if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SELECT IF(COUNT(*)>0, 1 , 0) FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_NAME`= '", tableName, "' AND `TABLE_SCHEMA` = '", schemaName, "'");
RETURN_MM();
}
@@ -1291,18 +1258,14 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableExists) {
/**
* Generates SQL checking for the existence of a schema.view
- *
- * @param string viewName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, viewExists) {
- zval *viewName_param = NULL, *schemaName = NULL;
- zval *viewName = NULL;
+ zval *viewName_param = NULL, *schemaName_param = NULL;
+ zval *viewName = NULL, *schemaName = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName);
+ zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -1315,12 +1278,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, viewExists) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
- if (zephir_is_true(schemaName)) {
+ if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SELECT IF(COUNT(*)>0, 1 , 0) FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_NAME`= '", viewName, "' AND `TABLE_SCHEMA`='", schemaName, "'");
RETURN_MM();
}
@@ -1332,21 +1298,17 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, viewExists) {
/**
* Generates SQL describing a table
*
- *
- * print_r($dialect->describeColumns("posts"));
- *
- *
- * @param string table
- * @param string schema
- * @return string
+ *
+ * print_r($dialect->describeColumns("posts"));
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeColumns) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1359,12 +1321,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeColumns) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_CONCAT_SVSVS(return_value, "DESCRIBE `", schema, "`.`", table, "`");
RETURN_MM();
}
@@ -1376,9 +1341,9 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeColumns) {
/**
* List all tables in database
*
- *
- * print_r($dialect->listTables("blog"))
- *
+ *
+ * print_r($dialect->listTables("blog"))
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, listTables) {
@@ -1392,17 +1357,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, listTables) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
} else {
- 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);
- }
}
@@ -1453,18 +1408,14 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, listViews) {
/**
* Generates SQL to query indexes on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeIndexes) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1477,12 +1428,15 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeIndexes) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SHOW INDEXES FROM `", schema, "`.`", table, "`");
RETURN_MM();
}
@@ -1493,18 +1447,14 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeIndexes) {
/**
* Generates SQL to query foreign keys on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeReferences) {
- zval *table_param = NULL, *schema = NULL, *sql, *_0;
- zval *table = NULL, *_1;
+ zval *table_param = NULL, *schema_param = NULL, *sql;
+ zval *table = NULL, *schema = NULL, *_0 = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1517,21 +1467,24 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeReferences) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
ZEPHIR_INIT_VAR(sql);
ZVAL_STRING(sql, "SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,REFERENCED_TABLE_SCHEMA,REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME IS NOT NULL AND ", 1);
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_INIT_VAR(_0);
ZEPHIR_CONCAT_SVSVS(_0, "CONSTRAINT_SCHEMA = '", schema, "' AND TABLE_NAME = '", table, "'");
zephir_concat_self(&sql, _0 TSRMLS_CC);
} else {
- ZEPHIR_INIT_VAR(_1);
- ZEPHIR_CONCAT_SVS(_1, "TABLE_NAME = '", table, "'");
- zephir_concat_self(&sql, _1 TSRMLS_CC);
+ ZEPHIR_INIT_LNVAR(_0);
+ ZEPHIR_CONCAT_SVS(_0, "TABLE_NAME = '", table, "'");
+ zephir_concat_self(&sql, _0 TSRMLS_CC);
}
RETURN_CCTOR(sql);
@@ -1539,18 +1492,14 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeReferences) {
/**
* Generates the SQL to describe the table creation options
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableOptions) {
- zval *table_param = NULL, *schema = NULL, *sql;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL, *sql;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1563,14 +1512,17 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableOptions) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
ZEPHIR_INIT_VAR(sql);
ZVAL_STRING(sql, "SELECT TABLES.TABLE_TYPE AS table_type,TABLES.AUTO_INCREMENT AS auto_increment,TABLES.ENGINE AS engine,TABLES.TABLE_COLLATION AS table_collation FROM INFORMATION_SCHEMA.TABLES WHERE ", 1);
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_CONCAT_VSVSVS(return_value, sql, "TABLES.TABLE_SCHEMA = '", schema, "' AND TABLES.TABLE_NAME = '", table, "'");
RETURN_MM();
}
@@ -1579,3 +1531,61 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableOptions) {
}
+/**
+ * Generates SQL to add the table creation options
+ */
+PHP_METHOD(Phalcon_Db_Dialect_MySQL, _getTableOptions) {
+
+ zval *definition_param = NULL, *options, *engine, *autoIncrement, *tableCollation, *collationParts, *tableOptions, *_0 = NULL, *_1, *_2;
+ zval *definition = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 0, &definition_param);
+
+ definition = definition_param;
+
+
+
+ ZEPHIR_OBS_VAR(options);
+ if (zephir_array_isset_string_fetch(&options, definition, SS("options"), 0 TSRMLS_CC)) {
+ ZEPHIR_INIT_VAR(tableOptions);
+ array_init(tableOptions);
+ ZEPHIR_OBS_VAR(engine);
+ if (zephir_array_isset_string_fetch(&engine, options, SS("ENGINE"), 0 TSRMLS_CC)) {
+ if (zephir_is_true(engine)) {
+ ZEPHIR_INIT_VAR(_0);
+ ZEPHIR_CONCAT_SV(_0, "ENGINE=", engine);
+ zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 671);
+ }
+ }
+ ZEPHIR_OBS_VAR(autoIncrement);
+ if (zephir_array_isset_string_fetch(&autoIncrement, options, SS("AUTO_INCREMENT"), 0 TSRMLS_CC)) {
+ if (zephir_is_true(autoIncrement)) {
+ ZEPHIR_INIT_LNVAR(_0);
+ ZEPHIR_CONCAT_SV(_0, "AUTO_INCREMENT=", autoIncrement);
+ zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 680);
+ }
+ }
+ ZEPHIR_OBS_VAR(tableCollation);
+ if (zephir_array_isset_string_fetch(&tableCollation, options, SS("TABLE_COLLATION"), 0 TSRMLS_CC)) {
+ if (zephir_is_true(tableCollation)) {
+ ZEPHIR_INIT_VAR(collationParts);
+ zephir_fast_explode_str(collationParts, SL("_"), tableCollation, LONG_MAX TSRMLS_CC);
+ zephir_array_fetch_long(&_1, collationParts, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/mysql.zep", 690 TSRMLS_CC);
+ ZEPHIR_INIT_LNVAR(_0);
+ ZEPHIR_CONCAT_SV(_0, "DEFAULT CHARSET=", _1);
+ zephir_array_append(&tableOptions, _0, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 690);
+ ZEPHIR_INIT_VAR(_2);
+ ZEPHIR_CONCAT_SV(_2, "COLLATE=", tableCollation);
+ zephir_array_append(&tableOptions, _2, PH_SEPARATE, "phalcon/db/dialect/mysql.zep", 691);
+ }
+ }
+ if (zephir_fast_count_int(tableOptions TSRMLS_CC)) {
+ zephir_fast_join_str(return_value, SL(" "), tableOptions TSRMLS_CC);
+ RETURN_MM();
+ }
+ }
+ RETURN_MM_STRING("", 1);
+
+}
+
diff --git a/ext/phalcon/db/dialect/mysql.zep.h b/ext/phalcon/db/dialect/mysql.zep.h
index 12a1d99fc9c..0d1056084eb 100644
--- a/ext/phalcon/db/dialect/mysql.zep.h
+++ b/ext/phalcon/db/dialect/mysql.zep.h
@@ -13,7 +13,6 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, addPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, addForeignKey);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropForeignKey);
-PHP_METHOD(Phalcon_Db_Dialect_MySQL, _getTableOptions);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, createTable);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, dropTable);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, createView);
@@ -26,6 +25,7 @@ PHP_METHOD(Phalcon_Db_Dialect_MySQL, listViews);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeIndexes);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, describeReferences);
PHP_METHOD(Phalcon_Db_Dialect_MySQL, tableOptions);
+PHP_METHOD(Phalcon_Db_Dialect_MySQL, _getTableOptions);
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_getcolumndefinition, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0)
@@ -84,29 +84,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_dropforeignkey, 0, 0, 3)
ZEND_ARG_INFO(0, referenceName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql__gettableoptions, 0, 0, 1)
- ZEND_ARG_INFO(0, definition)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_createtable, 0, 0, 3)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_droptable, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_droptable, 0, 0, 1)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_createview, 0, 0, 3)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_createview, 0, 0, 2)
ZEND_ARG_INFO(0, viewName)
- ZEND_ARG_INFO(0, definition)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_ARG_INFO(0, schemaName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_dropview, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_dropview, 0, 0, 1)
ZEND_ARG_INFO(0, viewName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
@@ -150,6 +146,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql_tableoptions, 0, 0, 1)
ZEND_ARG_INFO(0, schema)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_mysql__gettableoptions, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
+ZEND_END_ARG_INFO()
+
ZEPHIR_INIT_FUNCS(phalcon_db_dialect_mysql_method_entry) {
PHP_ME(Phalcon_Db_Dialect_MySQL, getColumnDefinition, arginfo_phalcon_db_dialect_mysql_getcolumndefinition, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, addColumn, arginfo_phalcon_db_dialect_mysql_addcolumn, ZEND_ACC_PUBLIC)
@@ -161,7 +161,6 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialect_mysql_method_entry) {
PHP_ME(Phalcon_Db_Dialect_MySQL, dropPrimaryKey, arginfo_phalcon_db_dialect_mysql_dropprimarykey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, addForeignKey, arginfo_phalcon_db_dialect_mysql_addforeignkey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, dropForeignKey, arginfo_phalcon_db_dialect_mysql_dropforeignkey, ZEND_ACC_PUBLIC)
- PHP_ME(Phalcon_Db_Dialect_MySQL, _getTableOptions, arginfo_phalcon_db_dialect_mysql__gettableoptions, ZEND_ACC_PROTECTED)
PHP_ME(Phalcon_Db_Dialect_MySQL, createTable, arginfo_phalcon_db_dialect_mysql_createtable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, dropTable, arginfo_phalcon_db_dialect_mysql_droptable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, createView, arginfo_phalcon_db_dialect_mysql_createview, ZEND_ACC_PUBLIC)
@@ -174,5 +173,6 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialect_mysql_method_entry) {
PHP_ME(Phalcon_Db_Dialect_MySQL, describeIndexes, arginfo_phalcon_db_dialect_mysql_describeindexes, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, describeReferences, arginfo_phalcon_db_dialect_mysql_describereferences, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_MySQL, tableOptions, arginfo_phalcon_db_dialect_mysql_tableoptions, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_MySQL, _getTableOptions, arginfo_phalcon_db_dialect_mysql__gettableoptions, ZEND_ACC_PROTECTED)
PHP_FE_END
};
diff --git a/ext/phalcon/db/dialect/oracle.zep.c b/ext/phalcon/db/dialect/oracle.zep.c
index 6c67d19b90a..5bddf7f3dfa 100644
--- a/ext/phalcon/db/dialect/oracle.zep.c
+++ b/ext/phalcon/db/dialect/oracle.zep.c
@@ -12,16 +12,24 @@
#include
#include "kernel/main.h"
+#include "kernel/array.h"
+#include "kernel/memory.h"
+#include "kernel/string.h"
+#include "kernel/operators.h"
+#include "kernel/concat.h"
+#include "ext/spl/spl_exceptions.h"
+#include "kernel/exception.h"
+#include "kernel/fcall.h"
/**
* Phalcon\Db\Dialect\Oracle
*
- * Generates database specific SQL for the Oracle RBDM
+ * Generates database specific SQL for the Oracle RDBMS
*/
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Oracle) {
- ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Dialect, Oracle, phalcon, db_dialect_oracle, phalcon_db_dialect_ce, NULL, 0);
+ ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Db\\Dialect, Oracle, phalcon, db_dialect_oracle, phalcon_db_dialect_ce, phalcon_db_dialect_oracle_method_entry, 0);
zend_declare_property_string(phalcon_db_dialect_oracle_ce, SL("_escapeChar"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
@@ -29,3 +37,1127 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Oracle) {
}
+/**
+ * Generates the SQL for LIMIT clause
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit) {
+
+ int limit, offset = 0;
+ zval *sqlQuery_param = NULL, *number, *_0 = NULL, *_1, _2 = zval_used_for_init, *_3, _4 = zval_used_for_init, _6;
+ zval *sqlQuery = NULL, *_5, *_7;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 0, &sqlQuery_param, &number);
+
+ if (unlikely(Z_TYPE_P(sqlQuery_param) != IS_STRING && Z_TYPE_P(sqlQuery_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'sqlQuery' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(sqlQuery_param) == IS_STRING)) {
+ zephir_get_strval(sqlQuery, sqlQuery_param);
+ } else {
+ ZEPHIR_INIT_VAR(sqlQuery);
+ ZVAL_EMPTY_STRING(sqlQuery);
+ }
+
+
+ if (Z_TYPE_P(number) == IS_ARRAY) {
+ if (zephir_array_isset_long(number, 1)) {
+ ZEPHIR_INIT_VAR(_0);
+ zephir_array_fetch_long(&_1, number, 1, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 51 TSRMLS_CC);
+ ZEPHIR_SINIT_VAR(_2);
+ ZVAL_STRING(&_2, "'", 0);
+ zephir_fast_trim(_0, _1, &_2, ZEPHIR_TRIM_BOTH TSRMLS_CC);
+ offset = zephir_get_intval(_0);
+ }
+ ZEPHIR_INIT_NVAR(_0);
+ zephir_array_fetch_long(&_1, number, 0, PH_NOISY | PH_READONLY, "phalcon/db/dialect/oracle.zep", 54 TSRMLS_CC);
+ ZEPHIR_SINIT_NVAR(_2);
+ ZVAL_STRING(&_2, "'", 0);
+ zephir_fast_trim(_0, _1, &_2, ZEPHIR_TRIM_BOTH TSRMLS_CC);
+ limit = (zephir_get_intval(_0) + offset);
+ } else {
+ ZEPHIR_INIT_VAR(_3);
+ ZEPHIR_SINIT_VAR(_4);
+ ZVAL_STRING(&_4, "'", 0);
+ zephir_fast_trim(_3, number, &_4, ZEPHIR_TRIM_BOTH TSRMLS_CC);
+ limit = zephir_get_intval(_3);
+ }
+ ZEPHIR_SINIT_NVAR(_4);
+ ZVAL_LONG(&_4, limit);
+ ZEPHIR_INIT_VAR(_5);
+ ZEPHIR_CONCAT_SVSVS(_5, "SELECT * FROM (SELECT Z1.*, ROWNUM PHALCON_RN FROM (", sqlQuery, ") Z1 WHERE ROWNUM <= ", &_4, ")");
+ ZEPHIR_CPY_WRT(sqlQuery, _5);
+ if (offset != 0) {
+ ZEPHIR_SINIT_VAR(_6);
+ ZVAL_LONG(&_6, offset);
+ ZEPHIR_INIT_VAR(_7);
+ ZEPHIR_CONCAT_SV(_7, " WHERE PHALCON_RN >= ", &_6);
+ zephir_concat_self(&sqlQuery, _7 TSRMLS_CC);
+ }
+ RETURN_CTOR(sqlQuery);
+
+}
+
+/**
+ * Gets the column name in Oracle
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, getColumnDefinition) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *column, *columnSql = NULL, *size = NULL, *scale = NULL, *type = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 0, &column);
+
+
+
+ ZEPHIR_CALL_METHOD(&type, column, "gettype", NULL);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&size, column, "getsize", NULL);
+ zephir_check_call_status();
+ do {
+ if (ZEPHIR_IS_LONG(type, 0)) {
+ ZEPHIR_INIT_VAR(columnSql);
+ ZVAL_STRING(columnSql, "INTEGER", 1);
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 1)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZVAL_STRING(columnSql, "DATE", 1);
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 2)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZEPHIR_CONCAT_SVS(columnSql, "VARCHAR2(", size, ")");
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 3)) {
+ ZEPHIR_CALL_METHOD(&scale, column, "getscale", NULL);
+ zephir_check_call_status();
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZEPHIR_CONCAT_SVSVS(columnSql, "NUMBER(", size, ",", scale, ")");
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 4)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZVAL_STRING(columnSql, "TIMESTAMP", 1);
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 5)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZEPHIR_CONCAT_SVS(columnSql, "CHAR(", size, ")");
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 6)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZVAL_STRING(columnSql, "TEXT", 1);
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 7)) {
+ ZEPHIR_CALL_METHOD(&scale, column, "getscale", NULL);
+ zephir_check_call_status();
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZEPHIR_CONCAT_SVSVS(columnSql, "FLOAT(", size, ",", scale, ")");
+ break;
+ }
+ if (ZEPHIR_IS_LONG(type, 8)) {
+ ZEPHIR_INIT_NVAR(columnSql);
+ ZVAL_STRING(columnSql, "TINYINT(1)", 1);
+ break;
+ }
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Unrecognized Oracle data type", "phalcon/db/dialect/oracle.zep", 120);
+ return;
+ } while(0);
+
+ RETURN_CCTOR(columnSql);
+
+}
+
+/**
+ * Generates SQL to add a column to a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addColumn) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *column;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);
+
+ 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);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 131);
+ return;
+
+}
+
+/**
+ * Generates SQL to modify a column in a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, modifyColumn) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *column;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);
+
+ 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);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 139);
+ return;
+
+}
+
+/**
+ * Generates SQL to delete a column from a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropColumn) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *columnName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_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);
+ }
+ zephir_get_strval(columnName, columnName_param);
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 147);
+ return;
+
+}
+
+/**
+ * Generates SQL to add an index to a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addIndex) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *index;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
+
+ 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);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 155);
+ return;
+
+}
+
+/**
+ /**
+ * Generates SQL to delete an index from a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropIndex) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *indexName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param);
+
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (unlikely(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(indexName_param) == IS_STRING)) {
+ zephir_get_strval(indexName, indexName_param);
+ } else {
+ ZEPHIR_INIT_VAR(indexName);
+ ZVAL_EMPTY_STRING(indexName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 164);
+ return;
+
+}
+
+/**
+ * Generates SQL to add the primary key to a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addPrimaryKey) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *index;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
+
+ zephir_get_strval(tableName, tableName_param);
+ zephir_get_strval(schemaName, schemaName_param);
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 172);
+ return;
+
+}
+
+/**
+ * Generates SQL to delete primary key from a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropPrimaryKey) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_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);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 180);
+ return;
+
+}
+
+/**
+ * Generates SQL to add an index to a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addForeignKey) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *reference;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference);
+
+ 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);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 188);
+ return;
+
+}
+
+/**
+ * Generates SQL to delete a foreign key from a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropForeignKey) {
+
+ zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *referenceName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param);
+
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (unlikely(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(referenceName_param) == IS_STRING)) {
+ zephir_get_strval(referenceName, referenceName_param);
+ } else {
+ ZEPHIR_INIT_VAR(referenceName);
+ ZVAL_EMPTY_STRING(referenceName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 196);
+ return;
+
+}
+
+/**
+ * Generates SQL to create a table in Oracle
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, createTable) {
+
+ zval *definition = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = 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_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/oracle.zep", 204);
+ return;
+
+}
+
+/**
+ * Generates SQL to drop a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropTable) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL;
+ zend_bool ifExists;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *table = NULL, *_0 = NULL, *_1 = NULL, *_4 = NULL, *_5 = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 1, &tableName_param, &schemaName_param, &ifExists_param);
+
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ ifExists = Z_BVAL_P(ifExists_param);
+ }
+
+
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_CALL_CE_STATIC(&_1, phalcon_text_ce, "upper", &_2, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "escape", &_3, _1);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_5, phalcon_text_ce, "upper", &_2, tableName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&_4, this_ptr, "escape", &_3, _5);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(table);
+ ZEPHIR_CONCAT_VSV(table, _0, ".", _4);
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_2, tableName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&table, this_ptr, "escape", &_3, _0);
+ zephir_check_call_status();
+ }
+ if (ifExists) {
+ ZEPHIR_CONCAT_SV(return_value, "DROP TABLE IF EXISTS ", table);
+ RETURN_MM();
+ } else {
+ ZEPHIR_CONCAT_SV(return_value, "DROP TABLE ", table);
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * Generates SQL to create a view
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, createView) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL;
+ zval *definition = NULL;
+ zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, *view = NULL, *viewSql, *_0 = NULL, *_2 = NULL, *_3;
+ zval *viewName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param);
+
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ definition = definition_param;
+
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+
+
+ ZEPHIR_OBS_VAR(viewSql);
+ if (!(zephir_array_isset_string_fetch(&viewSql, definition, SS("sql"), 0 TSRMLS_CC))) {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/oracle.zep", 235);
+ return;
+ }
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_3);
+ ZEPHIR_CONCAT_VSV(_3, _0, ".", _2);
+ ZEPHIR_CALL_METHOD(&view, this_ptr, "escape", &_4, _3);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&view, this_ptr, "escape", &_4, _0);
+ zephir_check_call_status();
+ }
+ ZEPHIR_CONCAT_SVSV(return_value, "CREATE VIEW ", view, " AS ", viewSql);
+ RETURN_MM();
+
+}
+
+/**
+ * Generates SQL to drop a view
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropView) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL;
+ zend_bool ifExists;
+ zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *view = NULL, *_0 = NULL, *_2 = NULL, *_3;
+ zval *viewName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param);
+
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ ifExists = Z_BVAL_P(ifExists_param);
+ }
+
+
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_3);
+ ZEPHIR_CONCAT_VSV(_3, _0, ".", _2);
+ ZEPHIR_CALL_METHOD(&view, this_ptr, "escape", &_4, _3);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_METHOD(&view, this_ptr, "escape", &_4, _0);
+ zephir_check_call_status();
+ }
+ if (ifExists) {
+ ZEPHIR_CONCAT_SV(return_value, "DROP VIEW IF EXISTS ", view);
+ RETURN_MM();
+ } else {
+ ZEPHIR_CONCAT_SV(return_value, "DROP VIEW ", view);
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * Generates SQL checking for the existence of a schema.view
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, viewExists) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *viewName_param = NULL, *schemaName_param = NULL, *_0 = NULL, *_2 = NULL;
+ zval *viewName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param);
+
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schemaName, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END RET FROM ALL_VIEWS WHERE VIEW_NAME='", _0, "' AND OWNER='", _2, "'");
+ RETURN_MM();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, viewName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END RET FROM ALL_VIEWS WHERE VIEW_NAME='", _0, "'");
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * Generates the SQL to list all views of a schema or user
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, listViews) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *schemaName_param = NULL, *_0 = NULL;
+ zval *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 0, 1, &schemaName_param);
+
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schemaName, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT VIEW_NAME FROM ALL_VIEWS WHERE OWNER='", _0, "' ORDER BY VIEW_NAME");
+ RETURN_MM();
+ } else {
+ RETURN_MM_STRING("SELECT VIEW_NAME FROM ALL_VIEWS VIEW_NAME", 1);
+ }
+
+}
+
+/**
+ * Generates SQL checking for the existence of a schema.table
+ *
+ *
+ * echo $dialect->tableExists("posts", "blog");
+ * echo $dialect->tableExists("posts");
+ *
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, tableExists) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *_0 = NULL, *_2 = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param);
+
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schemaName, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, tableName);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END RET FROM ALL_TABLES WHERE TABLE_NAME='", _0, "' AND OWNER = '", _2, "'");
+ RETURN_MM();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, tableName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END RET FROM ALL_TABLES WHERE TABLE_NAME='", _0, "'");
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * Generates SQL describing a table
+ *
+ *
+ * print_r($dialect->describeColumns("posts"));
+ *
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeColumns) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *table_param = NULL, *schema_param = NULL, *_0 = NULL, *_2 = NULL;
+ zval *table = NULL, *schema = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
+
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schema, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, schema);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "SELECT TC.COLUMN_NAME, TC.DATA_TYPE, TC.DATA_LENGTH, TC.DATA_PRECISION, TC.DATA_SCALE, TC.NULLABLE, C.CONSTRAINT_TYPE, TC.DATA_DEFAULT, CC.POSITION FROM ALL_TAB_COLUMNS TC LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P')) ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME WHERE TC.TABLE_NAME = '", _0, "' AND TC.OWNER = '", _2, "' ORDER BY TC.COLUMN_ID");
+ RETURN_MM();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT TC.COLUMN_NAME, TC.DATA_TYPE, TC.DATA_LENGTH, TC.DATA_PRECISION, TC.DATA_SCALE, TC.NULLABLE, C.CONSTRAINT_TYPE, TC.DATA_DEFAULT, CC.POSITION FROM ALL_TAB_COLUMNS TC LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P')) ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME WHERE TC.TABLE_NAME = '", _0, "' ORDER BY TC.COLUMN_ID");
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * List all tables in database
+ *
+ *
+ * print_r($dialect->listTables("blog"))
+ *
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, listTables) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *schemaName_param = NULL, *_0 = NULL;
+ zval *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 0, 1, &schemaName_param);
+
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schemaName, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, schemaName);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT TABLE_NAME, OWNER FROM ALL_TABLES WHERE OWNER='", _0, "' ORDER BY OWNER, TABLE_NAME");
+ RETURN_MM();
+ } else {
+ RETURN_MM_STRING("SELECT TABLE_NAME, OWNER FROM ALL_TABLES ORDER BY OWNER, TABLE_NAME", 1);
+ }
+
+}
+
+/**
+ * Generates SQL to query indexes on a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeIndexes) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *table_param = NULL, *schema_param = NULL, *_0 = NULL, *_2 = NULL;
+ zval *table = NULL, *schema = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
+
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
+ }
+
+
+ if (!ZEPHIR_IS_STRING(schema, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, schema);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVSVS(return_value, "SELECT I.TABLE_NAME, 0 AS C0, I.INDEX_NAME, IC.COLUMN_POSITION, IC.COLUMN_NAME FROM ALL_INDEXES I JOIN ALL_IND_COLUMNS IC ON I.INDEX_NAME = IC.INDEX_NAME WHERE I.TABLE_NAME = '", _0, "' AND IC.INDEX_OWNER = '", _2, "'");
+ RETURN_MM();
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_CONCAT_SVS(return_value, "SELECT I.TABLE_NAME, 0 AS C0, I.INDEX_NAME, IC.COLUMN_POSITION, IC.COLUMN_NAME FROM ALL_INDEXES I JOIN ALL_IND_COLUMNS IC ON I.INDEX_NAME = IC.INDEX_NAME WHERE I.TABLE_NAME = '", _0, "'");
+ RETURN_MM();
+ }
+
+}
+
+/**
+ * Generates SQL to query foreign keys on a table
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeReferences) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
+ zval *table_param = NULL, *schema_param = NULL, *sql, *_0 = NULL, *_2 = NULL, *_3 = NULL;
+ zval *table = NULL, *schema = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
+
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
+ }
+
+
+ ZEPHIR_INIT_VAR(sql);
+ ZVAL_STRING(sql, "SELECT AC.TABLE_NAME, CC.COLUMN_NAME, AC.CONSTRAINT_NAME, AC.R_OWNER, RCC.TABLE_NAME R_TABLE_NAME, RCC.COLUMN_NAME R_COLUMN_NAME FROM ALL_CONSTRAINTS AC JOIN ALL_CONS_COLUMNS CC ON AC.CONSTRAINT_NAME = CC.CONSTRAINT_NAME JOIN ALL_CONS_COLUMNS RCC ON AC.R_OWNER = RCC.OWNER AND AC.R_CONSTRAINT_NAME = RCC.CONSTRAINT_NAME WHERE AC.CONSTRAINT_TYPE='R' ", 1);
+ if (!ZEPHIR_IS_STRING(schema, "")) {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, schema);
+ zephir_check_call_status();
+ ZEPHIR_CALL_CE_STATIC(&_2, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_INIT_VAR(_3);
+ ZEPHIR_CONCAT_SVSVS(_3, "AND AC.OWNER='", _0, "' AND AC.TABLE_NAME = '", _2, "'");
+ zephir_concat_self(&sql, _3 TSRMLS_CC);
+ } else {
+ ZEPHIR_CALL_CE_STATIC(&_0, phalcon_text_ce, "upper", &_1, table);
+ zephir_check_call_status();
+ ZEPHIR_INIT_LNVAR(_3);
+ ZEPHIR_CONCAT_SVS(_3, "AND AC.TABLE_NAME = '", _0, "'");
+ zephir_concat_self(&sql, _3 TSRMLS_CC);
+ }
+ RETURN_CCTOR(sql);
+
+}
+
+/**
+ * Generates the SQL to describe the table creation options
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, tableOptions) {
+
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
+
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
+ }
+
+
+ RETURN_MM_STRING("", 1);
+
+}
+
+/**
+ * Checks whether the platform supports savepoints
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, supportsSavepoints) {
+
+
+ RETURN_BOOL(0);
+
+}
+
+/**
+ * Checks whether the platform supports releasing savepoints.
+ */
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, supportsReleaseSavepoints) {
+
+
+ RETURN_BOOL(0);
+
+}
+
diff --git a/ext/phalcon/db/dialect/oracle.zep.h b/ext/phalcon/db/dialect/oracle.zep.h
index 2f449dd20be..2df86a02a7b 100644
--- a/ext/phalcon/db/dialect/oracle.zep.h
+++ b/ext/phalcon/db/dialect/oracle.zep.h
@@ -3,3 +3,181 @@ extern zend_class_entry *phalcon_db_dialect_oracle_ce;
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Oracle);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, limit);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, getColumnDefinition);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addColumn);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, modifyColumn);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropColumn);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addIndex);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropIndex);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addPrimaryKey);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropPrimaryKey);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, addForeignKey);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropForeignKey);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, createTable);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropTable);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, createView);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, dropView);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, viewExists);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, listViews);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, tableExists);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeColumns);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, listTables);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeIndexes);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, describeReferences);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, tableOptions);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, supportsSavepoints);
+PHP_METHOD(Phalcon_Db_Dialect_Oracle, supportsReleaseSavepoints);
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_limit, 0, 0, 2)
+ ZEND_ARG_INFO(0, sqlQuery)
+ ZEND_ARG_INFO(0, number)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_getcolumndefinition, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_addcolumn, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_modifycolumn, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_OBJ_INFO(0, column, Phalcon\\Db\\ColumnInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_dropcolumn, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, columnName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_addindex, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_OBJ_INFO(0, index, Phalcon\\Db\\IndexInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_dropindex, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, indexName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_addprimarykey, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_OBJ_INFO(0, index, Phalcon\\Db\\IndexInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_dropprimarykey, 0, 0, 2)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_addforeignkey, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_OBJ_INFO(0, reference, Phalcon\\Db\\ReferenceInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_dropforeignkey, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, referenceName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_createtable, 0, 0, 3)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_droptable, 0, 0, 2)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, ifExists)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_createview, 0, 0, 2)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_dropview, 0, 0, 1)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, ifExists)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_viewexists, 0, 0, 1)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_listviews, 0, 0, 0)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_tableexists, 0, 0, 1)
+ ZEND_ARG_INFO(0, tableName)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_describecolumns, 0, 0, 1)
+ ZEND_ARG_INFO(0, table)
+ ZEND_ARG_INFO(0, schema)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_listtables, 0, 0, 0)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_describeindexes, 0, 0, 1)
+ ZEND_ARG_INFO(0, table)
+ ZEND_ARG_INFO(0, schema)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_describereferences, 0, 0, 1)
+ ZEND_ARG_INFO(0, table)
+ ZEND_ARG_INFO(0, schema)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_oracle_tableoptions, 0, 0, 1)
+ ZEND_ARG_INFO(0, table)
+ ZEND_ARG_INFO(0, schema)
+ZEND_END_ARG_INFO()
+
+ZEPHIR_INIT_FUNCS(phalcon_db_dialect_oracle_method_entry) {
+ PHP_ME(Phalcon_Db_Dialect_Oracle, limit, arginfo_phalcon_db_dialect_oracle_limit, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, getColumnDefinition, arginfo_phalcon_db_dialect_oracle_getcolumndefinition, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, addColumn, arginfo_phalcon_db_dialect_oracle_addcolumn, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, modifyColumn, arginfo_phalcon_db_dialect_oracle_modifycolumn, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropColumn, arginfo_phalcon_db_dialect_oracle_dropcolumn, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, addIndex, arginfo_phalcon_db_dialect_oracle_addindex, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropIndex, arginfo_phalcon_db_dialect_oracle_dropindex, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, addPrimaryKey, arginfo_phalcon_db_dialect_oracle_addprimarykey, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropPrimaryKey, arginfo_phalcon_db_dialect_oracle_dropprimarykey, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, addForeignKey, arginfo_phalcon_db_dialect_oracle_addforeignkey, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropForeignKey, arginfo_phalcon_db_dialect_oracle_dropforeignkey, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, createTable, arginfo_phalcon_db_dialect_oracle_createtable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropTable, arginfo_phalcon_db_dialect_oracle_droptable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, createView, arginfo_phalcon_db_dialect_oracle_createview, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, dropView, arginfo_phalcon_db_dialect_oracle_dropview, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, viewExists, arginfo_phalcon_db_dialect_oracle_viewexists, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, listViews, arginfo_phalcon_db_dialect_oracle_listviews, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, tableExists, arginfo_phalcon_db_dialect_oracle_tableexists, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, describeColumns, arginfo_phalcon_db_dialect_oracle_describecolumns, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, listTables, arginfo_phalcon_db_dialect_oracle_listtables, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, describeIndexes, arginfo_phalcon_db_dialect_oracle_describeindexes, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, describeReferences, arginfo_phalcon_db_dialect_oracle_describereferences, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, tableOptions, arginfo_phalcon_db_dialect_oracle_tableoptions, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, supportsSavepoints, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Db_Dialect_Oracle, supportsReleaseSavepoints, NULL, ZEND_ACC_PUBLIC)
+ PHP_FE_END
+};
diff --git a/ext/phalcon/db/dialect/postgresql.zep.c b/ext/phalcon/db/dialect/postgresql.zep.c
index 0762c0e581e..eba73dc5b90 100644
--- a/ext/phalcon/db/dialect/postgresql.zep.c
+++ b/ext/phalcon/db/dialect/postgresql.zep.c
@@ -26,7 +26,7 @@
/**
* Phalcon\Db\Dialect\Postgresql
*
- * Generates database specific SQL for the PostgreSQL RBDM
+ * Generates database specific SQL for the PostgreSQL RDBMS
*/
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Postgresql) {
@@ -34,7 +34,6 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Postgresql) {
zend_declare_property_string(phalcon_db_dialect_postgresql_ce, SL("_escapeChar"), "\"", ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_class_implements(phalcon_db_dialect_postgresql_ce TSRMLS_CC, 1, phalcon_db_dialectinterface_ce);
return SUCCESS;
}
@@ -183,263 +182,490 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, getColumnDefinition) {
/**
* Generates SQL to add a column to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ColumnInterface column
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addColumn) {
- zval *tableName, *schemaName, *column;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *column;
+ zval *tableName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &column);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);
+ 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();
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 148);
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 143);
return;
}
/**
* Generates SQL to modify a column in a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ColumnInterface column
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, modifyColumn) {
- zval *tableName, *schemaName, *column;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *column;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &column);
+
+ 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();
+ }
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &column);
+ 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);
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 161);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 151);
return;
}
/**
* Generates SQL to delete a column from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string columnName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropColumn) {
- zval *tableName, *schemaName, *columnName;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *columnName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *columnName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &columnName);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &columnName_param);
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (unlikely(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 174);
+ if (likely(Z_TYPE_P(columnName_param) == IS_STRING)) {
+ zephir_get_strval(columnName, columnName_param);
+ } else {
+ ZEPHIR_INIT_VAR(columnName);
+ ZVAL_EMPTY_STRING(columnName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 159);
return;
}
/**
* Generates SQL to add an index to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\IndexInterface index
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addIndex) {
- zval *tableName, *schemaName, *index;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *index;
+ zval *tableName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &index);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
+ 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();
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 187);
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 167);
return;
}
/**
* Generates SQL to delete an index from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string indexName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropIndex) {
- zval *tableName, *schemaName, *indexName;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *indexName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *indexName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &indexName);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &indexName_param);
+
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (unlikely(Z_TYPE_P(indexName_param) != IS_STRING && Z_TYPE_P(indexName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'indexName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(indexName_param) == IS_STRING)) {
+ zephir_get_strval(indexName, indexName_param);
+ } else {
+ ZEPHIR_INIT_VAR(indexName);
+ ZVAL_EMPTY_STRING(indexName);
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 200);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 175);
return;
}
/**
* Generates SQL to add the primary key to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\IndexInterface index
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addPrimaryKey) {
- zval *tableName, *schemaName, *index;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *index;
+ zval *tableName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &index);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
+
+ 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);
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 213);
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 183);
return;
}
/**
* Generates SQL to delete primary key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropPrimaryKey) {
- zval *tableName, *schemaName;
+ zval *tableName_param = NULL, *schemaName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 0, &tableName_param, &schemaName_param);
- zephir_fetch_params(0, 2, 0, &tableName, &schemaName);
+ 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);
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 225);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 191);
return;
}
/**
* Generates SQL to add an index to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ReferenceInterface reference
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addForeignKey) {
- zval *tableName, *schemaName, *reference;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *reference;
+ zval *tableName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &reference);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &reference);
+ 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();
+ }
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 238);
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+
+
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 199);
return;
}
/**
* Generates SQL to delete a foreign key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string referenceName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropForeignKey) {
- zval *tableName, *schemaName, *referenceName;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *referenceName = NULL;
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &referenceName);
-
-
-
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 251);
- return;
-
-}
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_param);
-/**
- * Generates SQL to add the table creation options
- *
- * @param array definition
- * @return array
- */
-PHP_METHOD(Phalcon_Db_Dialect_Postgresql, _getTableOptions) {
+ 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();
+ }
- zval *definition;
+ 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();
+ }
- zephir_fetch_params(0, 1, 0, &definition);
+ if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
+ zephir_get_strval(schemaName, schemaName_param);
+ } else {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ }
+ if (unlikely(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+ if (likely(Z_TYPE_P(referenceName_param) == IS_STRING)) {
+ zephir_get_strval(referenceName, referenceName_param);
+ } else {
+ ZEPHIR_INIT_VAR(referenceName);
+ ZVAL_EMPTY_STRING(referenceName);
+ }
- array_init(return_value);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 207);
return;
}
/**
- * Generates SQL to create a table in PostgreSQL
- *
- * @param string tableName
- * @param string schemaName
- * @param array definition
- * @return string
+ * Generates SQL to create a table
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable) {
zval *definition = NULL;
- zval *tableName, *schemaName, *definition_param = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *definition_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &definition_param);
- zephir_fetch_params(0, 3, 0, &tableName, &schemaName, &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_THROW_EXCEPTION_DEBUG_STRW(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 275);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/postgresql.zep", 215);
return;
}
/**
- * Generates SQL to drop a table
- *
- * @param string tableName
- * @param string schemaName
- * @param boolean ifExists
- * @return boolean
+ * Generates SQL to drop a view
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropTable) {
- zval *tableName, *schemaName, *ifExists = NULL, *table = NULL, *sql;
+ zend_bool ifExists;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *table = NULL, *sql;
+ zval *tableName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &tableName, &schemaName, &ifExists);
+ zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param);
- if (!ifExists) {
- ifExists = ZEPHIR_GLOBAL(global_true);
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
}
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
- if (zephir_is_true(schemaName)) {
- ZEPHIR_INIT_VAR(table);
- ZEPHIR_CONCAT_VSV(table, schemaName, ".", tableName);
+ ifExists = Z_BVAL_P(ifExists_param);
+ }
+
+
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_INIT_VAR(_0);
+ ZEPHIR_CONCAT_VSV(_0, schemaName, ".", tableName);
+ ZEPHIR_CPY_WRT(table, _0);
} else {
ZEPHIR_CPY_WRT(table, tableName);
}
ZEPHIR_INIT_VAR(sql);
- if (zephir_is_true(ifExists)) {
+ if (ifExists) {
ZEPHIR_CONCAT_SV(sql, "DROP TABLE IF EXISTS ", table);
} else {
ZEPHIR_CONCAT_SV(sql, "DROP TABLE ", table);
@@ -450,29 +676,46 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropTable) {
/**
* Generates SQL to create a view
- *
- * @param string viewName
- * @param array definition
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createView) {
- zval *viewName, *definition, *schemaName, *viewSql, *view = NULL;
+ zval *definition = NULL;
+ zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, *viewSql, *view = NULL;
+ zval *viewName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 3, 0, &viewName, &definition, &schemaName);
+ zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param);
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ definition = definition_param;
+
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
ZEPHIR_OBS_VAR(viewSql);
if (!(zephir_array_isset_string_fetch(&viewSql, definition, SS("sql"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/postgresql.zep", 316);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/postgresql.zep", 246);
return;
}
- if (zephir_is_true(schemaName)) {
- ZEPHIR_INIT_VAR(view);
- ZEPHIR_CONCAT_VSV(view, viewName, ".", schemaName);
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_INIT_VAR(_0);
+ ZEPHIR_CONCAT_VSV(_0, viewName, ".", schemaName);
+ ZEPHIR_CPY_WRT(view, _0);
} else {
ZEPHIR_CPY_WRT(view, viewName);
}
@@ -483,32 +726,54 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createView) {
/**
* Generates SQL to drop a view
- *
- * @param string viewName
- * @param string schemaName
- * @param boolean ifExists
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropView) {
- zval *viewName, *schemaName, *ifExists = NULL, *view = NULL, *sql;
+ zend_bool ifExists;
+ zval *viewName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *view = NULL, *sql;
+ zval *viewName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &viewName, &schemaName, &ifExists);
+ zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param);
- if (!ifExists) {
- ifExists = ZEPHIR_GLOBAL(global_true);
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
}
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
- if (zephir_is_true(schemaName)) {
- ZEPHIR_INIT_VAR(view);
- ZEPHIR_CONCAT_VSV(view, viewName, ".", schemaName);
+ ifExists = Z_BVAL_P(ifExists_param);
+ }
+
+
+ if (schemaName && Z_STRLEN_P(schemaName)) {
+ ZEPHIR_INIT_VAR(_0);
+ ZEPHIR_CONCAT_VSV(_0, viewName, ".", schemaName);
+ ZEPHIR_CPY_WRT(view, _0);
} else {
ZEPHIR_CPY_WRT(view, viewName);
}
ZEPHIR_INIT_VAR(sql);
- if (zephir_is_true(ifExists)) {
+ if (ifExists) {
ZEPHIR_CONCAT_SV(sql, "DROP VIEW IF EXISTS ", view);
} else {
ZEPHIR_CONCAT_SV(sql, "DROP VIEW ", view);
@@ -520,114 +785,157 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropView) {
/**
* Generates SQL checking for the existence of a schema.table
*
- * echo dialect->tableExists("posts", "blog")
- * echo dialect->tableExists("posts")
- *
- * @param string tableName
- * @param string schemaName
- * @return string
+ *
+ * echo $dialect->tableExists("posts", "blog");
+ * echo $dialect->tableExists("posts");
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, tableExists) {
- zval *tableName, *schemaName = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 1, 1, &tableName, &schemaName);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_param);
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(tableName_param) == IS_STRING)) {
+ zephir_get_strval(tableName, tableName_param);
+ } else {
+ ZEPHIR_INIT_VAR(tableName);
+ ZVAL_EMPTY_STRING(tableName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
- if (zephir_is_true(schemaName)) {
+ if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM information_schema.tables WHERE table_schema = '", schemaName, "' AND table_name='", tableName, "'");
- return;
+ RETURN_MM();
}
ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM information_schema.tables WHERE table_schema = 'public' AND table_name='", tableName, "'");
- return;
+ RETURN_MM();
}
/**
* Generates SQL checking for the existence of a schema.view
- *
- * @param string viewName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, viewExists) {
- zval *viewName, *schemaName = NULL;
+ zval *viewName_param = NULL, *schemaName_param = NULL;
+ zval *viewName = NULL, *schemaName = NULL;
- zephir_fetch_params(0, 1, 1, &viewName, &schemaName);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param);
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
}
+ if (likely(Z_TYPE_P(viewName_param) == IS_STRING)) {
+ zephir_get_strval(viewName, viewName_param);
+ } else {
+ ZEPHIR_INIT_VAR(viewName);
+ ZVAL_EMPTY_STRING(viewName);
+ }
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
- if (zephir_is_true(schemaName)) {
+
+ if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM pg_views WHERE viewname='", viewName, "' AND schemaname='", schemaName, "'");
- return;
+ RETURN_MM();
}
ZEPHIR_CONCAT_SVS(return_value, "SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM pg_views WHERE viewname='", viewName, "'");
- return;
+ RETURN_MM();
}
/**
- * Generates a SQL describing a table
- *
- * print_r(dialect->describeColumns("posts") ?>
+ * Generates SQL describing a table
*
- * @param string table
- * @param string schema
- * @return string
+ *
+ * print_r($dialect->describeColumns("posts"));
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeColumns) {
- zval *table, *schema = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
- zephir_fetch_params(0, 1, 1, &table, &schema);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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 (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_CONCAT_SVSVS(return_value, "SELECT DISTINCT c.column_name AS Field, c.data_type AS Type, c.character_maximum_length AS Size, c.numeric_precision AS NumericSize, c.numeric_scale AS NumericScale, c.is_nullable AS Null, CASE WHEN pkc.column_name NOTNULL THEN 'PRI' ELSE '' END AS Key, CASE WHEN c.data_type LIKE '%int%' AND c.column_default LIKE '%nextval%' THEN 'auto_increment' ELSE '' END AS Extra, c.ordinal_position AS Position, c.column_default FROM information_schema.columns c LEFT JOIN ( SELECT kcu.column_name, kcu.table_name, kcu.table_schema FROM information_schema.table_constraints tc INNER JOIN information_schema.key_column_usage kcu on (kcu.constraint_name = tc.constraint_name and kcu.table_name=tc.table_name and kcu.table_schema=tc.table_schema) WHERE tc.constraint_type='PRIMARY KEY') pkc ON (c.column_name=pkc.column_name AND c.table_schema = pkc.table_schema AND c.table_name=pkc.table_name) WHERE c.table_schema='", schema, "' AND c.table_name='", table, "' ORDER BY c.ordinal_position");
- return;
+ RETURN_MM();
}
ZEPHIR_CONCAT_SVS(return_value, "SELECT DISTINCT c.column_name AS Field, c.data_type AS Type, c.character_maximum_length AS Size, c.numeric_precision AS NumericSize, c.numeric_scale AS NumericScale, c.is_nullable AS Null, CASE WHEN pkc.column_name NOTNULL THEN 'PRI' ELSE '' END AS Key, CASE WHEN c.data_type LIKE '%int%' AND c.column_default LIKE '%nextval%' THEN 'auto_increment' ELSE '' END AS Extra, c.ordinal_position AS Position, c.column_default FROM information_schema.columns c LEFT JOIN ( SELECT kcu.column_name, kcu.table_name, kcu.table_schema FROM information_schema.table_constraints tc INNER JOIN information_schema.key_column_usage kcu on (kcu.constraint_name = tc.constraint_name and kcu.table_name=tc.table_name and kcu.table_schema=tc.table_schema) WHERE tc.constraint_type='PRIMARY KEY') pkc ON (c.column_name=pkc.column_name AND c.table_schema = pkc.table_schema AND c.table_name=pkc.table_name) WHERE c.table_schema='public' AND c.table_name='", table, "' ORDER BY c.ordinal_position");
- return;
+ RETURN_MM();
}
/**
* List all tables in database
*
- *
- * print_r(dialect->listTables("blog")) ?>
- *
- *
- * @param string schemaName
+ *
+ * print_r($dialect->listTables("blog"))
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, listTables) {
+ zval *schemaName_param = NULL;
zval *schemaName = NULL;
- zephir_fetch_params(0, 0, 1, &schemaName);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 0, 1, &schemaName_param);
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
- if (zephir_is_true(schemaName)) {
+ if (schemaName && Z_STRLEN_P(schemaName)) {
ZEPHIR_CONCAT_SVS(return_value, "SELECT table_name FROM information_schema.tables WHERE table_schema = '", schemaName, "' ORDER BY table_name");
- return;
+ RETURN_MM();
}
- RETURN_STRING("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name", 1);
+ RETURN_MM_STRING("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name", 1);
}
@@ -658,49 +966,72 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, listViews) {
/**
* Generates SQL to query indexes on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeIndexes) {
- zval *table, *schema = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
- zephir_fetch_params(0, 1, 1, &table, &schema);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
ZEPHIR_CONCAT_SVS(return_value, "SELECT 0 as c0, t.relname as table_name, i.relname as key_name, 3 as c3, a.attname as column_name FROM pg_class t, pg_class i, pg_index ix, pg_attribute a WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND a.attnum = ANY(ix.indkey) AND t.relkind = 'r' AND t.relname = '", table, "' ORDER BY t.relname, i.relname;");
- return;
+ RETURN_MM();
}
/**
* Generates SQL to query foreign keys on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeReferences) {
- zval *table, *schema = NULL, *sql, *_0 = NULL;
+ zval *table_param = NULL, *schema_param = NULL, *sql;
+ zval *table = NULL, *schema = NULL, *_0 = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_param);
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (unlikely(Z_TYPE_P(table_param) != IS_STRING && Z_TYPE_P(table_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'table' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
ZEPHIR_INIT_VAR(sql);
ZVAL_STRING(sql, "SELECT tc.table_name as TABLE_NAME, kcu.column_name as COLUMN_NAME, tc.constraint_name as CONSTRAINT_NAME, tc.table_catalog as REFERENCED_TABLE_SCHEMA, ccu.table_name AS REFERENCED_TABLE_NAME, ccu.column_name AS REFERENCED_COLUMN_NAME FROM information_schema.table_constraints AS tc JOIN information_schema.key_column_usage AS kcu ON tc.constraint_name = kcu.constraint_name JOIN information_schema.constraint_column_usage AS ccu ON ccu.constraint_name = tc.constraint_name WHERE constraint_type = 'FOREIGN KEY' AND ", 1);
- if (zephir_is_true(schema)) {
+ if (schema && Z_STRLEN_P(schema)) {
ZEPHIR_INIT_VAR(_0);
ZEPHIR_CONCAT_SVSVS(_0, "tc.table_schema = '", schema, "' AND tc.table_name='", table, "'");
zephir_concat_self(&sql, _0 TSRMLS_CC);
@@ -715,23 +1046,35 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, describeReferences) {
/**
* Generates the SQL to describe the table creation options
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, tableOptions) {
- zval *table, *schema = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
- zephir_fetch_params(0, 1, 1, &table, &schema);
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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 (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (likely(Z_TYPE_P(table_param) == IS_STRING)) {
+ zephir_get_strval(table, table_param);
+ } else {
+ ZEPHIR_INIT_VAR(table);
+ ZVAL_EMPTY_STRING(table);
+ }
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
- RETURN_STRING("", 1);
+ RETURN_MM_STRING("", 1);
}
diff --git a/ext/phalcon/db/dialect/postgresql.zep.h b/ext/phalcon/db/dialect/postgresql.zep.h
index 1f2e8e36955..d7d4e06a8b2 100644
--- a/ext/phalcon/db/dialect/postgresql.zep.h
+++ b/ext/phalcon/db/dialect/postgresql.zep.h
@@ -13,7 +13,6 @@ PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, addForeignKey);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropForeignKey);
-PHP_METHOD(Phalcon_Db_Dialect_Postgresql, _getTableOptions);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createTable);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, dropTable);
PHP_METHOD(Phalcon_Db_Dialect_Postgresql, createView);
@@ -84,29 +83,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_dropforeignkey, 0,
ZEND_ARG_INFO(0, referenceName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql__gettableoptions, 0, 0, 1)
- ZEND_ARG_INFO(0, definition)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_createtable, 0, 0, 3)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_droptable, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_droptable, 0, 0, 1)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_createview, 0, 0, 3)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_createview, 0, 0, 2)
ZEND_ARG_INFO(0, viewName)
- ZEND_ARG_INFO(0, definition)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_ARG_INFO(0, schemaName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_dropview, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_postgresql_dropview, 0, 0, 1)
ZEND_ARG_INFO(0, viewName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
@@ -161,7 +156,6 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialect_postgresql_method_entry) {
PHP_ME(Phalcon_Db_Dialect_Postgresql, dropPrimaryKey, arginfo_phalcon_db_dialect_postgresql_dropprimarykey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Postgresql, addForeignKey, arginfo_phalcon_db_dialect_postgresql_addforeignkey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Postgresql, dropForeignKey, arginfo_phalcon_db_dialect_postgresql_dropforeignkey, ZEND_ACC_PUBLIC)
- PHP_ME(Phalcon_Db_Dialect_Postgresql, _getTableOptions, arginfo_phalcon_db_dialect_postgresql__gettableoptions, ZEND_ACC_PROTECTED)
PHP_ME(Phalcon_Db_Dialect_Postgresql, createTable, arginfo_phalcon_db_dialect_postgresql_createtable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Postgresql, dropTable, arginfo_phalcon_db_dialect_postgresql_droptable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Postgresql, createView, arginfo_phalcon_db_dialect_postgresql_createview, ZEND_ACC_PUBLIC)
diff --git a/ext/phalcon/db/dialect/sqlite.zep.c b/ext/phalcon/db/dialect/sqlite.zep.c
index 8c524ade812..c41a49a7216 100644
--- a/ext/phalcon/db/dialect/sqlite.zep.c
+++ b/ext/phalcon/db/dialect/sqlite.zep.c
@@ -26,7 +26,7 @@
/**
* Phalcon\Db\Dialect\Sqlite
*
- * Generates database specific SQL for the Sqlite RBDM
+ * Generates database specific SQL for the Sqlite RDBMS
*/
ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Sqlite) {
@@ -34,7 +34,6 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_Dialect_Sqlite) {
zend_declare_property_string(phalcon_db_dialect_sqlite_ce, SL("_escapeChar"), "\"", ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_class_implements(phalcon_db_dialect_sqlite_ce TSRMLS_CC, 1, phalcon_db_dialectinterface_ce);
return SUCCESS;
}
@@ -331,7 +330,17 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropColumn) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
}
- zephir_get_strval(columnName, columnName_param);
+ if (unlikely(Z_TYPE_P(columnName_param) != IS_STRING && Z_TYPE_P(columnName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'columnName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ if (likely(Z_TYPE_P(columnName_param) == IS_STRING)) {
+ zephir_get_strval(columnName, columnName_param);
+ } else {
+ ZEPHIR_INIT_VAR(columnName);
+ ZVAL_EMPTY_STRING(columnName);
+ }
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Dropping DB column is not supported by SQLite", "phalcon/db/dialect/sqlite.zep", 177);
@@ -479,8 +488,28 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addPrimaryKey) {
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &index);
- zephir_get_strval(tableName, tableName_param);
- zephir_get_strval(schemaName, schemaName_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);
+ }
ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Adding a primary key after table has been created is not supported by SQLite", "phalcon/db/dialect/sqlite.zep", 224);
@@ -570,19 +599,14 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addForeignKey) {
/**
* Generates SQL to delete a foreign key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string referenceName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropForeignKey) {
- zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName;
- zval *tableName = NULL, *schemaName = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *referenceName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL, *referenceName = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName);
+ zephir_fetch_params(1, 3, 0, &tableName_param, &schemaName_param, &referenceName_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);
@@ -606,33 +630,26 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropForeignKey) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
}
+ if (unlikely(Z_TYPE_P(referenceName_param) != IS_STRING && Z_TYPE_P(referenceName_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'referenceName' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
-
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Dropping a foreign key constraint is not supported by SQLite", "phalcon/db/dialect/sqlite.zep", 253);
- return;
-
-}
-
-/**
- * Generates SQL to add the table creation options
- *
- * @param array definition
- * @return array
- */
-PHP_METHOD(Phalcon_Db_Dialect_Sqlite, _getTableOptions) {
-
- zval *definition;
-
- zephir_fetch_params(0, 1, 0, &definition);
-
+ if (likely(Z_TYPE_P(referenceName_param) == IS_STRING)) {
+ zephir_get_strval(referenceName, referenceName_param);
+ } else {
+ ZEPHIR_INIT_VAR(referenceName);
+ ZVAL_EMPTY_STRING(referenceName);
+ }
- RETURN_STRING("", 1);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Dropping a foreign key constraint is not supported by SQLite", "phalcon/db/dialect/sqlite.zep", 248);
+ return;
}
/**
- * Generates SQL to create a table in MySQL
+ * Generates SQL to create a table
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) {
@@ -669,26 +686,22 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/sqlite.zep", 272);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "Not implemented yet", "phalcon/db/dialect/sqlite.zep", 256);
return;
}
/**
* Generates SQL to drop a table
- *
- * @param string tableName
- * @param string schemaName
- * @param boolean ifExists
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) {
- zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists = NULL, *sql, *table = NULL;
+ zend_bool ifExists;
+ zval *tableName_param = NULL, *schemaName_param = NULL, *ifExists_param = NULL, *sql, *table = NULL;
zval *tableName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &tableName_param, &schemaName_param, &ifExists);
+ zephir_fetch_params(1, 1, 2, &tableName_param, &schemaName_param, &ifExists_param);
if (unlikely(Z_TYPE_P(tableName_param) != IS_STRING && Z_TYPE_P(tableName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'tableName' must be a string") TSRMLS_CC);
@@ -701,19 +714,21 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) {
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 {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
+ }
+ if (!ifExists_param) {
+ ifExists = 1;
+ } else {
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
}
- if (!ifExists) {
- ifExists = ZEPHIR_GLOBAL(global_true);
+
+ ifExists = Z_BVAL_P(ifExists_param);
}
@@ -725,7 +740,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) {
ZEPHIR_CPY_WRT(table, tableName);
}
ZEPHIR_INIT_VAR(sql);
- if (zephir_is_true(ifExists)) {
+ if (ifExists) {
ZEPHIR_CONCAT_SVS(sql, "DROP TABLE IF EXISTS \"", table, "\"");
} else {
ZEPHIR_CONCAT_SVS(sql, "DROP TABLE \"", table, "\"");
@@ -736,19 +751,15 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable) {
/**
* Generates SQL to create a view
- *
- * @param string viewName
- * @param array definition
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createView) {
- zval *viewName_param = NULL, *definition, *schemaName_param = NULL, *view = NULL, *viewSql;
+ zval *definition = NULL;
+ zval *viewName_param = NULL, *definition_param = NULL, *schemaName_param = NULL, *view = NULL, *viewSql;
zval *viewName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 3, 0, &viewName_param, &definition, &schemaName_param);
+ zephir_fetch_params(1, 2, 1, &viewName_param, &definition_param, &schemaName_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -761,22 +772,19 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createView) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
- zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
- RETURN_MM_NULL();
- }
+ definition = definition_param;
- if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
- zephir_get_strval(schemaName, schemaName_param);
- } else {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
ZEPHIR_OBS_VAR(viewSql);
if (!(zephir_array_isset_string_fetch(&viewSql, definition, SS("sql"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/sqlite.zep", 315);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_db_exception_ce, "The index 'sql' is required in the definition array", "phalcon/db/dialect/sqlite.zep", 289);
return;
}
if (schemaName && Z_STRLEN_P(schemaName)) {
@@ -801,7 +809,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView) {
zval *viewName = NULL, *schemaName = NULL, *_0;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &viewName_param, &schemaName_param, &ifExists_param);
+ zephir_fetch_params(1, 1, 2, &viewName_param, &schemaName_param, &ifExists_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -814,21 +822,21 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (unlikely(Z_TYPE_P(schemaName_param) != IS_STRING && Z_TYPE_P(schemaName_param) != IS_NULL)) {
- zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'schemaName' must be a string") TSRMLS_CC);
- RETURN_MM_NULL();
- }
-
- if (likely(Z_TYPE_P(schemaName_param) == IS_STRING)) {
- zephir_get_strval(schemaName, schemaName_param);
- } else {
+ if (!schemaName_param) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
if (!ifExists_param) {
ifExists = 1;
} else {
- ifExists = zephir_get_boolval(ifExists_param);
+ if (unlikely(Z_TYPE_P(ifExists_param) != IS_BOOL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'ifExists' must be a bool") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+
+ ifExists = Z_BVAL_P(ifExists_param);
}
@@ -853,21 +861,17 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropView) {
* Generates SQL checking for the existence of a schema.table
*
*
- * echo $dialect->tableExists("posts", "blog");
- * echo $dialect->tableExists("posts");
+ * echo $dialect->tableExists("posts", "blog");
+ * echo $dialect->tableExists("posts");
*
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableExists) {
- zval *tableName_param = NULL, *schemaName = NULL;
- zval *tableName = NULL;
+ zval *tableName_param = NULL, *schemaName_param = NULL;
+ zval *tableName = NULL, *schemaName = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName);
+ zephir_fetch_params(1, 1, 1, &tableName_param, &schemaName_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);
@@ -880,8 +884,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableExists) {
ZEPHIR_INIT_VAR(tableName);
ZVAL_EMPTY_STRING(tableName);
}
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
@@ -892,18 +899,14 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableExists) {
/**
* Generates SQL checking for the existence of a schema.view
- *
- * @param string viewName
- * @param string schemaName
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) {
- zval *viewName_param = NULL, *schemaName = NULL;
- zval *viewName = NULL;
+ zval *viewName_param = NULL, *schemaName_param = NULL;
+ zval *viewName = NULL, *schemaName = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName);
+ zephir_fetch_params(1, 1, 1, &viewName_param, &schemaName_param);
if (unlikely(Z_TYPE_P(viewName_param) != IS_STRING && Z_TYPE_P(viewName_param) != IS_NULL)) {
zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'viewName' must be a string") TSRMLS_CC);
@@ -916,8 +919,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) {
ZEPHIR_INIT_VAR(viewName);
ZVAL_EMPTY_STRING(viewName);
}
- if (!schemaName) {
- schemaName = ZEPHIR_GLOBAL(global_null);
+ if (!schemaName_param) {
+ ZEPHIR_INIT_VAR(schemaName);
+ ZVAL_EMPTY_STRING(schemaName);
+ } else {
+ zephir_get_strval(schemaName, schemaName_param);
}
@@ -929,21 +935,17 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, viewExists) {
/**
* Generates SQL describing a table
*
- *
- * print_r($dialect->describeColumns("posts"));
- *
- *
- * @param string table
- * @param string schema
- * @return string
+ *
+ * print_r($dialect->describeColumns("posts"));
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeColumns) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -956,8 +958,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeColumns) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
@@ -969,9 +974,9 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeColumns) {
/**
* List all tables in database
*
- *
- * print_r($dialect->listTables("blog"))
- *
+ *
+ * print_r($dialect->listTables("blog"))
+ *
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listTables) {
@@ -985,17 +990,7 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listTables) {
ZEPHIR_INIT_VAR(schemaName);
ZVAL_EMPTY_STRING(schemaName);
} else {
- 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);
- }
}
@@ -1038,18 +1033,14 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, listViews) {
/**
* Generates SQL to query indexes on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndexes) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1062,8 +1053,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndexes) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
@@ -1103,18 +1097,14 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeIndex) {
/**
* Generates SQL to query foreign keys on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeReferences) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1127,8 +1117,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeReferences) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
@@ -1139,18 +1132,14 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, describeReferences) {
/**
* Generates the SQL to describe the table creation options
- *
- * @param string table
- * @param string schema
- * @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableOptions) {
- zval *table_param = NULL, *schema = NULL;
- zval *table = NULL;
+ zval *table_param = NULL, *schema_param = NULL;
+ zval *table = NULL, *schema = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 1, &table_param, &schema);
+ zephir_fetch_params(1, 1, 1, &table_param, &schema_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);
@@ -1163,8 +1152,11 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, tableOptions) {
ZEPHIR_INIT_VAR(table);
ZVAL_EMPTY_STRING(table);
}
- if (!schema) {
- schema = ZEPHIR_GLOBAL(global_null);
+ if (!schema_param) {
+ ZEPHIR_INIT_VAR(schema);
+ ZVAL_EMPTY_STRING(schema);
+ } else {
+ zephir_get_strval(schema, schema_param);
}
diff --git a/ext/phalcon/db/dialect/sqlite.zep.h b/ext/phalcon/db/dialect/sqlite.zep.h
index 3876c38326e..673be29a4c8 100644
--- a/ext/phalcon/db/dialect/sqlite.zep.h
+++ b/ext/phalcon/db/dialect/sqlite.zep.h
@@ -13,7 +13,6 @@ PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropPrimaryKey);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, addForeignKey);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropForeignKey);
-PHP_METHOD(Phalcon_Db_Dialect_Sqlite, _getTableOptions);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createTable);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, dropTable);
PHP_METHOD(Phalcon_Db_Dialect_Sqlite, createView);
@@ -85,29 +84,25 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_dropforeignkey, 0, 0, 3
ZEND_ARG_INFO(0, referenceName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite__gettableoptions, 0, 0, 1)
- ZEND_ARG_INFO(0, definition)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_createtable, 0, 0, 3)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_droptable, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_droptable, 0, 0, 1)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_createview, 0, 0, 3)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_createview, 0, 0, 2)
ZEND_ARG_INFO(0, viewName)
- ZEND_ARG_INFO(0, definition)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_ARG_INFO(0, schemaName)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_dropview, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialect_sqlite_dropview, 0, 0, 1)
ZEND_ARG_INFO(0, viewName)
ZEND_ARG_INFO(0, schemaName)
ZEND_ARG_INFO(0, ifExists)
@@ -166,7 +161,6 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialect_sqlite_method_entry) {
PHP_ME(Phalcon_Db_Dialect_Sqlite, dropPrimaryKey, arginfo_phalcon_db_dialect_sqlite_dropprimarykey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Sqlite, addForeignKey, arginfo_phalcon_db_dialect_sqlite_addforeignkey, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Sqlite, dropForeignKey, arginfo_phalcon_db_dialect_sqlite_dropforeignkey, ZEND_ACC_PUBLIC)
- PHP_ME(Phalcon_Db_Dialect_Sqlite, _getTableOptions, arginfo_phalcon_db_dialect_sqlite__gettableoptions, ZEND_ACC_PROTECTED)
PHP_ME(Phalcon_Db_Dialect_Sqlite, createTable, arginfo_phalcon_db_dialect_sqlite_createtable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Sqlite, dropTable, arginfo_phalcon_db_dialect_sqlite_droptable, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Db_Dialect_Sqlite, createView, arginfo_phalcon_db_dialect_sqlite_createview, ZEND_ACC_PUBLIC)
diff --git a/ext/phalcon/db/dialectinterface.zep.c b/ext/phalcon/db/dialectinterface.zep.c
index 57b3b073cb2..3964b4c9dcc 100644
--- a/ext/phalcon/db/dialectinterface.zep.c
+++ b/ext/phalcon/db/dialectinterface.zep.c
@@ -27,246 +27,156 @@ ZEPHIR_INIT_CLASS(Phalcon_Db_DialectInterface) {
/**
* Generates the SQL for LIMIT clause
- *
- * @param string sqlQuery
- * @param int number
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, limit);
/**
* Returns a SQL modified with a FOR UPDATE clause
- *
- * @param string sqlQuery
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, forUpdate);
/**
* Returns a SQL modified with a LOCK IN SHARE MODE clause
- *
- * @param string sqlQuery
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, sharedLock);
/**
* Builds a SELECT statement
- *
- * @param array definition
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, select);
/**
* Gets a list of columns
- *
- * @param array columnList
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnList);
/**
- * Gets the column name in MySQL
+ * Gets the column name in RDBMS
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, getColumnDefinition);
/**
* Generates SQL to add a column to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ColumnInterface column
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addColumn);
/**
* Generates SQL to modify a column in a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ColumnInterface column
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, modifyColumn);
/**
* Generates SQL to delete a column from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string columnName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropColumn);
/**
* Generates SQL to add an index to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\IndexInterface index
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addIndex);
/**
* Generates SQL to delete an index from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string indexName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropIndex);
/**
* Generates SQL to add the primary key to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\IndexInterface index
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addPrimaryKey);
/**
* Generates SQL to delete primary key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropPrimaryKey);
/**
* Generates SQL to add an index to a table
- *
- * @param string tableName
- * @param string schemaName
- * @param Phalcon\Db\ReferenceInterface reference
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, addForeignKey);
/**
* Generates SQL to delete a foreign key from a table
- *
- * @param string tableName
- * @param string schemaName
- * @param string referenceName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropForeignKey);
/**
* Generates SQL to create a table
- *
- * @param string tableName
- * @param string schemaName
- * @param array definition
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createTable);
+/**
+ * Generates SQL to create a view
+ */
+ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createView);
+
/**
* Generates SQL to drop a table
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropTable);
+/**
+ * Generates SQL to drop a view
+ */
+ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, dropView);
+
/**
* Generates SQL checking for the existence of a schema.table
- *
- * @param string tableName
- * @param string schemaName
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableExists);
+/**
+ * Generates SQL checking for the existence of a schema.view
+ */
+ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, viewExists);
+
/**
* Generates SQL to describe a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeColumns);
/**
* List all tables in database
- *
- * @param string schemaName
- * @return array
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, listTables);
/**
* Generates SQL to query indexes on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeIndexes);
/**
* Generates SQL to query foreign keys on a table
- *
- * @param string table
- * @param string schema
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, describeReferences);
/**
* Generates the SQL to describe the table creation options
- *
- * @param string table
- * @param string schema
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, tableOptions);
/**
* Checks whether the platform supports savepoints
- *
- * @return boolean
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsSavepoints);
/**
* Checks whether the platform supports releasing savepoints.
- *
- * @return boolean
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, supportsReleaseSavepoints);
/**
* Generate SQL to create a new savepoint
- *
- * @param string name
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, createSavepoint);
/**
* Generate SQL to release a savepoint
- *
- * @param string name
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, releaseSavepoint);
/**
* Generate SQL to rollback a savepoint
- *
- * @param string name
- * @return string
*/
ZEPHIR_DOC_METHOD(Phalcon_Db_DialectInterface, rollbackSavepoint);
diff --git a/ext/phalcon/db/dialectinterface.zep.h b/ext/phalcon/db/dialectinterface.zep.h
index 3a902782346..ba39cb61386 100644
--- a/ext/phalcon/db/dialectinterface.zep.h
+++ b/ext/phalcon/db/dialectinterface.zep.h
@@ -87,16 +87,33 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_createtable, 0, 0, 3)
ZEND_ARG_ARRAY_INFO(0, definition, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_createview, 0, 0, 2)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_ARRAY_INFO(0, definition, 0)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_droptable, 0, 0, 2)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_dropview, 0, 0, 1)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_INFO(0, schemaName)
+ ZEND_ARG_INFO(0, ifExists)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_tableexists, 0, 0, 1)
ZEND_ARG_INFO(0, tableName)
ZEND_ARG_INFO(0, schemaName)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_viewexists, 0, 0, 1)
+ ZEND_ARG_INFO(0, viewName)
+ ZEND_ARG_INFO(0, schemaName)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_db_dialectinterface_describecolumns, 0, 0, 1)
ZEND_ARG_INFO(0, table)
ZEND_ARG_INFO(0, schema)
@@ -150,8 +167,11 @@ ZEPHIR_INIT_FUNCS(phalcon_db_dialectinterface_method_entry) {
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, addForeignKey, arginfo_phalcon_db_dialectinterface_addforeignkey)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropForeignKey, arginfo_phalcon_db_dialectinterface_dropforeignkey)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, createTable, arginfo_phalcon_db_dialectinterface_createtable)
+ PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, createView, arginfo_phalcon_db_dialectinterface_createview)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropTable, arginfo_phalcon_db_dialectinterface_droptable)
+ PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, dropView, arginfo_phalcon_db_dialectinterface_dropview)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, tableExists, arginfo_phalcon_db_dialectinterface_tableexists)
+ PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, viewExists, arginfo_phalcon_db_dialectinterface_viewexists)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, describeColumns, arginfo_phalcon_db_dialectinterface_describecolumns)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, listTables, arginfo_phalcon_db_dialectinterface_listtables)
PHP_ABSTRACT_ME(Phalcon_Db_DialectInterface, describeIndexes, arginfo_phalcon_db_dialectinterface_describeindexes)
diff --git a/ext/phalcon/debug.zep.c b/ext/phalcon/debug.zep.c
index b71709141de..6137b4ec7e1 100644
--- a/ext/phalcon/debug.zep.c
+++ b/ext/phalcon/debug.zep.c
@@ -598,7 +598,7 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
ZEPHIR_CPY_WRT(html, _1);
if (zephir_array_isset_string(trace, SS("class"))) {
ZEPHIR_OBS_VAR(className);
- zephir_array_fetch_string(&className, trace, SL("class"), PH_NOISY, "phalcon/debug.zep", 356 TSRMLS_CC);
+ zephir_array_fetch_string(&className, trace, SL("class"), PH_NOISY, "phalcon/debug.zep", 355 TSRMLS_CC);
ZEPHIR_INIT_VAR(_2);
ZEPHIR_INIT_VAR(_3);
ZEPHIR_SINIT_VAR(_4);
@@ -633,11 +633,11 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
zephir_concat_self(&html, _10 TSRMLS_CC);
}
}
- zephir_array_fetch_string(&_11, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 397 TSRMLS_CC);
+ zephir_array_fetch_string(&_11, trace, SL("type"), PH_NOISY | PH_READONLY, "phalcon/debug.zep", 396 TSRMLS_CC);
zephir_concat_self(&html, _11 TSRMLS_CC);
}
ZEPHIR_OBS_VAR(functionName);
- zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 403 TSRMLS_CC);
+ zephir_array_fetch_string(&functionName, trace, SL("function"), PH_NOISY, "phalcon/debug.zep", 402 TSRMLS_CC);
if (zephir_array_isset_string(trace, SS("class"))) {
ZEPHIR_INIT_LNVAR(_5);
ZEPHIR_CONCAT_SVS(_5, "", functionName, "");
@@ -669,11 +669,11 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
}
if (zephir_array_isset_string(trace, SS("args"))) {
ZEPHIR_OBS_VAR(traceArgs);
- zephir_array_fetch_string(&traceArgs, trace, SL("args"), PH_NOISY, "phalcon/debug.zep", 437 TSRMLS_CC);
+ zephir_array_fetch_string(&traceArgs, trace, SL("args"), PH_NOISY, "phalcon/debug.zep", 436 TSRMLS_CC);
if (zephir_fast_count_int(traceArgs TSRMLS_CC)) {
ZEPHIR_INIT_VAR(arguments);
array_init(arguments);
- zephir_is_iterable(traceArgs, &_15, &_14, 0, 0, "phalcon/debug.zep", 452);
+ zephir_is_iterable(traceArgs, &_15, &_14, 0, 0, "phalcon/debug.zep", 451);
for (
; zephir_hash_get_current_data_ex(_15, (void**) &_16, &_14) == SUCCESS
; zephir_hash_move_forward_ex(_15, &_14)
@@ -683,7 +683,7 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_5);
ZEPHIR_CONCAT_SVS(_5, "", _7, "");
- zephir_array_append(&arguments, _5, PH_SEPARATE, "phalcon/debug.zep", 446);
+ zephir_array_append(&arguments, _5, PH_SEPARATE, "phalcon/debug.zep", 445);
}
ZEPHIR_INIT_NVAR(_3);
zephir_fast_join_str(_3, SL(", "), arguments TSRMLS_CC);
@@ -697,7 +697,7 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
ZEPHIR_OBS_VAR(filez);
if (zephir_array_isset_string_fetch(&filez, trace, SS("file"), 0 TSRMLS_CC)) {
ZEPHIR_OBS_VAR(_18);
- zephir_array_fetch_string(&_18, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 463 TSRMLS_CC);
+ zephir_array_fetch_string(&_18, trace, SL("line"), PH_NOISY, "phalcon/debug.zep", 462 TSRMLS_CC);
zephir_get_strval(_19, _18);
ZEPHIR_CPY_WRT(line, _19);
ZEPHIR_INIT_LNVAR(_5);
@@ -761,7 +761,7 @@ PHP_METHOD(Phalcon_Debug, showTraceItem) {
ZEPHIR_SINIT_NVAR(linePosition);
ZVAL_LONG(&linePosition, (i - 1));
ZEPHIR_OBS_NVAR(currentLine);
- zephir_array_fetch(¤tLine, lines, &linePosition, PH_NOISY, "phalcon/debug.zep", 551 TSRMLS_CC);
+ zephir_array_fetch(¤tLine, lines, &linePosition, PH_NOISY, "phalcon/debug.zep", 550 TSRMLS_CC);
if (zephir_is_true(showFileFragment)) {
if (i == firstLine) {
ZEPHIR_INIT_NVAR(_23);
@@ -824,7 +824,7 @@ PHP_METHOD(Phalcon_Debug, onUncaughtLowSeverity) {
ZVAL_LONG(_4, 0);
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, message, _4, severity, file, line);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/debug.zep", 594 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/debug.zep", 593 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -909,7 +909,7 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException) {
zephir_concat_self_str(&html, SL("") TSRMLS_CC);
ZEPHIR_CALL_METHOD(&_11, exception, "gettrace", NULL);
zephir_check_call_status();
- zephir_is_iterable(_11, &_13, &_12, 0, 0, "phalcon/debug.zep", 688);
+ zephir_is_iterable(_11, &_13, &_12, 0, 0, "phalcon/debug.zep", 687);
for (
; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS
; zephir_hash_move_forward_ex(_13, &_12)
@@ -924,7 +924,7 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException) {
zephir_concat_self_str(&html, SL("") TSRMLS_CC);
zephir_concat_self_str(&html, SL("Key | Value |
") TSRMLS_CC);
zephir_get_global(&_REQUEST, SS("_REQUEST") TSRMLS_CC);
- zephir_is_iterable(_REQUEST, &_18, &_17, 0, 0, "phalcon/debug.zep", 698);
+ zephir_is_iterable(_REQUEST, &_18, &_17, 0, 0, "phalcon/debug.zep", 697);
for (
; zephir_hash_get_current_data_ex(_18, (void**) &_19, &_17) == SUCCESS
; zephir_hash_move_forward_ex(_18, &_17)
@@ -939,7 +939,7 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException) {
zephir_concat_self_str(&html, SL("") TSRMLS_CC);
zephir_concat_self_str(&html, SL("Key | Value |
") TSRMLS_CC);
zephir_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
- zephir_is_iterable(_SERVER, &_22, &_21, 0, 0, "phalcon/debug.zep", 708);
+ zephir_is_iterable(_SERVER, &_22, &_21, 0, 0, "phalcon/debug.zep", 707);
for (
; zephir_hash_get_current_data_ex(_22, (void**) &_23, &_21) == SUCCESS
; zephir_hash_move_forward_ex(_22, &_21)
@@ -955,7 +955,7 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException) {
zephir_concat_self_str(&html, SL("# | Path |
") TSRMLS_CC);
ZEPHIR_CALL_FUNCTION(&_15, "get_included_files", &_24);
zephir_check_call_status();
- zephir_is_iterable(_15, &_26, &_25, 0, 0, "phalcon/debug.zep", 719);
+ zephir_is_iterable(_15, &_26, &_25, 0, 0, "phalcon/debug.zep", 718);
for (
; zephir_hash_get_current_data_ex(_26, (void**) &_27, &_25) == SUCCESS
; zephir_hash_move_forward_ex(_26, &_25)
@@ -977,14 +977,14 @@ PHP_METHOD(Phalcon_Debug, onUncaughtException) {
if (Z_TYPE_P(dataVars) == IS_ARRAY) {
zephir_concat_self_str(&html, SL("") TSRMLS_CC);
zephir_concat_self_str(&html, SL("Key | Value |
") TSRMLS_CC);
- zephir_is_iterable(dataVars, &_30, &_29, 0, 0, "phalcon/debug.zep", 737);
+ zephir_is_iterable(dataVars, &_30, &_29, 0, 0, "phalcon/debug.zep", 736);
for (
; zephir_hash_get_current_data_ex(_30, (void**) &_31, &_29) == SUCCESS
; zephir_hash_move_forward_ex(_30, &_29)
) {
ZEPHIR_GET_HMKEY(keyVar, _30, _29);
ZEPHIR_GET_HVALUE(dataVar, _31);
- zephir_array_fetch_long(&_33, dataVar, 0, PH_NOISY | PH_READONLY, "phalcon/debug.zep", 735 TSRMLS_CC);
+ zephir_array_fetch_long(&_33, dataVar, 0, PH_NOISY | PH_READONLY, "phalcon/debug.zep", 734 TSRMLS_CC);
ZEPHIR_CALL_METHOD(&_32, this_ptr, "_getvardump", &_34, _33);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_35);
diff --git a/ext/phalcon/dispatcher.zep.c b/ext/phalcon/dispatcher.zep.c
index ef22013b650..019011a5c15 100644
--- a/ext/phalcon/dispatcher.zep.c
+++ b/ext/phalcon/dispatcher.zep.c
@@ -877,8 +877,6 @@ PHP_METHOD(Phalcon_Dispatcher, wasForwarded) {
/**
* Possible class name that will be located to dispatch the request
- *
- * @return string
*/
PHP_METHOD(Phalcon_Dispatcher, getHandlerClass) {
diff --git a/ext/phalcon/mvc/collection.zep.c b/ext/phalcon/mvc/collection.zep.c
index a794f95d967..dd5375f8161 100644
--- a/ext/phalcon/mvc/collection.zep.c
+++ b/ext/phalcon/mvc/collection.zep.c
@@ -68,7 +68,7 @@ ZEPHIR_INIT_CLASS(Phalcon_Mvc_Collection) {
}
/**
- * Phalcon\Mvc\Model constructor
+ * Phalcon\Mvc\Collection constructor
*/
PHP_METHOD(Phalcon_Mvc_Collection, __construct) {
@@ -898,7 +898,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, validate) {
if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) {
ZEPHIR_CALL_METHOD(&_1, validator, "getmessages", NULL);
zephir_check_call_status();
- zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/collection.zep", 658);
+ zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/collection.zep", 659);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -1179,13 +1179,13 @@ PHP_METHOD(Phalcon_Mvc_Collection, save) {
ZEPHIR_OBS_VAR(dependencyInjector);
zephir_read_property_this(&dependencyInjector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/collection.zep", 849);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/collection.zep", 850);
return;
}
ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(source)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 854);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 855);
return;
}
ZEPHIR_CALL_METHOD(&connection, this_ptr, "getconnection", NULL);
@@ -1219,7 +1219,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, save) {
zephir_check_call_status();
ZEPHIR_CALL_FUNCTION(&properties, "get_object_vars", &_4, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(properties, &_6, &_5, 0, 0, "phalcon/mvc/collection.zep", 909);
+ zephir_is_iterable(properties, &_6, &_5, 0, 0, "phalcon/mvc/collection.zep", 910);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
@@ -1363,7 +1363,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, findFirst) {
if (zephir_is_true(parameters)) {
if (Z_TYPE_P(parameters) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for findFirst", "phalcon/mvc/collection.zep", 1002);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for findFirst", "phalcon/mvc/collection.zep", 1003);
return;
}
}
@@ -1441,7 +1441,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, find) {
if (zephir_is_true(parameters)) {
if (Z_TYPE_P(parameters) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for find", "phalcon/mvc/collection.zep", 1059);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for find", "phalcon/mvc/collection.zep", 1060);
return;
}
}
@@ -1491,7 +1491,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, count) {
if (zephir_is_true(parameters)) {
if (Z_TYPE_P(parameters) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for count", "phalcon/mvc/collection.zep", 1084);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for count", "phalcon/mvc/collection.zep", 1085);
return;
}
}
@@ -1532,7 +1532,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, aggregate) {
if (zephir_is_true(parameters)) {
if (Z_TYPE_P(parameters) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for aggregate", "phalcon/mvc/collection.zep", 1109);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Invalid parameters for aggregate", "phalcon/mvc/collection.zep", 1110);
return;
}
}
@@ -1551,7 +1551,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, aggregate) {
ZEPHIR_CALL_METHOD(&source, model, "getsource", NULL);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(source)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1121);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1122);
return;
}
ZEPHIR_CALL_METHOD(&_2, connection, "selectcollection", NULL, source);
@@ -1614,7 +1614,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, summatory) {
ZEPHIR_CALL_METHOD(&source, model, "getsource", NULL);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(source)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1148);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1149);
return;
}
ZEPHIR_CALL_METHOD(&collection, connection, "selectcollection", NULL, source);
@@ -1634,7 +1634,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, summatory) {
if (zephir_array_isset_string_fetch(&retval, group, SS("retval"), 1 TSRMLS_CC)) {
if (zephir_array_isset_long_fetch(&firstRetval, retval, 0, 1 TSRMLS_CC)) {
if (zephir_array_isset_string(firstRetval, SS("summatory"))) {
- zephir_array_fetch_string(&_3, firstRetval, SL("summatory"), PH_NOISY | PH_READONLY, "phalcon/mvc/collection.zep", 1172 TSRMLS_CC);
+ zephir_array_fetch_string(&_3, firstRetval, SL("summatory"), PH_NOISY | PH_READONLY, "phalcon/mvc/collection.zep", 1173 TSRMLS_CC);
RETURN_CTOR(_3);
}
RETURN_CTOR(firstRetval);
@@ -1669,7 +1669,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, delete) {
ZEPHIR_OBS_VAR(id);
if (!(zephir_fetch_property(&id, this_ptr, SL("_id"), PH_SILENT_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The document cannot be deleted because it doesn't exist", "phalcon/mvc/collection.zep", 1199);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The document cannot be deleted because it doesn't exist", "phalcon/mvc/collection.zep", 1200);
return;
}
ZEPHIR_OBS_VAR(disableEvents);
@@ -1689,7 +1689,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, delete) {
ZEPHIR_CALL_METHOD(&source, this_ptr, "getsource", NULL);
zephir_check_call_status();
if (ZEPHIR_IS_EMPTY(source)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1214);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "Method getSource() returns empty string", "phalcon/mvc/collection.zep", 1215);
return;
}
ZEPHIR_CALL_METHOD(&collection, connection, "selectcollection", NULL, source);
@@ -1763,7 +1763,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, toArray) {
array_init(data);
ZEPHIR_CALL_FUNCTION(&_0, "get_object_vars", &_1, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/mvc/collection.zep", 1292);
+ zephir_is_iterable(_0, &_3, &_2, 0, 0, "phalcon/mvc/collection.zep", 1293);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -1839,7 +1839,7 @@ PHP_METHOD(Phalcon_Mvc_Collection, unserialize) {
ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_1);
zephir_check_call_status();
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "A dependency injector container is required to obtain the services related to the ODM", "phalcon/mvc/collection.zep", 1323);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "A dependency injector container is required to obtain the services related to the ODM", "phalcon/mvc/collection.zep", 1324);
return;
}
zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC);
@@ -1849,11 +1849,11 @@ PHP_METHOD(Phalcon_Mvc_Collection, unserialize) {
zephir_check_temp_parameter(_2);
zephir_check_call_status();
if (Z_TYPE_P(manager) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The injected service 'collectionManager' is not valid", "phalcon/mvc/collection.zep", 1336);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_collection_exception_ce, "The injected service 'collectionManager' is not valid", "phalcon/mvc/collection.zep", 1337);
return;
}
zephir_update_property_this(this_ptr, SL("_modelsManager"), manager TSRMLS_CC);
- zephir_is_iterable(attributes, &_4, &_3, 0, 0, "phalcon/mvc/collection.zep", 1350);
+ zephir_is_iterable(attributes, &_4, &_3, 0, 0, "phalcon/mvc/collection.zep", 1351);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
diff --git a/ext/phalcon/mvc/model.zep.c b/ext/phalcon/mvc/model.zep.c
index c0eed11db8f..800bf2e4c66 100644
--- a/ext/phalcon/mvc/model.zep.c
+++ b/ext/phalcon/mvc/model.zep.c
@@ -137,7 +137,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __construct) {
zephir_check_call_status();
}
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 133);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 132);
return;
}
zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC);
@@ -149,7 +149,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __construct) {
zephir_check_call_status();
ZEPHIR_CPY_WRT(modelsManager, _1);
if (Z_TYPE_P(modelsManager) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/mvc/model.zep", 144);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/mvc/model.zep", 143);
return;
}
}
@@ -242,7 +242,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) {
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(dependencyInjector, _0);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 213);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 212);
return;
}
ZEPHIR_INIT_VAR(_2);
@@ -252,7 +252,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getModelsMetaData) {
zephir_check_call_status();
ZEPHIR_CPY_WRT(metaData, _1);
if (Z_TYPE_P(metaData) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsMetadata' is not valid", "phalcon/mvc/model.zep", 221);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsMetadata' is not valid", "phalcon/mvc/model.zep", 220);
return;
}
zephir_update_property_this(this_ptr, SL("_modelsMetaData"), metaData TSRMLS_CC);
@@ -671,7 +671,7 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) {
if (Z_TYPE_P(dataColumnMap) == IS_ARRAY) {
ZEPHIR_INIT_VAR(dataMapped);
array_init(dataMapped);
- zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 436);
+ zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 435);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -700,7 +700,7 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) {
}
ZEPHIR_CALL_METHOD(&_3, metaData, "getattributes", NULL, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_3, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 484);
+ zephir_is_iterable(_3, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 483);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -715,7 +715,7 @@ PHP_METHOD(Phalcon_Mvc_Model, assign) {
ZEPHIR_CONCAT_SVS(_8, "Column '", attribute, "' doesn\\'t make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _7, "__construct", &_9, _8);
zephir_check_call_status();
- zephir_throw_exception_debug(_7, "phalcon/mvc/model.zep", 457 TSRMLS_CC);
+ zephir_throw_exception_debug(_7, "phalcon/mvc/model.zep", 456 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -796,7 +796,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) {
ZVAL_LONG(_0, dirtyState);
ZEPHIR_CALL_METHOD(NULL, instance, "setdirtystate", NULL, _0);
zephir_check_call_status();
- zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 541);
+ zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 540);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -815,7 +815,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMap) {
ZEPHIR_CONCAT_SVS(_4, "Column '", key, "' doesn't make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model.zep", 530 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model.zep", 529 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -873,7 +873,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) {
ZEPHIR_INIT_VAR(hydrateObject);
object_init(hydrateObject);
}
- zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 611);
+ zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 610);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -890,7 +890,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResultMapHydrate) {
ZEPHIR_CONCAT_SVS(_4, "Column '", key, "' doesn't make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 593 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 592 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -959,7 +959,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) {
ZVAL_LONG(_0, dirtyState);
ZEPHIR_CALL_METHOD(NULL, instance, "setdirtystate", NULL, _0);
zephir_check_call_status();
- zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 658);
+ zephir_is_iterable(data, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 657);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -967,7 +967,7 @@ PHP_METHOD(Phalcon_Mvc_Model, cloneResult) {
ZEPHIR_GET_HMKEY(key, _2, _1);
ZEPHIR_GET_HVALUE(value, _3);
if (Z_TYPE_P(key) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid key in array data provided to dumpResult()", "phalcon/mvc/model.zep", 650);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid key in array data provided to dumpResult()", "phalcon/mvc/model.zep", 649);
return;
}
zephir_update_property_zval_zval(instance, key, value TSRMLS_CC);
@@ -1027,7 +1027,7 @@ PHP_METHOD(Phalcon_Mvc_Model, find) {
ZEPHIR_INIT_VAR(params);
array_init(params);
if (Z_TYPE_P(parameters) != IS_NULL) {
- zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 701);
+ zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 700);
}
} else {
ZEPHIR_CPY_WRT(params, parameters);
@@ -1108,7 +1108,7 @@ PHP_METHOD(Phalcon_Mvc_Model, findFirst) {
ZEPHIR_INIT_VAR(params);
array_init(params);
if (Z_TYPE_P(parameters) != IS_NULL) {
- zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 777);
+ zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 776);
}
} else {
ZEPHIR_CPY_WRT(params, parameters);
@@ -1255,7 +1255,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists) {
array_init(uniqueParams);
ZEPHIR_INIT_NVAR(uniqueTypes);
array_init(uniqueTypes);
- zephir_is_iterable(primaryKeys, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 939);
+ zephir_is_iterable(primaryKeys, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 938);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -1270,7 +1270,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists) {
ZEPHIR_CONCAT_SVS(_4, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 903 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 902 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -1288,9 +1288,9 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists) {
if (_6) {
numberEmpty++;
}
- zephir_array_append(&uniqueParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 921);
+ zephir_array_append(&uniqueParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 920);
} else {
- zephir_array_append(&uniqueParams, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 924);
+ zephir_array_append(&uniqueParams, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 923);
numberEmpty++;
}
ZEPHIR_OBS_NVAR(type);
@@ -1301,16 +1301,16 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists) {
ZEPHIR_CONCAT_SVS(_4, "Column '", field, "' isn't part of the table columns");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 929 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 928 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
- zephir_array_append(&uniqueTypes, type, PH_SEPARATE, "phalcon/mvc/model.zep", 932);
+ zephir_array_append(&uniqueTypes, type, PH_SEPARATE, "phalcon/mvc/model.zep", 931);
ZEPHIR_CALL_METHOD(&_7, connection, "escapeidentifier", &_8, field);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_9);
ZEPHIR_CONCAT_VS(_9, _7, " = ?");
- zephir_array_append(&wherePk, _9, PH_SEPARATE, "phalcon/mvc/model.zep", 933);
+ zephir_array_append(&wherePk, _9, PH_SEPARATE, "phalcon/mvc/model.zep", 932);
}
if (numberPrimary == numberEmpty) {
RETURN_MM_BOOL(0);
@@ -1358,7 +1358,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _exists) {
ZVAL_NULL(_3);
ZEPHIR_CALL_METHOD(&num, connection, "fetchone", NULL, _9, _3, uniqueParams, uniqueTypes);
zephir_check_call_status();
- zephir_array_fetch_string(&_11, num, SL("rowcount"), PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 989 TSRMLS_CC);
+ zephir_array_fetch_string(&_11, num, SL("rowcount"), PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 988 TSRMLS_CC);
if (zephir_is_true(_11)) {
ZEPHIR_INIT_ZVAL_NREF(_12);
ZVAL_LONG(_12, 0);
@@ -1419,7 +1419,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _groupResult) {
ZEPHIR_INIT_VAR(params);
array_init(params);
if (Z_TYPE_P(parameters) != IS_NULL) {
- zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 1016);
+ zephir_array_append(¶ms, parameters, PH_SEPARATE, "phalcon/mvc/model.zep", 1015);
}
} else {
ZEPHIR_CPY_WRT(params, parameters);
@@ -1876,7 +1876,7 @@ PHP_METHOD(Phalcon_Mvc_Model, validate) {
if (ZEPHIR_IS_FALSE_IDENTICAL(_0)) {
ZEPHIR_CALL_METHOD(&_1, validator, "getmessages", NULL);
zephir_check_call_status();
- zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 1311);
+ zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 1310);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -1969,7 +1969,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getMessages) {
ZEPHIR_INIT_VAR(filtered);
array_init(filtered);
_1 = zephir_fetch_nproperty_this(this_ptr, SL("_errorMessages"), PH_NOISY_CC);
- zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 1378);
+ zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 1377);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -1978,7 +1978,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getMessages) {
ZEPHIR_CALL_METHOD(&_5, message, "getfield", NULL);
zephir_check_call_status();
if (ZEPHIR_IS_EQUAL(_5, filter)) {
- zephir_array_append(&filtered, message, PH_SEPARATE, "phalcon/mvc/model.zep", 1375);
+ zephir_array_append(&filtered, message, PH_SEPARATE, "phalcon/mvc/model.zep", 1374);
}
}
RETURN_CCTOR(filtered);
@@ -2009,7 +2009,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict) {
zephir_check_call_status();
if (zephir_fast_count_int(belongsTo TSRMLS_CC)) {
error = 0;
- zephir_is_iterable(belongsTo, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1498);
+ zephir_is_iterable(belongsTo, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1497);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -2022,7 +2022,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict) {
if (Z_TYPE_P(foreignKey) == IS_ARRAY) {
if (zephir_array_isset_string(foreignKey, SS("action"))) {
ZEPHIR_OBS_NVAR(_4);
- zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1422 TSRMLS_CC);
+ zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1421 TSRMLS_CC);
action = zephir_get_intval(_4);
}
}
@@ -2040,7 +2040,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict) {
ZEPHIR_CALL_METHOD(&referencedFields, relation, "getreferencedfields", NULL);
zephir_check_call_status();
if (Z_TYPE_P(fields) == IS_ARRAY) {
- zephir_is_iterable(fields, &_8, &_7, 0, 0, "phalcon/mvc/model.zep", 1453);
+ zephir_is_iterable(fields, &_8, &_7, 0, 0, "phalcon/mvc/model.zep", 1452);
for (
; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
; zephir_hash_move_forward_ex(_8, &_7)
@@ -2049,23 +2049,23 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysRestrict) {
ZEPHIR_GET_HVALUE(field, _9);
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, field, PH_SILENT_CC);
- zephir_array_fetch(&_10, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1450 TSRMLS_CC);
+ zephir_array_fetch(&_10, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1449 TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_11);
ZEPHIR_CONCAT_SVSV(_11, "[", _10, "] = ?", position);
- zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1450);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1451);
+ zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1449);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1450);
}
} else {
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, fields, PH_SILENT_CC);
ZEPHIR_INIT_LNVAR(_11);
ZEPHIR_CONCAT_SVS(_11, "[", referencedFields, "] = ?0");
- zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1455);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1456);
+ zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1454);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1455);
}
ZEPHIR_OBS_NVAR(extraConditions);
if (zephir_array_isset_string_fetch(&extraConditions, foreignKey, SS("conditions"), 0 TSRMLS_CC)) {
- zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1463);
+ zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1462);
}
ZEPHIR_INIT_NVAR(_13);
zephir_create_array(_13, 2, 0 TSRMLS_CC);
@@ -2138,7 +2138,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade) {
ZEPHIR_CALL_METHOD(&relations, manager, "gethasoneandhasmany", NULL, this_ptr);
zephir_check_call_status();
if (zephir_fast_count_int(relations TSRMLS_CC)) {
- zephir_is_iterable(relations, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1612);
+ zephir_is_iterable(relations, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1611);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -2151,7 +2151,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade) {
if (Z_TYPE_P(foreignKey) == IS_ARRAY) {
if (zephir_array_isset_string(foreignKey, SS("action"))) {
ZEPHIR_OBS_NVAR(_4);
- zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1551 TSRMLS_CC);
+ zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1550 TSRMLS_CC);
action = zephir_get_intval(_4);
}
}
@@ -2169,7 +2169,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade) {
ZEPHIR_INIT_NVAR(bindParams);
array_init(bindParams);
if (Z_TYPE_P(fields) == IS_ARRAY) {
- zephir_is_iterable(fields, &_8, &_7, 0, 0, "phalcon/mvc/model.zep", 1579);
+ zephir_is_iterable(fields, &_8, &_7, 0, 0, "phalcon/mvc/model.zep", 1578);
for (
; zephir_hash_get_current_data_ex(_8, (void**) &_9, &_7) == SUCCESS
; zephir_hash_move_forward_ex(_8, &_7)
@@ -2178,23 +2178,23 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseCascade) {
ZEPHIR_GET_HVALUE(field, _9);
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, field, PH_SILENT_CC);
- zephir_array_fetch(&_10, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1576 TSRMLS_CC);
+ zephir_array_fetch(&_10, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1575 TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_11);
ZEPHIR_CONCAT_SVSV(_11, "[", _10, "] = ?", position);
- zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1576);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1577);
+ zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1575);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1576);
}
} else {
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, fields, PH_SILENT_CC);
ZEPHIR_INIT_LNVAR(_11);
ZEPHIR_CONCAT_SVS(_11, "[", referencedFields, "] = ?0");
- zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1581);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1582);
+ zephir_array_append(&conditions, _11, PH_SEPARATE, "phalcon/mvc/model.zep", 1580);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1581);
}
ZEPHIR_OBS_NVAR(extraConditions);
if (zephir_array_isset_string_fetch(&extraConditions, foreignKey, SS("conditions"), 0 TSRMLS_CC)) {
- zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1589);
+ zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1588);
}
ZEPHIR_INIT_NVAR(_12);
zephir_create_array(_12, 2, 0 TSRMLS_CC);
@@ -2238,7 +2238,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict) {
zephir_check_call_status();
if (zephir_fast_count_int(relations TSRMLS_CC)) {
error = 0;
- zephir_is_iterable(relations, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1729);
+ zephir_is_iterable(relations, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 1728);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -2251,7 +2251,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict) {
if (Z_TYPE_P(foreignKey) == IS_ARRAY) {
if (zephir_array_isset_string(foreignKey, SS("action"))) {
ZEPHIR_OBS_NVAR(_4);
- zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1659 TSRMLS_CC);
+ zephir_array_fetch_string(&_4, foreignKey, SL("action"), PH_NOISY, "phalcon/mvc/model.zep", 1658 TSRMLS_CC);
action = zephir_get_intval(_4);
}
}
@@ -2269,7 +2269,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict) {
ZEPHIR_INIT_NVAR(bindParams);
array_init(bindParams);
if (Z_TYPE_P(fields) == IS_ARRAY) {
- zephir_is_iterable(fields, &_7, &_6, 0, 0, "phalcon/mvc/model.zep", 1689);
+ zephir_is_iterable(fields, &_7, &_6, 0, 0, "phalcon/mvc/model.zep", 1688);
for (
; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS
; zephir_hash_move_forward_ex(_7, &_6)
@@ -2278,23 +2278,23 @@ PHP_METHOD(Phalcon_Mvc_Model, _checkForeignKeysReverseRestrict) {
ZEPHIR_GET_HVALUE(field, _8);
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, field, PH_SILENT_CC);
- zephir_array_fetch(&_9, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1686 TSRMLS_CC);
+ zephir_array_fetch(&_9, referencedFields, position, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 1685 TSRMLS_CC);
ZEPHIR_INIT_LNVAR(_10);
ZEPHIR_CONCAT_SVSV(_10, "[", _9, "] = ?", position);
- zephir_array_append(&conditions, _10, PH_SEPARATE, "phalcon/mvc/model.zep", 1686);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1687);
+ zephir_array_append(&conditions, _10, PH_SEPARATE, "phalcon/mvc/model.zep", 1685);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1686);
}
} else {
ZEPHIR_OBS_NVAR(value);
zephir_fetch_property_zval(&value, this_ptr, fields, PH_SILENT_CC);
ZEPHIR_INIT_LNVAR(_10);
ZEPHIR_CONCAT_SVS(_10, "[", referencedFields, "] = ?0");
- zephir_array_append(&conditions, _10, PH_SEPARATE, "phalcon/mvc/model.zep", 1691);
- zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1692);
+ zephir_array_append(&conditions, _10, PH_SEPARATE, "phalcon/mvc/model.zep", 1690);
+ zephir_array_append(&bindParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 1691);
}
ZEPHIR_OBS_NVAR(extraConditions);
if (zephir_array_isset_string_fetch(&extraConditions, foreignKey, SS("conditions"), 0 TSRMLS_CC)) {
- zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1699);
+ zephir_array_append(&conditions, extraConditions, PH_SEPARATE, "phalcon/mvc/model.zep", 1698);
}
ZEPHIR_INIT_NVAR(_12);
zephir_create_array(_12, 2, 0 TSRMLS_CC);
@@ -2422,7 +2422,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSave) {
zephir_check_call_status();
}
error = 0;
- zephir_is_iterable(notNull, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 1879);
+ zephir_is_iterable(notNull, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 1878);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -2439,7 +2439,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSave) {
ZEPHIR_CONCAT_SVS(_7, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_8, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 1829 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 1828 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2660,7 +2660,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_INIT_NVAR(columnMap);
ZVAL_NULL(columnMap);
}
- zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 2051);
+ zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 2050);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -2676,7 +2676,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_CONCAT_SVS(_4, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2015 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2014 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2684,7 +2684,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_CPY_WRT(attributeField, field);
}
if (!ZEPHIR_IS_EQUAL(field, identityField)) {
- zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2026);
+ zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2025);
ZEPHIR_OBS_NVAR(value);
if (zephir_fetch_property_zval(&value, this_ptr, attributeField, PH_SILENT_CC)) {
ZEPHIR_OBS_NVAR(bindType);
@@ -2695,15 +2695,15 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_CONCAT_SVS(_4, "Column '", field, "' have not defined a bind data type");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2037 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2036 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
- zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2040);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2040);
+ zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2039);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2039);
} else {
- zephir_array_append(&values, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2042);
- zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2042);
+ zephir_array_append(&values, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2041);
+ zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2041);
}
}
}
@@ -2715,7 +2715,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
zephir_check_call_status();
useExplicitIdentity = zephir_get_boolval(_6);
if (useExplicitIdentity) {
- zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/mvc/model.zep", 2060);
+ zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/mvc/model.zep", 2059);
}
if (Z_TYPE_P(columnMap) == IS_ARRAY) {
ZEPHIR_OBS_NVAR(attributeField);
@@ -2726,7 +2726,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_CONCAT_SVS(_4, "Identity column '", identityField, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2068 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2067 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2741,12 +2741,12 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
}
if (_7) {
if (useExplicitIdentity) {
- zephir_array_append(&values, defaultValue, PH_SEPARATE, "phalcon/mvc/model.zep", 2081);
- zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2081);
+ zephir_array_append(&values, defaultValue, PH_SEPARATE, "phalcon/mvc/model.zep", 2080);
+ zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2080);
}
} else {
if (!(useExplicitIdentity)) {
- zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/mvc/model.zep", 2089);
+ zephir_array_append(&fields, identityField, PH_SEPARATE, "phalcon/mvc/model.zep", 2088);
}
ZEPHIR_OBS_NVAR(bindType);
if (!(zephir_array_isset_fetch(&bindType, bindDataTypes, identityField, 0 TSRMLS_CC))) {
@@ -2756,17 +2756,17 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert) {
ZEPHIR_CONCAT_SVS(_4, "Identity column '", identityField, "' isn\\'t part of the table columns");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2096 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 2095 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
- zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2099);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2099);
+ zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2098);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2098);
}
} else {
if (useExplicitIdentity) {
- zephir_array_append(&values, defaultValue, PH_SEPARATE, "phalcon/mvc/model.zep", 2103);
- zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2103);
+ zephir_array_append(&values, defaultValue, PH_SEPARATE, "phalcon/mvc/model.zep", 2102);
+ zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2102);
}
}
}
@@ -2859,7 +2859,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_INIT_NVAR(columnMap);
ZVAL_NULL(columnMap);
}
- zephir_is_iterable(nonPrimary, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 2290);
+ zephir_is_iterable(nonPrimary, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 2289);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -2874,7 +2874,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_CONCAT_SVS(_6, "Column '", field, "' have not defined a bind data type");
ZEPHIR_CALL_METHOD(NULL, _5, "__construct", &_7, _6);
zephir_check_call_status();
- zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2194 TSRMLS_CC);
+ zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2193 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2887,7 +2887,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_CONCAT_SVS(_6, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _5, "__construct", &_7, _6);
zephir_check_call_status();
- zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2202 TSRMLS_CC);
+ zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2201 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2897,9 +2897,9 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_OBS_NVAR(value);
if (zephir_fetch_property_zval(&value, this_ptr, attributeField, PH_SILENT_CC)) {
if (!(useDynamicUpdate)) {
- zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2218);
- zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2218);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2219);
+ zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2217);
+ zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2217);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2218);
} else {
ZEPHIR_OBS_NVAR(snapshotValue);
if (!(zephir_array_isset_fetch(&snapshotValue, snapshot, attributeField, 0 TSRMLS_CC))) {
@@ -2941,15 +2941,15 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
}
}
if (changed) {
- zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2276);
- zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2276);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2277);
+ zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2275);
+ zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2275);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2276);
}
}
} else {
- zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2282);
- zephir_array_append(&values, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2282);
- zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2282);
+ zephir_array_append(&fields, field, PH_SEPARATE, "phalcon/mvc/model.zep", 2281);
+ zephir_array_append(&values, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2281);
+ zephir_array_append(&bindTypes, bindSkip, PH_SEPARATE, "phalcon/mvc/model.zep", 2281);
}
}
}
@@ -2966,12 +2966,12 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_CALL_METHOD(&primaryKeys, metaData, "getprimarykeyattributes", NULL, this_ptr);
zephir_check_call_status();
if (!(zephir_fast_count_int(primaryKeys TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/mvc/model.zep", 2309);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/mvc/model.zep", 2308);
return;
}
ZEPHIR_INIT_NVAR(uniqueParams);
array_init(uniqueParams);
- zephir_is_iterable(primaryKeys, &_13, &_12, 0, 0, "phalcon/mvc/model.zep", 2333);
+ zephir_is_iterable(primaryKeys, &_13, &_12, 0, 0, "phalcon/mvc/model.zep", 2332);
for (
; zephir_hash_get_current_data_ex(_13, (void**) &_14, &_12) == SUCCESS
; zephir_hash_move_forward_ex(_13, &_12)
@@ -2986,7 +2986,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
ZEPHIR_CONCAT_SVS(_6, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _5, "__construct", &_7, _6);
zephir_check_call_status();
- zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2320 TSRMLS_CC);
+ zephir_throw_exception_debug(_5, "phalcon/mvc/model.zep", 2319 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -2995,9 +2995,9 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowUpdate) {
}
ZEPHIR_OBS_NVAR(value);
if (zephir_fetch_property_zval(&value, this_ptr, attributeField, PH_SILENT_CC)) {
- zephir_array_append(&uniqueParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2327);
+ zephir_array_append(&uniqueParams, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2326);
} else {
- zephir_array_append(&uniqueParams, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2329);
+ zephir_array_append(&uniqueParams, ZEPHIR_GLOBAL(global_null), PH_SEPARATE, "phalcon/mvc/model.zep", 2328);
}
}
}
@@ -3041,7 +3041,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSaveRelatedRecords) {
ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmodelsmanager", NULL);
zephir_check_call_status();
ZEPHIR_CPY_WRT(manager, _0);
- zephir_is_iterable(related, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 2439);
+ zephir_is_iterable(related, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 2438);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -3058,7 +3058,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSaveRelatedRecords) {
if (Z_TYPE_P(record) != IS_OBJECT) {
ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_6, (nesting ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects can be stored as part of belongs-to relations", "phalcon/mvc/model.zep", 2388);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects can be stored as part of belongs-to relations", "phalcon/mvc/model.zep", 2387);
return;
}
ZEPHIR_CALL_METHOD(&columns, relation, "getfields", &_7);
@@ -3070,7 +3070,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSaveRelatedRecords) {
if (Z_TYPE_P(columns) == IS_ARRAY) {
ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_6, (nesting ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/mvc/model.zep", 2397);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/mvc/model.zep", 2396);
return;
}
ZEPHIR_CALL_METHOD(&_0, record, "save", NULL);
@@ -3078,7 +3078,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _preSaveRelatedRecords) {
if (!(zephir_is_true(_0))) {
ZEPHIR_CALL_METHOD(&_10, record, "getmessages", NULL);
zephir_check_call_status();
- zephir_is_iterable(_10, &_12, &_11, 0, 0, "phalcon/mvc/model.zep", 2426);
+ zephir_is_iterable(_10, &_12, &_11, 0, 0, "phalcon/mvc/model.zep", 2425);
for (
; zephir_hash_get_current_data_ex(_12, (void**) &_13, &_11) == SUCCESS
; zephir_hash_move_forward_ex(_12, &_11)
@@ -3132,7 +3132,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
ZEPHIR_CALL_METHOD(&_0, this_ptr, "getmodelsmanager", NULL);
zephir_check_call_status();
ZEPHIR_CPY_WRT(manager, _0);
- zephir_is_iterable(related, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 2628);
+ zephir_is_iterable(related, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 2627);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -3155,7 +3155,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
if (_6) {
ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_7, (nesting ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects/arrays can be stored as part of has-many/has-one/has-many-to-many relations", "phalcon/mvc/model.zep", 2478);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Only objects/arrays can be stored as part of has-many/has-one/has-many-to-many relations", "phalcon/mvc/model.zep", 2477);
return;
}
ZEPHIR_CALL_METHOD(&columns, relation, "getfields", &_8);
@@ -3167,7 +3167,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
if (Z_TYPE_P(columns) == IS_ARRAY) {
ZEPHIR_CALL_METHOD(NULL, connection, "rollback", &_7, (nesting ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false)));
zephir_check_call_status();
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/mvc/model.zep", 2487);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Not implemented", "phalcon/mvc/model.zep", 2486);
return;
}
if (Z_TYPE_P(record) == IS_OBJECT) {
@@ -3187,7 +3187,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
ZEPHIR_CONCAT_SVS(_12, "The column '", columns, "' needs to be present in the model");
ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_13, _12);
zephir_check_call_status();
- zephir_throw_exception_debug(_11, "phalcon/mvc/model.zep", 2501 TSRMLS_CC);
+ zephir_throw_exception_debug(_11, "phalcon/mvc/model.zep", 2500 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -3202,7 +3202,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
ZEPHIR_CALL_METHOD(&intermediateReferencedFields, relation, "getintermediatereferencedfields", &_18);
zephir_check_call_status();
}
- zephir_is_iterable(relatedRecords, &_20, &_19, 0, 0, "phalcon/mvc/model.zep", 2617);
+ zephir_is_iterable(relatedRecords, &_20, &_19, 0, 0, "phalcon/mvc/model.zep", 2616);
for (
; zephir_hash_get_current_data_ex(_20, (void**) &_21, &_19) == SUCCESS
; zephir_hash_move_forward_ex(_20, &_19)
@@ -3217,7 +3217,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
if (!(zephir_is_true(_14))) {
ZEPHIR_CALL_METHOD(&_22, recordAfter, "getmessages", NULL);
zephir_check_call_status();
- zephir_is_iterable(_22, &_24, &_23, 0, 0, "phalcon/mvc/model.zep", 2559);
+ zephir_is_iterable(_22, &_24, &_23, 0, 0, "phalcon/mvc/model.zep", 2558);
for (
; zephir_hash_get_current_data_ex(_24, (void**) &_25, &_23) == SUCCESS
; zephir_hash_move_forward_ex(_24, &_23)
@@ -3250,7 +3250,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
if (!(zephir_is_true(_22))) {
ZEPHIR_CALL_METHOD(&_30, intermediateModel, "getmessages", &_31);
zephir_check_call_status();
- zephir_is_iterable(_30, &_33, &_32, 0, 0, "phalcon/mvc/model.zep", 2611);
+ zephir_is_iterable(_30, &_33, &_32, 0, 0, "phalcon/mvc/model.zep", 2610);
for (
; zephir_hash_get_current_data_ex(_33, (void**) &_34, &_32) == SUCCESS
; zephir_hash_move_forward_ex(_33, &_32)
@@ -3279,7 +3279,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _postSaveRelatedRecords) {
ZEPHIR_CONCAT_SVSVS(_12, "There are no defined relations for the model '", className, "' using alias '", name, "'");
ZEPHIR_CALL_METHOD(NULL, _11, "__construct", &_13, _12);
zephir_check_call_status();
- zephir_throw_exception_debug(_11, "phalcon/mvc/model.zep", 2620 TSRMLS_CC);
+ zephir_throw_exception_debug(_11, "phalcon/mvc/model.zep", 2619 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -3399,7 +3399,7 @@ PHP_METHOD(Phalcon_Mvc_Model, save) {
_3 = zephir_fetch_nproperty_this(this_ptr, SL("_errorMessages"), PH_NOISY_CC);
ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_5, this_ptr, _3);
zephir_check_call_status();
- zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 2732 TSRMLS_CC);
+ zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 2731 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -3650,10 +3650,10 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) {
ZVAL_NULL(columnMap);
}
if (!(zephir_fast_count_int(primaryKeys TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/mvc/model.zep", 2925);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A primary key must be defined in the model in order to perform the operation", "phalcon/mvc/model.zep", 2924);
return;
}
- zephir_is_iterable(primaryKeys, &_4, &_3, 0, 0, "phalcon/mvc/model.zep", 2966);
+ zephir_is_iterable(primaryKeys, &_4, &_3, 0, 0, "phalcon/mvc/model.zep", 2965);
for (
; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
; zephir_hash_move_forward_ex(_4, &_3)
@@ -3667,7 +3667,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) {
ZEPHIR_CONCAT_SVS(_7, "Column '", primaryKey, "' have not defined a bind data type");
ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2937 TSRMLS_CC);
+ zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2936 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -3680,7 +3680,7 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) {
ZEPHIR_CONCAT_SVS(_7, "Column '", primaryKey, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2945 TSRMLS_CC);
+ zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2944 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -3695,17 +3695,17 @@ PHP_METHOD(Phalcon_Mvc_Model, delete) {
ZEPHIR_CONCAT_SVS(_7, "Cannot delete the record because the primary key attribute: '", attributeField, "' wasn't set");
ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2955 TSRMLS_CC);
+ zephir_throw_exception_debug(_6, "phalcon/mvc/model.zep", 2954 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
- zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2961);
+ zephir_array_append(&values, value, PH_SEPARATE, "phalcon/mvc/model.zep", 2960);
ZEPHIR_CALL_METHOD(&_2, writeConnection, "escapeidentifier", &_9, primaryKey);
zephir_check_call_status();
ZEPHIR_INIT_LNVAR(_7);
ZEPHIR_CONCAT_VS(_7, _2, " = ?");
- zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model.zep", 2962);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2963);
+ zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model.zep", 2961);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model.zep", 2962);
}
if (ZEPHIR_GLOBAL(orm).events) {
zephir_update_property_this(this_ptr, SL("_skipped"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
@@ -3788,7 +3788,7 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) {
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_dirtyState"), PH_NOISY_CC);
if (!ZEPHIR_IS_LONG(_0, 0)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3041);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3040);
return;
}
ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL);
@@ -3813,7 +3813,7 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) {
ZEPHIR_CALL_METHOD(&_1, this_ptr, "_exists", NULL, metaData, readConnection, table);
zephir_check_call_status();
if (!(zephir_is_true(_1))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3063);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3062);
return;
}
ZEPHIR_OBS_NVAR(uniqueKey);
@@ -3822,14 +3822,14 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) {
ZEPHIR_OBS_VAR(uniqueParams);
zephir_read_property_this(&uniqueParams, this_ptr, SL("_uniqueParams"), PH_NOISY_CC);
if (Z_TYPE_P(uniqueParams) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3071);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record cannot be refreshed because it does not exist or is deleted", "phalcon/mvc/model.zep", 3070);
return;
}
ZEPHIR_INIT_VAR(fields);
array_init(fields);
ZEPHIR_CALL_METHOD(&_1, metaData, "getattributes", NULL, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 3085);
+ zephir_is_iterable(_1, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 3084);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -3838,7 +3838,7 @@ PHP_METHOD(Phalcon_Mvc_Model, refresh) {
ZEPHIR_INIT_NVAR(_5);
zephir_create_array(_5, 1, 0 TSRMLS_CC);
zephir_array_fast_append(_5, attribute);
- zephir_array_append(&fields, _5, PH_SEPARATE, "phalcon/mvc/model.zep", 3079);
+ zephir_array_append(&fields, _5, PH_SEPARATE, "phalcon/mvc/model.zep", 3078);
}
ZEPHIR_CALL_METHOD(&dialect, readConnection, "getdialect", NULL);
zephir_check_call_status();
@@ -3994,7 +3994,7 @@ PHP_METHOD(Phalcon_Mvc_Model, skipAttributes) {
ZEPHIR_INIT_VAR(keysAttributes);
array_init(keysAttributes);
- zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3172);
+ zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3171);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -4047,7 +4047,7 @@ PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnCreate) {
ZEPHIR_INIT_VAR(keysAttributes);
array_init(keysAttributes);
- zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3204);
+ zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3203);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -4098,7 +4098,7 @@ PHP_METHOD(Phalcon_Mvc_Model, skipAttributesOnUpdate) {
ZEPHIR_INIT_VAR(keysAttributes);
array_init(keysAttributes);
- zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3234);
+ zephir_is_iterable(attributes, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3233);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -4462,7 +4462,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) {
if (Z_TYPE_P(columnMap) == IS_ARRAY) {
ZEPHIR_INIT_VAR(snapshot);
array_init(snapshot);
- zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3457);
+ zephir_is_iterable(data, &_1, &_0, 0, 0, "phalcon/mvc/model.zep", 3456);
for (
; zephir_hash_get_current_data_ex(_1, (void**) &_2, &_0) == SUCCESS
; zephir_hash_move_forward_ex(_1, &_0)
@@ -4480,7 +4480,7 @@ PHP_METHOD(Phalcon_Mvc_Model, setSnapshotData) {
ZEPHIR_CONCAT_SVS(_4, "Column '", key, "' doesn't make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _3, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 3451 TSRMLS_CC);
+ zephir_throw_exception_debug(_3, "phalcon/mvc/model.zep", 3450 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -4542,12 +4542,12 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) {
ZEPHIR_OBS_VAR(snapshot);
zephir_read_property_this(&snapshot, this_ptr, SL("_snapshot"), PH_NOISY_CC);
if (Z_TYPE_P(snapshot) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record doesn't have a valid data snapshot", "phalcon/mvc/model.zep", 3496);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record doesn't have a valid data snapshot", "phalcon/mvc/model.zep", 3495);
return;
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_dirtyState"), PH_NOISY_CC);
if (!ZEPHIR_IS_LONG(_0, 0)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Change checking cannot be performed because the object has not been persisted or is deleted", "phalcon/mvc/model.zep", 3503);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Change checking cannot be performed because the object has not been persisted or is deleted", "phalcon/mvc/model.zep", 3502);
return;
}
ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL);
@@ -4569,7 +4569,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) {
ZEPHIR_CONCAT_SVS(_2, "The field '", fieldName, "' is not part of the model");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3535 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3534 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -4581,7 +4581,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) {
ZEPHIR_CONCAT_SVS(_2, "The field '", fieldName, "' is not part of the model");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3539 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3538 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -4594,7 +4594,7 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) {
ZEPHIR_CONCAT_SVS(_2, "The field '", fieldName, "' is not defined on the model");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3547 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3546 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -4606,14 +4606,14 @@ PHP_METHOD(Phalcon_Mvc_Model, hasChanged) {
ZEPHIR_CONCAT_SVS(_4, "The field '", fieldName, "' was not found in the snapshot");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3554 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3553 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
RETURN_MM_BOOL(!ZEPHIR_IS_EQUAL(value, originalValue));
}
ZEPHIR_INIT_NVAR(_1);
- zephir_is_iterable(allAttributes, &_6, &_5, 0, 0, "phalcon/mvc/model.zep", 3590);
+ zephir_is_iterable(allAttributes, &_6, &_5, 0, 0, "phalcon/mvc/model.zep", 3589);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
@@ -4651,12 +4651,12 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) {
ZEPHIR_OBS_VAR(snapshot);
zephir_read_property_this(&snapshot, this_ptr, SL("_snapshot"), PH_NOISY_CC);
if (Z_TYPE_P(snapshot) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record doesn't have a valid data snapshot", "phalcon/mvc/model.zep", 3603);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The record doesn't have a valid data snapshot", "phalcon/mvc/model.zep", 3602);
return;
}
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_dirtyState"), PH_NOISY_CC);
if (!ZEPHIR_IS_LONG(_0, 0)) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Change checking cannot be performed because the object has not been persisted or is deleted", "phalcon/mvc/model.zep", 3610);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Change checking cannot be performed because the object has not been persisted or is deleted", "phalcon/mvc/model.zep", 3609);
return;
}
ZEPHIR_CALL_METHOD(&metaData, this_ptr, "getmodelsmetadata", NULL);
@@ -4672,7 +4672,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) {
ZEPHIR_INIT_VAR(changed);
array_init(changed);
ZEPHIR_INIT_VAR(_1);
- zephir_is_iterable(allAttributes, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 3664);
+ zephir_is_iterable(allAttributes, &_3, &_2, 0, 0, "phalcon/mvc/model.zep", 3663);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -4680,17 +4680,17 @@ PHP_METHOD(Phalcon_Mvc_Model, getChangedFields) {
ZEPHIR_GET_HMKEY(name, _3, _2);
ZEPHIR_GET_HVALUE(_1, _4);
if (!(zephir_array_isset(snapshot, name))) {
- zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3642);
+ zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3641);
continue;
}
ZEPHIR_OBS_NVAR(value);
if (!(zephir_fetch_property_zval(&value, this_ptr, name, PH_SILENT_CC))) {
- zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3650);
+ zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3649);
continue;
}
- zephir_array_fetch(&_5, snapshot, name, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 3657 TSRMLS_CC);
+ zephir_array_fetch(&_5, snapshot, name, PH_NOISY | PH_READONLY, "phalcon/mvc/model.zep", 3656 TSRMLS_CC);
if (!ZEPHIR_IS_EQUAL(value, _5)) {
- zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3658);
+ zephir_array_append(&changed, name, PH_SEPARATE, "phalcon/mvc/model.zep", 3657);
continue;
}
}
@@ -4772,7 +4772,7 @@ PHP_METHOD(Phalcon_Mvc_Model, getRelated) {
ZEPHIR_CONCAT_SVSVS(_3, "There is no defined relations for the model '", className, "' using alias '", alias, "'");
ZEPHIR_CALL_METHOD(NULL, _2, "__construct", &_4, _3);
zephir_check_call_status();
- zephir_throw_exception_debug(_2, "phalcon/mvc/model.zep", 3707 TSRMLS_CC);
+ zephir_throw_exception_debug(_2, "phalcon/mvc/model.zep", 3706 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -4929,7 +4929,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __call) {
ZEPHIR_CONCAT_SVSVS(_2, "The method '", method, "' doesn't exist on model '", modelName, "'");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3799 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3798 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
@@ -4999,7 +4999,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __callStatic) {
ZEPHIR_CONCAT_SVSVS(_2, "The static method '", method, "' doesn't exist on model '", modelName, "'");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3850 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3849 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -5011,7 +5011,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __callStatic) {
ZEPHIR_CONCAT_SVS(_4, "The static method '", method, "' requires one argument");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3854 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3853 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -5048,7 +5048,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __callStatic) {
ZEPHIR_CONCAT_SVS(_2, "Cannot resolve attribute '", extraMethod, "' in the model");
ZEPHIR_CALL_METHOD(NULL, _1, "__construct", &_3, _2);
zephir_check_call_status();
- zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3888 TSRMLS_CC);
+ zephir_throw_exception_debug(_1, "phalcon/mvc/model.zep", 3887 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -5113,7 +5113,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) {
zephir_check_call_status();
ZEPHIR_INIT_VAR(related);
array_init(related);
- zephir_is_iterable(value, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 3952);
+ zephir_is_iterable(value, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 3951);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -5122,7 +5122,7 @@ PHP_METHOD(Phalcon_Mvc_Model, __set) {
ZEPHIR_GET_HVALUE(item, _3);
if (Z_TYPE_P(item) == IS_OBJECT) {
if (zephir_instance_of_ev(item, phalcon_mvc_modelinterface_ce TSRMLS_CC)) {
- zephir_array_append(&related, item, PH_SEPARATE, "phalcon/mvc/model.zep", 3939);
+ zephir_array_append(&related, item, PH_SEPARATE, "phalcon/mvc/model.zep", 3938);
}
} else {
ZEPHIR_INIT_NVAR(lowerKey);
@@ -5295,7 +5295,7 @@ PHP_METHOD(Phalcon_Mvc_Model, serialize) {
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_0, metaData, "getattributes", NULL, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 4083);
+ zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 4082);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -5310,7 +5310,7 @@ PHP_METHOD(Phalcon_Mvc_Model, serialize) {
ZEPHIR_CONCAT_SVS(_5, "Column '", attribute, "' doesn't make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_6, _5);
zephir_check_call_status();
- zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 4067 TSRMLS_CC);
+ zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 4066 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -5364,7 +5364,7 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) {
ZEPHIR_CALL_CE_STATIC(&dependencyInjector, phalcon_di_ce, "getdefault", &_1);
zephir_check_call_status();
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 4101);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM", "phalcon/mvc/model.zep", 4100);
return;
}
zephir_update_property_this(this_ptr, SL("_dependencyInjector"), dependencyInjector TSRMLS_CC);
@@ -5375,13 +5375,13 @@ PHP_METHOD(Phalcon_Mvc_Model, unserialize) {
zephir_check_call_status();
ZEPHIR_CPY_WRT(manager, _2);
if (Z_TYPE_P(manager) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/mvc/model.zep", 4114);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The injected service 'modelsManager' is not valid", "phalcon/mvc/model.zep", 4113);
return;
}
zephir_update_property_this(this_ptr, SL("_modelsManager"), manager TSRMLS_CC);
ZEPHIR_CALL_METHOD(NULL, manager, "initialize", NULL, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(attributes, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 4133);
+ zephir_is_iterable(attributes, &_5, &_4, 0, 0, "phalcon/mvc/model.zep", 4132);
for (
; zephir_hash_get_current_data_ex(_5, (void**) &_6, &_4) == SUCCESS
; zephir_hash_move_forward_ex(_5, &_4)
@@ -5449,7 +5449,7 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) {
zephir_check_call_status();
ZEPHIR_CALL_METHOD(&_0, metaData, "getattributes", NULL, this_ptr);
zephir_check_call_status();
- zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 4192);
+ zephir_is_iterable(_0, &_2, &_1, 0, 0, "phalcon/mvc/model.zep", 4191);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -5464,7 +5464,7 @@ PHP_METHOD(Phalcon_Mvc_Model, toArray) {
ZEPHIR_CONCAT_SVS(_5, "Column '", attribute, "' doesn't make part of the column map");
ZEPHIR_CALL_METHOD(NULL, _4, "__construct", &_6, _5);
zephir_check_call_status();
- zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 4173 TSRMLS_CC);
+ zephir_throw_exception_debug(_4, "phalcon/mvc/model.zep", 4172 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
diff --git a/ext/phalcon/mvc/model/resultset.zep.c b/ext/phalcon/mvc/model/resultset.zep.c
index 3c651afa3ef..e00664647bb 100644
--- a/ext/phalcon/mvc/model/resultset.zep.c
+++ b/ext/phalcon/mvc/model/resultset.zep.c
@@ -13,10 +13,10 @@
#include "kernel/main.h"
#include "ext/spl/spl_iterators.h"
+#include "kernel/fcall.h"
#include "kernel/object.h"
#include "kernel/operators.h"
#include "kernel/memory.h"
-#include "kernel/fcall.h"
#include "kernel/exception.h"
#include "ext/spl/spl_exceptions.h"
#include "kernel/iterator.h"
@@ -48,7 +48,6 @@
* $robots->next();
* }
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset) {
@@ -62,7 +61,7 @@ ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset) {
zend_declare_property_bool(phalcon_mvc_model_resultset_ce, SL("_isFresh"), 1, ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_property_long(phalcon_mvc_model_resultset_ce, SL("_pointer"), -1, ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_long(phalcon_mvc_model_resultset_ce, SL("_pointer"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(phalcon_mvc_model_resultset_ce, SL("_count"), ZEND_ACC_PROTECTED TSRMLS_CC);
@@ -70,6 +69,8 @@ ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset) {
zend_declare_property_null(phalcon_mvc_model_resultset_ce, SL("_rows"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(phalcon_mvc_model_resultset_ce, SL("_row"), ZEND_ACC_PROTECTED TSRMLS_CC);
+
zend_declare_property_null(phalcon_mvc_model_resultset_ce, SL("_errorMessages"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_long(phalcon_mvc_model_resultset_ce, SL("_hydrateMode"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
@@ -99,20 +100,57 @@ ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, next) {
+ zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *_0, _1;
- RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_pointer") TSRMLS_CC));
+ ZEPHIR_MM_GROW();
+
+ _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ ZEPHIR_SINIT_VAR(_1);
+ ZVAL_LONG(&_1, (zephir_get_numberval(_0) + 1));
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_2, &_1);
+ zephir_check_call_status();
+ ZEPHIR_MM_RESTORE();
+
+}
+
+/**
+ * Check whether internal resource has rows to fetch
+ */
+PHP_METHOD(Phalcon_Mvc_Model_Resultset, valid) {
+
+ zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *_0, *_1 = NULL;
+
+ ZEPHIR_MM_GROW();
+
+ _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ ZEPHIR_CALL_METHOD(&_1, this_ptr, "count", &_2);
+ zephir_check_call_status();
+ RETURN_MM_BOOL(ZEPHIR_LT(_0, _1));
}
/**
* Gets pointer number of active row in the resultset
- *
- * @return int
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, key) {
+ zephir_nts_static zephir_fcall_cache_entry *_2 = NULL;
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *_0, *_1 = NULL;
- RETURN_MEMBER(this_ptr, "_pointer");
+ ZEPHIR_MM_GROW();
+
+ _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ ZEPHIR_CALL_METHOD(&_1, this_ptr, "count", &_2);
+ zephir_check_call_status();
+ if (ZEPHIR_GE(_0, _1)) {
+ RETURN_MM_NULL();
+ }
+ RETURN_MM_MEMBER(this_ptr, "_pointer");
}
@@ -121,47 +159,16 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, key) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind) {
- zephir_nts_static zephir_fcall_cache_entry *_3 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *rows = NULL, *result = NULL, *_0, *_1, *_2;
+ zval _0;
ZEPHIR_MM_GROW();
- _0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC);
- if (zephir_is_true(_0)) {
- ZEPHIR_OBS_VAR(result);
- zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
- if (!ZEPHIR_IS_FALSE_IDENTICAL(result)) {
- _1 = zephir_fetch_nproperty_this(this_ptr, SL("_activeRow"), PH_NOISY_CC);
- if (Z_TYPE_P(_1) != IS_NULL) {
- ZEPHIR_INIT_VAR(_2);
- ZVAL_LONG(_2, 0);
- ZEPHIR_CALL_METHOD(NULL, result, "dataseek", NULL, _2);
- zephir_check_call_status();
- }
- }
- } else {
- ZEPHIR_OBS_VAR(rows);
- zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC);
- if (Z_TYPE_P(rows) == IS_NULL) {
- ZEPHIR_OBS_NVAR(result);
- zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
- if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_CALL_METHOD(&rows, result, "fetchall", NULL);
- zephir_check_call_status();
- zephir_update_property_this(this_ptr, SL("_rows"), rows TSRMLS_CC);
- }
- }
- if (Z_TYPE_P(rows) == IS_ARRAY) {
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(NULL, "reset", &_3, rows);
- Z_UNSET_ISREF_P(rows);
- zephir_check_call_status();
- }
- }
- ZEPHIR_INIT_ZVAL_NREF(_1);
- ZVAL_LONG(_1, 0);
- zephir_update_property_this(this_ptr, SL("_pointer"), _1 TSRMLS_CC);
+ ZEPHIR_SINIT_VAR(_0);
+ ZVAL_LONG(&_0, 0);
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_1, &_0);
+ zephir_check_call_status();
ZEPHIR_MM_RESTORE();
}
@@ -171,9 +178,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, seek) {
- zephir_nts_static zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL;
- zval *position_param = NULL, *result = NULL, *rows = NULL, *_0, *_1, *_2, *_5;
- int position, i, ZEPHIR_LAST_CALL_STATUS;
+ zend_bool _2, _5;
+ zval *position_param = NULL, *result, *_0, *_1, *_3, *_4, *_6, *_7, *_8 = NULL, *_9;
+ int position, ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &position_param);
@@ -181,51 +188,57 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, seek) {
position = zephir_get_intval(position_param);
- _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
- if (!ZEPHIR_IS_LONG(_0, position)) {
- _1 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC);
- if (zephir_is_true(_1)) {
+ _0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC);
+ if (zephir_is_true(_0)) {
+ _1 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC);
+ _2 = Z_TYPE_P(_1) == IS_NULL;
+ if (!(_2)) {
+ _3 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ _2 = !ZEPHIR_IS_LONG(_3, position);
+ }
+ if (_2) {
ZEPHIR_OBS_VAR(result);
zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
if (!ZEPHIR_IS_FALSE_IDENTICAL(result)) {
- ZEPHIR_INIT_VAR(_2);
- ZVAL_LONG(_2, position);
- ZEPHIR_CALL_METHOD(NULL, result, "dataseek", NULL, _2);
- zephir_check_call_status();
- }
- } else {
- ZEPHIR_OBS_VAR(rows);
- zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC);
- if (Z_TYPE_P(rows) == IS_NULL) {
- ZEPHIR_OBS_NVAR(result);
- zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
- if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_CALL_METHOD(&rows, result, "fetchall", NULL);
+ _4 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC);
+ _5 = Z_TYPE_P(_4) == IS_NULL;
+ if (!(_5)) {
+ _6 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ _5 = ZEPHIR_GT_LONG(_6, position);
+ }
+ if (_5) {
+ ZEPHIR_INIT_VAR(_7);
+ ZVAL_LONG(_7, position);
+ ZEPHIR_CALL_METHOD(NULL, result, "dataseek", NULL, _7);
zephir_check_call_status();
- zephir_update_property_this(this_ptr, SL("_rows"), rows TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&_8, result, "fetch", NULL, result);
+ zephir_check_call_status();
+ zephir_update_property_this(this_ptr, SL("_row"), _8 TSRMLS_CC);
}
- }
- if (Z_TYPE_P(rows) == IS_ARRAY) {
- i = 0;
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(NULL, "reset", &_3, rows);
- Z_UNSET_ISREF_P(rows);
- zephir_check_call_status();
while (1) {
- if (!(i < position)) {
+ _9 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ if (!(ZEPHIR_LT_LONG(_9, position))) {
break;
}
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(NULL, "next", &_4, rows);
- Z_UNSET_ISREF_P(rows);
+ ZEPHIR_CALL_METHOD(&_8, result, "fetch", NULL, result);
zephir_check_call_status();
- i++;
+ zephir_update_property_this(this_ptr, SL("_row"), _8 TSRMLS_CC);
+ RETURN_ON_FAILURE(zephir_property_incr(this_ptr, SL("_pointer") TSRMLS_CC));
}
}
+ ZEPHIR_INIT_ZVAL_NREF(_4);
+ ZVAL_LONG(_4, position);
+ zephir_update_property_this(this_ptr, SL("_pointer"), _4 TSRMLS_CC);
+ zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
+ }
+ } else {
+ _1 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ if (!ZEPHIR_IS_LONG(_1, position)) {
+ ZEPHIR_INIT_ZVAL_NREF(_3);
+ ZVAL_LONG(_3, position);
+ zephir_update_property_this(this_ptr, SL("_pointer"), _3 TSRMLS_CC);
+ zephir_update_property_this(this_ptr, SL("_activeRow"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
}
- ZEPHIR_INIT_ZVAL_NREF(_5);
- ZVAL_LONG(_5, position);
- zephir_update_property_this(this_ptr, SL("_pointer"), _5 TSRMLS_CC);
}
ZEPHIR_MM_RESTORE();
@@ -303,8 +316,8 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetExists) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetGet) {
- zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL, *_5 = NULL;
- zval *index_param = NULL, *_0 = NULL, *_2, _4, *_6 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL;
+ zval *index_param = NULL, *_0 = NULL, _2;
int index, ZEPHIR_LAST_CALL_STATUS;
ZEPHIR_MM_GROW();
@@ -321,26 +334,15 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetGet) {
ZEPHIR_CALL_METHOD(&_0, this_ptr, "count", &_1);
zephir_check_call_status();
if (ZEPHIR_GT_LONG(_0, index)) {
- _2 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
- if (ZEPHIR_IS_LONG(_2, index)) {
- ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", &_3);
- zephir_check_call_status();
- RETURN_MM();
- }
- ZEPHIR_SINIT_VAR(_4);
- ZVAL_LONG(&_4, index);
- ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_5, &_4);
+ ZEPHIR_SINIT_VAR(_2);
+ ZVAL_LONG(&_2, index);
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_3, &_2);
zephir_check_call_status();
- ZEPHIR_CALL_METHOD(&_6, this_ptr, "valid", NULL);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", NULL);
zephir_check_call_status();
- if (!ZEPHIR_IS_FALSE_IDENTICAL(_6)) {
- ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", &_3);
- zephir_check_call_status();
- RETURN_MM();
- }
- RETURN_MM_BOOL(0);
+ RETURN_MM();
}
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The index does not exist in the cursor", "phalcon/mvc/model/resultset.zep", 272);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The index does not exist in the cursor", "phalcon/mvc/model/resultset.zep", 242);
return;
}
@@ -359,7 +361,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetSet) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_mvc_model_exception_ce, "Cursor is an immutable ArrayAccess object", "phalcon/mvc/model/resultset.zep", 283);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_mvc_model_exception_ce, "Cursor is an immutable ArrayAccess object", "phalcon/mvc/model/resultset.zep", 253);
return;
}
@@ -377,7 +379,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetUnset) {
offset = zephir_get_intval(offset_param);
- ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_mvc_model_exception_ce, "Cursor is an immutable ArrayAccess object", "phalcon/mvc/model/resultset.zep", 291);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(phalcon_mvc_model_exception_ce, "Cursor is an immutable ArrayAccess object", "phalcon/mvc/model/resultset.zep", 261);
return;
}
@@ -397,28 +399,24 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getType) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, getFirst) {
- zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_2 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *_0, *_3 = NULL;
+ zval *_0 = NULL, _2;
ZEPHIR_MM_GROW();
- _0 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ ZEPHIR_CALL_METHOD(&_0, this_ptr, "count", &_1);
+ zephir_check_call_status();
if (ZEPHIR_IS_LONG(_0, 0)) {
- ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", &_1);
- zephir_check_call_status();
- RETURN_MM();
+ RETURN_MM_BOOL(0);
}
- ZEPHIR_CALL_METHOD(NULL, this_ptr, "rewind", &_2);
+ ZEPHIR_SINIT_VAR(_2);
+ ZVAL_LONG(&_2, 0);
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_3, &_2);
zephir_check_call_status();
- ZEPHIR_CALL_METHOD(&_3, this_ptr, "valid", NULL);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", NULL);
zephir_check_call_status();
- if (!ZEPHIR_IS_FALSE_IDENTICAL(_3)) {
- ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", &_1);
- zephir_check_call_status();
- RETURN_MM();
- }
- RETURN_MM_BOOL(0);
+ RETURN_MM();
}
@@ -427,26 +425,24 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getFirst) {
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset, getLast) {
- zephir_nts_static zephir_fcall_cache_entry *_1 = NULL, *_3 = NULL, *_5 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_2 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *_0 = NULL, _2, *_4 = NULL;
+ zval *count = NULL, _1;
ZEPHIR_MM_GROW();
- ZEPHIR_CALL_METHOD(&_0, this_ptr, "count", &_1);
+ ZEPHIR_CALL_METHOD(&count, this_ptr, "count", &_0);
zephir_check_call_status();
- ZEPHIR_SINIT_VAR(_2);
- ZVAL_LONG(&_2, (zephir_get_numberval(_0) - 1));
- ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_3, &_2);
+ if (ZEPHIR_IS_LONG(count, 0)) {
+ RETURN_MM_BOOL(0);
+ }
+ ZEPHIR_SINIT_VAR(_1);
+ ZVAL_LONG(&_1, (zephir_get_numberval(count) - 1));
+ ZEPHIR_CALL_METHOD(NULL, this_ptr, "seek", &_2, &_1);
zephir_check_call_status();
- ZEPHIR_CALL_METHOD(&_4, this_ptr, "valid", NULL);
+ ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", NULL);
zephir_check_call_status();
- if (!ZEPHIR_IS_FALSE_IDENTICAL(_4)) {
- ZEPHIR_RETURN_CALL_METHOD(this_ptr, "current", &_5);
- zephir_check_call_status();
- RETURN_MM();
- }
- RETURN_MM_BOOL(0);
+ RETURN_MM();
}
@@ -518,16 +514,6 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getCache) {
}
-/**
- * Returns current row in the resultset
- */
-PHP_METHOD(Phalcon_Mvc_Model_Resultset, current) {
-
-
- RETURN_MEMBER(this_ptr, "_activeRow");
-
-}
-
/**
* Returns the error messages produced by a batch operation
*/
@@ -574,7 +560,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, update) {
}
if (transaction == 0) {
if (!((zephir_method_exists_ex(record, SS("getwriteconnection") TSRMLS_CC) == SUCCESS))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The returned record is not valid", "phalcon/mvc/model/resultset.zep", 415);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The returned record is not valid", "phalcon/mvc/model/resultset.zep", 371);
return;
}
ZEPHIR_CALL_METHOD(&connection, record, "getwriteconnection", NULL);
@@ -647,7 +633,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, delete) {
}
if (transaction == 0) {
if (!((zephir_method_exists_ex(record, SS("getwriteconnection") TSRMLS_CC) == SUCCESS))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The returned record is not valid", "phalcon/mvc/model/resultset.zep", 478);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "The returned record is not valid", "phalcon/mvc/model/resultset.zep", 434);
return;
}
ZEPHIR_CALL_METHOD(&connection, record, "getwriteconnection", NULL);
@@ -725,7 +711,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, filter) {
_0->funcs->get_current_data(_0, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC);
ZEPHIR_CPY_WRT(record, (*ZEPHIR_TMP_ITERATOR_PTR));
}
- zephir_array_update_long(¶meters, 0, &record, PH_COPY | PH_SEPARATE, "phalcon/mvc/model/resultset.zep", 547);
+ zephir_array_update_long(¶meters, 0, &record, PH_COPY | PH_SEPARATE, "phalcon/mvc/model/resultset.zep", 503);
ZEPHIR_INIT_NVAR(processedRecord);
ZEPHIR_CALL_USER_FUNC_ARRAY(processedRecord, filter, parameters);
zephir_check_call_status();
@@ -734,7 +720,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, filter) {
continue;
}
}
- zephir_array_append(&records, processedRecord, PH_SEPARATE, "phalcon/mvc/model/resultset.zep", 559);
+ zephir_array_append(&records, processedRecord, PH_SEPARATE, "phalcon/mvc/model/resultset.zep", 515);
}
_0->funcs->dtor(_0 TSRMLS_CC);
RETURN_CCTOR(records);
diff --git a/ext/phalcon/mvc/model/resultset.zep.h b/ext/phalcon/mvc/model/resultset.zep.h
index 394b9532539..9be3a9fd17e 100644
--- a/ext/phalcon/mvc/model/resultset.zep.h
+++ b/ext/phalcon/mvc/model/resultset.zep.h
@@ -4,6 +4,7 @@ extern zend_class_entry *phalcon_mvc_model_resultset_ce;
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, next);
+PHP_METHOD(Phalcon_Mvc_Model_Resultset, valid);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, key);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, seek);
@@ -20,7 +21,6 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset, isFresh);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, setHydrateMode);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, getHydrateMode);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, getCache);
-PHP_METHOD(Phalcon_Mvc_Model_Resultset, current);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, getMessages);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, update);
PHP_METHOD(Phalcon_Mvc_Model_Resultset, delete);
@@ -70,6 +70,7 @@ ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(phalcon_mvc_model_resultset_method_entry) {
PHP_ME(Phalcon_Mvc_Model_Resultset, next, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Mvc_Model_Resultset, valid, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, key, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, rewind, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Mvc_Model_Resultset, seek, arginfo_phalcon_mvc_model_resultset_seek, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
@@ -86,7 +87,6 @@ ZEPHIR_INIT_FUNCS(phalcon_mvc_model_resultset_method_entry) {
PHP_ME(Phalcon_Mvc_Model_Resultset, setHydrateMode, arginfo_phalcon_mvc_model_resultset_sethydratemode, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, getHydrateMode, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, getCache, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Phalcon_Mvc_Model_Resultset, current, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Mvc_Model_Resultset, getMessages, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, update, arginfo_phalcon_mvc_model_resultset_update, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset, delete, arginfo_phalcon_mvc_model_resultset_delete, ZEND_ACC_PUBLIC)
diff --git a/ext/phalcon/mvc/model/resultset/complex.zep.c b/ext/phalcon/mvc/model/resultset/complex.zep.c
index e278a25369f..e5b4ccd412b 100644
--- a/ext/phalcon/mvc/model/resultset/complex.zep.c
+++ b/ext/phalcon/mvc/model/resultset/complex.zep.c
@@ -16,12 +16,13 @@
#include "kernel/operators.h"
#include "kernel/memory.h"
#include "kernel/fcall.h"
+#include "kernel/array.h"
#include "kernel/hash.h"
#include "kernel/exception.h"
-#include "kernel/array.h"
#include "kernel/concat.h"
#include "kernel/string.h"
#include "kernel/iterator.h"
+#include "ext/spl/spl_exceptions.h"
/**
@@ -80,175 +81,179 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct) {
}
/**
- * Check whether internal resource has rows to fetch
+ * Returns current row in the resultset
*/
-PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid) {
+PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current) {
- zephir_fcall_cache_entry *_10 = NULL, *_13 = NULL;
- HashTable *_4, *_7;
- HashPosition _3, _6;
- zend_bool _2;
- zephir_nts_static zephir_fcall_cache_entry *_0 = NULL, *_1 = NULL;
+ zephir_fcall_cache_entry *_13 = NULL, *_16 = NULL;
+ HashTable *_7, *_10;
+ HashPosition _6, _9;
+ zend_bool _5;
int dirtyState, ZEPHIR_LAST_CALL_STATUS;
- zval *result, *rows, *row = NULL, *underscore, *hydrateMode, *alias = NULL, *activeRow = NULL, *type = NULL, *columnTypes, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *isPartial, **_5, **_8, *_9 = NULL, *_11, *_12 = NULL, _14 = zval_used_for_init;
+ zval *result, *row = NULL, *underscore, *hydrateMode, *alias = NULL, *activeRow = NULL, *type = NULL, *columnTypes, *column = NULL, *columnValue = NULL, *value = NULL, *attribute = NULL, *source = NULL, *attributes = NULL, *columnMap = NULL, *rowModel = NULL, *keepSnapshots = NULL, *sqlAlias = NULL, *isPartial, *_0, *_1 = NULL, *_2, *_3, *_4, **_8, **_11, *_12 = NULL, *_14, *_15 = NULL, _17 = zval_used_for_init;
ZEPHIR_MM_GROW();
+ ZEPHIR_OBS_VAR(activeRow);
+ zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC);
+ if (Z_TYPE_P(activeRow) != IS_NULL) {
+ RETURN_CCTOR(activeRow);
+ }
ZEPHIR_OBS_VAR(isPartial);
zephir_read_property_this(&isPartial, this_ptr, SL("_type"), PH_NOISY_CC);
if (zephir_is_true(isPartial)) {
- ZEPHIR_OBS_VAR(result);
- zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
- if (!ZEPHIR_IS_FALSE_IDENTICAL(result)) {
- ZEPHIR_CALL_METHOD(&row, result, "fetch", NULL, result);
- zephir_check_call_status();
- } else {
- ZEPHIR_INIT_NVAR(row);
- ZVAL_BOOL(row, 0);
- }
+ ZEPHIR_OBS_VAR(row);
+ zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC);
} else {
- ZEPHIR_OBS_VAR(rows);
- zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC);
- if (Z_TYPE_P(rows) == IS_ARRAY) {
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(&row, "current", &_0, rows);
- Z_UNSET_ISREF_P(rows);
- zephir_check_call_status();
- if (Z_TYPE_P(row) == IS_OBJECT) {
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(NULL, "next", &_1, rows);
- Z_UNSET_ISREF_P(rows);
+ _0 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC);
+ if (Z_TYPE_P(_0) == IS_NULL) {
+ ZEPHIR_OBS_VAR(result);
+ zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
+ if (Z_TYPE_P(result) == IS_OBJECT) {
+ ZEPHIR_CALL_METHOD(&_1, result, "fetchall", NULL);
zephir_check_call_status();
+ zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC);
+ }
+ }
+ ZEPHIR_OBS_VAR(_2);
+ zephir_read_property_this(&_2, this_ptr, SL("_rows"), PH_NOISY_CC);
+ if (Z_TYPE_P(_2) == IS_ARRAY) {
+ ZEPHIR_OBS_NVAR(row);
+ _3 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC);
+ _4 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ if (!(zephir_array_isset_fetch(&row, _3, _4, 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(row);
+ ZVAL_BOOL(row, 0);
}
} else {
ZEPHIR_INIT_NVAR(row);
ZVAL_BOOL(row, 0);
}
}
- _2 = Z_TYPE_P(row) == IS_OBJECT;
- if (!(_2)) {
- _2 = Z_TYPE_P(row) == IS_ARRAY;
+ _5 = Z_TYPE_P(row) != IS_OBJECT;
+ if (_5) {
+ _5 = Z_TYPE_P(row) != IS_ARRAY;
+ }
+ if (_5) {
+ zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
+ RETURN_MM_BOOL(0);
}
- if (_2) {
- if (zephir_is_true(isPartial)) {
- ZEPHIR_OBS_VAR(hydrateMode);
- zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
- ZEPHIR_INIT_VAR(underscore);
- ZVAL_STRING(underscore, "_", 1);
+ if (!(zephir_is_true(isPartial))) {
+ zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC);
+ RETURN_CCTOR(row);
+ }
+ ZEPHIR_OBS_VAR(hydrateMode);
+ zephir_read_property_this(&hydrateMode, this_ptr, SL("_hydrateMode"), PH_NOISY_CC);
+ ZEPHIR_INIT_VAR(underscore);
+ ZVAL_STRING(underscore, "_", 1);
+ do {
+ if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
+ ZEPHIR_INIT_NVAR(activeRow);
+ object_init_ex(activeRow, phalcon_mvc_model_row_ce);
+ if (zephir_has_constructor(activeRow TSRMLS_CC)) {
+ ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL);
+ zephir_check_call_status();
+ }
+ break;
+ }
+ if (ZEPHIR_IS_LONG(hydrateMode, 1)) {
+ ZEPHIR_INIT_NVAR(activeRow);
+ array_init(activeRow);
+ break;
+ }
+ ZEPHIR_INIT_NVAR(activeRow);
+ object_init(activeRow);
+ break;
+ } while(0);
+
+ ZEPHIR_OBS_VAR(columnTypes);
+ zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC);
+ dirtyState = 0;
+ zephir_is_iterable(columnTypes, &_7, &_6, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 272);
+ for (
+ ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS
+ ; zephir_hash_move_forward_ex(_7, &_6)
+ ) {
+ ZEPHIR_GET_HMKEY(alias, _7, _6);
+ ZEPHIR_GET_HVALUE(column, _8);
+ if (Z_TYPE_P(column) != IS_ARRAY) {
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 173);
+ return;
+ }
+ ZEPHIR_OBS_NVAR(type);
+ zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 176 TSRMLS_CC);
+ if (ZEPHIR_IS_STRING(type, "object")) {
+ ZEPHIR_OBS_NVAR(source);
+ zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 182 TSRMLS_CC);
+ ZEPHIR_OBS_NVAR(attributes);
+ zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 183 TSRMLS_CC);
+ ZEPHIR_OBS_NVAR(columnMap);
+ zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 184 TSRMLS_CC);
+ ZEPHIR_INIT_NVAR(rowModel);
+ array_init(rowModel);
+ zephir_is_iterable(attributes, &_10, &_9, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 202);
+ for (
+ ; zephir_hash_get_current_data_ex(_10, (void**) &_11, &_9) == SUCCESS
+ ; zephir_hash_move_forward_ex(_10, &_9)
+ ) {
+ ZEPHIR_GET_HVALUE(attribute, _11);
+ ZEPHIR_OBS_NVAR(columnValue);
+ ZEPHIR_INIT_LNVAR(_12);
+ ZEPHIR_CONCAT_VVVV(_12, underscore, source, underscore, attribute);
+ zephir_array_fetch(&columnValue, row, _12, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 195 TSRMLS_CC);
+ zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE);
+ }
do {
if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
- ZEPHIR_INIT_VAR(activeRow);
- object_init_ex(activeRow, phalcon_mvc_model_row_ce);
- if (zephir_has_constructor(activeRow TSRMLS_CC)) {
- ZEPHIR_CALL_METHOD(NULL, activeRow, "__construct", NULL);
- zephir_check_call_status();
+ ZEPHIR_OBS_NVAR(keepSnapshots);
+ if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(keepSnapshots);
+ ZVAL_BOOL(keepSnapshots, 0);
}
+ zephir_array_fetch_string(&_14, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 217 TSRMLS_CC);
+ ZEPHIR_INIT_NVAR(_15);
+ ZVAL_LONG(_15, dirtyState);
+ ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_13, _14, rowModel, columnMap, _15, keepSnapshots);
+ zephir_check_call_status();
break;
}
- if (ZEPHIR_IS_LONG(hydrateMode, 1)) {
- ZEPHIR_INIT_NVAR(activeRow);
- array_init(activeRow);
- break;
- }
- ZEPHIR_INIT_NVAR(activeRow);
- object_init(activeRow);
+ ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_16, rowModel, columnMap, hydrateMode);
+ zephir_check_call_status();
break;
} while(0);
- ZEPHIR_OBS_VAR(columnTypes);
- zephir_read_property_this(&columnTypes, this_ptr, SL("_columnTypes"), PH_NOISY_CC);
- dirtyState = 0;
- zephir_is_iterable(columnTypes, &_4, &_3, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 266);
- for (
- ; zephir_hash_get_current_data_ex(_4, (void**) &_5, &_3) == SUCCESS
- ; zephir_hash_move_forward_ex(_4, &_3)
- ) {
- ZEPHIR_GET_HMKEY(alias, _4, _3);
- ZEPHIR_GET_HVALUE(column, _5);
- if (Z_TYPE_P(column) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Column type is corrupt", "phalcon/mvc/model/resultset/complex.zep", 167);
- return;
- }
- ZEPHIR_OBS_NVAR(type);
- zephir_array_fetch_string(&type, column, SL("type"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 170 TSRMLS_CC);
- if (ZEPHIR_IS_STRING(type, "object")) {
- ZEPHIR_OBS_NVAR(source);
- zephir_array_fetch_string(&source, column, SL("column"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 176 TSRMLS_CC);
- ZEPHIR_OBS_NVAR(attributes);
- zephir_array_fetch_string(&attributes, column, SL("attributes"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 177 TSRMLS_CC);
- ZEPHIR_OBS_NVAR(columnMap);
- zephir_array_fetch_string(&columnMap, column, SL("columnMap"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 178 TSRMLS_CC);
- ZEPHIR_INIT_NVAR(rowModel);
- array_init(rowModel);
- zephir_is_iterable(attributes, &_7, &_6, 0, 0, "phalcon/mvc/model/resultset/complex.zep", 196);
- for (
- ; zephir_hash_get_current_data_ex(_7, (void**) &_8, &_6) == SUCCESS
- ; zephir_hash_move_forward_ex(_7, &_6)
- ) {
- ZEPHIR_GET_HVALUE(attribute, _8);
- ZEPHIR_OBS_NVAR(columnValue);
- ZEPHIR_INIT_LNVAR(_9);
- ZEPHIR_CONCAT_VVVV(_9, underscore, source, underscore, attribute);
- zephir_array_fetch(&columnValue, row, _9, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 189 TSRMLS_CC);
- zephir_array_update_zval(&rowModel, attribute, &columnValue, PH_COPY | PH_SEPARATE);
- }
- do {
- if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
- ZEPHIR_OBS_NVAR(keepSnapshots);
- if (!(zephir_array_isset_string_fetch(&keepSnapshots, column, SS("keepSnapshots"), 0 TSRMLS_CC))) {
- ZEPHIR_INIT_NVAR(keepSnapshots);
- ZVAL_BOOL(keepSnapshots, 0);
- }
- zephir_array_fetch_string(&_11, column, SL("instance"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 211 TSRMLS_CC);
- ZEPHIR_INIT_NVAR(_12);
- ZVAL_LONG(_12, dirtyState);
- ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmap", &_10, _11, rowModel, columnMap, _12, keepSnapshots);
- zephir_check_call_status();
- break;
- }
- ZEPHIR_CALL_CE_STATIC(&value, phalcon_mvc_model_ce, "cloneresultmaphydrate", &_13, rowModel, columnMap, hydrateMode);
- zephir_check_call_status();
- break;
- } while(0);
-
- ZEPHIR_OBS_NVAR(attribute);
- zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 225 TSRMLS_CC);
- } else {
- ZEPHIR_OBS_NVAR(sqlAlias);
- if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) {
- ZEPHIR_OBS_NVAR(value);
- zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 233 TSRMLS_CC);
- } else {
- ZEPHIR_OBS_NVAR(value);
- zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC);
- }
- if (zephir_array_isset_string(column, SS("balias"))) {
- ZEPHIR_CPY_WRT(attribute, alias);
- } else {
- ZEPHIR_INIT_NVAR(attribute);
- ZEPHIR_SINIT_NVAR(_14);
- ZVAL_STRING(&_14, "", 0);
- zephir_fast_str_replace(&attribute, underscore, &_14, alias TSRMLS_CC);
- }
- }
- do {
- if (ZEPHIR_IS_LONG(hydrateMode, 1)) {
- zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE);
- break;
- }
- zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC);
- break;
- } while(0);
-
- }
- zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC);
+ ZEPHIR_OBS_NVAR(attribute);
+ zephir_array_fetch_string(&attribute, column, SL("balias"), PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 231 TSRMLS_CC);
} else {
- zephir_update_property_this(this_ptr, SL("_activeRow"), row TSRMLS_CC);
+ ZEPHIR_OBS_NVAR(sqlAlias);
+ if (zephir_array_isset_string_fetch(&sqlAlias, column, SS("sqlAlias"), 0 TSRMLS_CC)) {
+ ZEPHIR_OBS_NVAR(value);
+ zephir_array_fetch(&value, row, sqlAlias, PH_NOISY, "phalcon/mvc/model/resultset/complex.zep", 239 TSRMLS_CC);
+ } else {
+ ZEPHIR_OBS_NVAR(value);
+ zephir_array_isset_fetch(&value, row, alias, 0 TSRMLS_CC);
+ }
+ if (zephir_array_isset_string(column, SS("balias"))) {
+ ZEPHIR_CPY_WRT(attribute, alias);
+ } else {
+ ZEPHIR_INIT_NVAR(attribute);
+ ZEPHIR_SINIT_NVAR(_17);
+ ZVAL_STRING(&_17, "", 0);
+ zephir_fast_str_replace(&attribute, underscore, &_17, alias TSRMLS_CC);
+ }
}
- RETURN_MM_BOOL(1);
+ do {
+ if (ZEPHIR_IS_LONG(hydrateMode, 1)) {
+ zephir_array_update_zval(&activeRow, attribute, &value, PH_COPY | PH_SEPARATE);
+ break;
+ }
+ zephir_update_property_zval_zval(activeRow, attribute, value TSRMLS_CC);
+ break;
+ } while(0);
+
}
- zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
- RETURN_MM_BOOL(0);
+ zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC);
+ RETURN_CCTOR(activeRow);
}
@@ -273,7 +278,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray) {
_0->funcs->get_current_data(_0, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC);
ZEPHIR_CPY_WRT(current, (*ZEPHIR_TMP_ITERATOR_PTR));
}
- zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 294);
+ zephir_array_append(&records, current, PH_SEPARATE, "phalcon/mvc/model/resultset/complex.zep", 285);
}
_0->funcs->dtor(_0 TSRMLS_CC);
RETURN_CCTOR(records);
@@ -319,18 +324,28 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize) {
/**
* Unserializing a resultset will allow to only works on the rows present in the saved state
- *
- * @param string data
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) {
int ZEPHIR_LAST_CALL_STATUS;
zephir_nts_static zephir_fcall_cache_entry *_1 = NULL;
- zval *data, *resultset = NULL, *_0, *_2, *_3, *_4, *_5;
+ zval *data_param = NULL, *resultset = NULL, *_0, *_2, *_3, *_4, *_5;
+ zval *data = NULL;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 1, 0, &data);
+ zephir_fetch_params(1, 1, 0, &data_param);
+
+ if (unlikely(Z_TYPE_P(data_param) != IS_STRING && Z_TYPE_P(data_param) != IS_NULL)) {
+ zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'data' must be a string") TSRMLS_CC);
+ RETURN_MM_NULL();
+ }
+ if (likely(Z_TYPE_P(data_param) == IS_STRING)) {
+ zephir_get_strval(data, data_param);
+ } else {
+ ZEPHIR_INIT_VAR(data);
+ ZVAL_EMPTY_STRING(data);
+ }
ZEPHIR_INIT_ZVAL_NREF(_0);
@@ -339,16 +354,16 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize) {
ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", &_1, data);
zephir_check_call_status();
if (Z_TYPE_P(resultset) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 347);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/complex.zep", 339);
return;
}
- zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 350 TSRMLS_CC);
+ zephir_array_fetch_string(&_2, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 342 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_rows"), _2 TSRMLS_CC);
- zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 351 TSRMLS_CC);
+ zephir_array_fetch_string(&_3, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 343 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_cache"), _3 TSRMLS_CC);
- zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 352 TSRMLS_CC);
+ zephir_array_fetch_string(&_4, resultset, SL("columnTypes"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 344 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_columnTypes"), _4 TSRMLS_CC);
- zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 353 TSRMLS_CC);
+ zephir_array_fetch_string(&_5, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/complex.zep", 345 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_hydrateMode"), _5 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
diff --git a/ext/phalcon/mvc/model/resultset/complex.zep.h b/ext/phalcon/mvc/model/resultset/complex.zep.h
index 92df1f15971..2b8dec5adbe 100644
--- a/ext/phalcon/mvc/model/resultset/complex.zep.h
+++ b/ext/phalcon/mvc/model/resultset/complex.zep.h
@@ -4,7 +4,7 @@ extern zend_class_entry *phalcon_mvc_model_resultset_complex_ce;
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Complex);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct);
-PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, valid);
+PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, current);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, toArray);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, serialize);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, unserialize);
@@ -21,7 +21,7 @@ ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(phalcon_mvc_model_resultset_complex_method_entry) {
PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, __construct, arginfo_phalcon_mvc_model_resultset_complex___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, valid, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, current, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, toArray, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, serialize, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset_Complex, unserialize, arginfo_phalcon_mvc_model_resultset_complex_unserialize, ZEND_ACC_PUBLIC)
diff --git a/ext/phalcon/mvc/model/resultset/simple.zep.c b/ext/phalcon/mvc/model/resultset/simple.zep.c
index 8fc92edc77a..f46818afc3d 100644
--- a/ext/phalcon/mvc/model/resultset/simple.zep.c
+++ b/ext/phalcon/mvc/model/resultset/simple.zep.c
@@ -17,8 +17,8 @@
#include "kernel/fcall.h"
#include "kernel/memory.h"
#include "kernel/operators.h"
-#include "kernel/hash.h"
#include "kernel/array.h"
+#include "kernel/hash.h"
#include "kernel/exception.h"
#include "kernel/concat.h"
#include "ext/spl/spl_exceptions.h"
@@ -103,51 +103,45 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct) {
}
/**
- * Check whether internal resource has rows to fetch
+ * Returns current row in the resultset
*/
-PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid) {
+PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current) {
- zephir_nts_static zephir_fcall_cache_entry *_2 = NULL, *_3 = NULL, *_4 = NULL, *_8 = NULL;
+ zephir_nts_static zephir_fcall_cache_entry *_6 = NULL, *_8 = NULL;
int ZEPHIR_LAST_CALL_STATUS;
- zval *result = NULL, *row = NULL, *rows = NULL, *hydrateMode, *columnMap, *activeRow = NULL, *_0, *_1 = NULL, *_5, *_6, *_7;
+ zval *result, *row = NULL, *hydrateMode, *columnMap, *activeRow = NULL, *_0, *_1, *_2 = NULL, *_3, *_4, *_5, *_7;
ZEPHIR_MM_GROW();
+ ZEPHIR_OBS_VAR(activeRow);
+ zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC);
+ if (Z_TYPE_P(activeRow) != IS_NULL) {
+ RETURN_CCTOR(activeRow);
+ }
_0 = zephir_fetch_nproperty_this(this_ptr, SL("_type"), PH_NOISY_CC);
if (zephir_is_true(_0)) {
- ZEPHIR_OBS_VAR(result);
- zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
- if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_CALL_METHOD(&row, result, "fetch", NULL, result);
- zephir_check_call_status();
- } else {
- ZEPHIR_INIT_NVAR(row);
- ZVAL_BOOL(row, 0);
- }
+ ZEPHIR_OBS_VAR(row);
+ zephir_read_property_this(&row, this_ptr, SL("_row"), PH_NOISY_CC);
} else {
- ZEPHIR_OBS_VAR(rows);
- zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC);
- if (Z_TYPE_P(rows) != IS_ARRAY) {
- ZEPHIR_OBS_NVAR(result);
+ _1 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC);
+ if (Z_TYPE_P(_1) == IS_NULL) {
+ ZEPHIR_OBS_VAR(result);
zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_CALL_METHOD(&_1, result, "fetchall", NULL);
+ ZEPHIR_CALL_METHOD(&_2, result, "fetchall", NULL);
zephir_check_call_status();
- zephir_update_property_this(this_ptr, SL("_rows"), _1 TSRMLS_CC);
- ZEPHIR_OBS_NVAR(rows);
- zephir_read_property_this(&rows, this_ptr, SL("_rows"), PH_NOISY_CC);
+ zephir_update_property_this(this_ptr, SL("_rows"), _2 TSRMLS_CC);
}
}
- if (Z_TYPE_P(rows) == IS_ARRAY) {
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(&row, "current", &_2, rows);
- Z_UNSET_ISREF_P(rows);
- zephir_check_call_status();
- if (!ZEPHIR_IS_FALSE_IDENTICAL(row)) {
- Z_SET_ISREF_P(rows);
- ZEPHIR_CALL_FUNCTION(NULL, "next", &_3, rows);
- Z_UNSET_ISREF_P(rows);
- zephir_check_call_status();
+ ZEPHIR_OBS_VAR(_3);
+ zephir_read_property_this(&_3, this_ptr, SL("_rows"), PH_NOISY_CC);
+ if (Z_TYPE_P(_3) == IS_ARRAY) {
+ ZEPHIR_OBS_NVAR(row);
+ _4 = zephir_fetch_nproperty_this(this_ptr, SL("_rows"), PH_NOISY_CC);
+ _5 = zephir_fetch_nproperty_this(this_ptr, SL("_pointer"), PH_NOISY_CC);
+ if (!(zephir_array_isset_fetch(&row, _4, _5, 0 TSRMLS_CC))) {
+ ZEPHIR_INIT_NVAR(row);
+ ZVAL_BOOL(row, 0);
}
} else {
ZEPHIR_INIT_NVAR(row);
@@ -164,11 +158,11 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid) {
zephir_read_property_this(&columnMap, this_ptr, SL("_columnMap"), PH_NOISY_CC);
do {
if (ZEPHIR_IS_LONG(hydrateMode, 0)) {
- _5 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC);
- _6 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC);
+ _1 = zephir_fetch_nproperty_this(this_ptr, SL("_model"), PH_NOISY_CC);
+ _4 = zephir_fetch_nproperty_this(this_ptr, SL("_keepSnapshots"), PH_NOISY_CC);
ZEPHIR_INIT_VAR(_7);
ZVAL_LONG(_7, 0);
- ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_4, _5, row, columnMap, _7, _6);
+ ZEPHIR_CALL_CE_STATIC(&activeRow, phalcon_mvc_model_ce, "cloneresultmap", &_6, _1, row, columnMap, _7, _4);
zephir_check_call_status();
break;
}
@@ -178,7 +172,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid) {
} while(0);
zephir_update_property_this(this_ptr, SL("_activeRow"), activeRow TSRMLS_CC);
- RETURN_MM_BOOL(1);
+ RETURN_CCTOR(activeRow);
}
@@ -193,7 +187,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
HashTable *_3, *_6;
HashPosition _2, _5;
int ZEPHIR_LAST_CALL_STATUS;
- zval *renameColumns_param = NULL, *result = NULL, *activeRow = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords, *columnMap, *_0, *_1, **_4, **_7, *_8 = NULL, *_9 = NULL;
+ zval *renameColumns_param = NULL, *result = NULL, *records = NULL, *record = NULL, *renamed = NULL, *renamedKey = NULL, *key = NULL, *value = NULL, *renamedRecords, *columnMap, *_0, *_1, **_4, **_7, *_8 = NULL, *_9 = NULL;
zend_bool renameColumns;
ZEPHIR_MM_GROW();
@@ -211,14 +205,14 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
ZEPHIR_OBS_VAR(result);
zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_OBS_VAR(activeRow);
- zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC);
- if (Z_TYPE_P(activeRow) != IS_NULL) {
+ _1 = zephir_fetch_nproperty_this(this_ptr, SL("_row"), PH_NOISY_CC);
+ if (Z_TYPE_P(_1) != IS_NULL) {
ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL);
zephir_check_call_status();
}
ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL);
zephir_check_call_status();
+ zephir_update_property_this(this_ptr, SL("_row"), ZEPHIR_GLOBAL(global_null) TSRMLS_CC);
} else {
ZEPHIR_INIT_NVAR(records);
array_init(records);
@@ -230,18 +224,9 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
ZEPHIR_OBS_NVAR(result);
zephir_read_property_this(&result, this_ptr, SL("_result"), PH_NOISY_CC);
if (Z_TYPE_P(result) == IS_OBJECT) {
- ZEPHIR_OBS_NVAR(activeRow);
- zephir_read_property_this(&activeRow, this_ptr, SL("_activeRow"), PH_NOISY_CC);
- if (Z_TYPE_P(activeRow) != IS_NULL) {
- ZEPHIR_CALL_METHOD(NULL, result, "execute", NULL);
- zephir_check_call_status();
- }
ZEPHIR_CALL_METHOD(&records, result, "fetchall", NULL);
zephir_check_call_status();
zephir_update_property_this(this_ptr, SL("_rows"), records TSRMLS_CC);
- ZEPHIR_INIT_ZVAL_NREF(_1);
- ZVAL_LONG(_1, zephir_fast_count_int(records TSRMLS_CC));
- zephir_update_property_this(this_ptr, SL("_count"), _1 TSRMLS_CC);
} else {
ZEPHIR_INIT_NVAR(records);
array_init(records);
@@ -257,7 +242,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
ZEPHIR_INIT_VAR(renamedRecords);
array_init(renamedRecords);
if (Z_TYPE_P(records) == IS_ARRAY) {
- zephir_is_iterable(records, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 276);
+ zephir_is_iterable(records, &_3, &_2, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 263);
for (
; zephir_hash_get_current_data_ex(_3, (void**) &_4, &_2) == SUCCESS
; zephir_hash_move_forward_ex(_3, &_2)
@@ -265,7 +250,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
ZEPHIR_GET_HVALUE(record, _4);
ZEPHIR_INIT_NVAR(renamed);
array_init(renamed);
- zephir_is_iterable(record, &_6, &_5, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 274);
+ zephir_is_iterable(record, &_6, &_5, 0, 0, "phalcon/mvc/model/resultset/simple.zep", 261);
for (
; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
; zephir_hash_move_forward_ex(_6, &_5)
@@ -280,13 +265,13 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray) {
ZEPHIR_CONCAT_SVS(_9, "Column '", key, "' is not part of the column map");
ZEPHIR_CALL_METHOD(NULL, _8, "__construct", &_10, _9);
zephir_check_call_status();
- zephir_throw_exception_debug(_8, "phalcon/mvc/model/resultset/simple.zep", 262 TSRMLS_CC);
+ zephir_throw_exception_debug(_8, "phalcon/mvc/model/resultset/simple.zep", 249 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", 274);
+ zephir_array_append(&renamedRecords, renamed, PH_SEPARATE, "phalcon/mvc/model/resultset/simple.zep", 261);
}
}
RETURN_CCTOR(renamedRecords);
@@ -307,7 +292,6 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize) {
ZEPHIR_MM_GROW();
- zephir_update_property_this(this_ptr, SL("_activeRow"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
ZEPHIR_INIT_VAR(_0);
zephir_create_array(_0, 5, 0 TSRMLS_CC);
ZEPHIR_OBS_VAR(_1);
@@ -365,18 +349,18 @@ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize) {
ZEPHIR_CALL_FUNCTION(&resultset, "unserialize", &_1, data);
zephir_check_call_status();
if (Z_TYPE_P(resultset) != IS_ARRAY) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 317);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data", "phalcon/mvc/model/resultset/simple.zep", 302);
return;
}
- zephir_array_fetch_string(&_2, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 320 TSRMLS_CC);
+ zephir_array_fetch_string(&_2, resultset, SL("model"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 305 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_model"), _2 TSRMLS_CC);
- zephir_array_fetch_string(&_3, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 321 TSRMLS_CC);
+ zephir_array_fetch_string(&_3, resultset, SL("rows"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 306 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_rows"), _3 TSRMLS_CC);
- zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 322 TSRMLS_CC);
+ zephir_array_fetch_string(&_4, resultset, SL("cache"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 307 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_cache"), _4 TSRMLS_CC);
- zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 323 TSRMLS_CC);
+ zephir_array_fetch_string(&_5, resultset, SL("columnMap"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 308 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_columnMap"), _5 TSRMLS_CC);
- zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 324 TSRMLS_CC);
+ zephir_array_fetch_string(&_6, resultset, SL("hydrateMode"), PH_NOISY | PH_READONLY, "phalcon/mvc/model/resultset/simple.zep", 309 TSRMLS_CC);
zephir_update_property_this(this_ptr, SL("_hydrateMode"), _6 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
diff --git a/ext/phalcon/mvc/model/resultset/simple.zep.h b/ext/phalcon/mvc/model/resultset/simple.zep.h
index 428dc021973..d8adab9ffa7 100644
--- a/ext/phalcon/mvc/model/resultset/simple.zep.h
+++ b/ext/phalcon/mvc/model/resultset/simple.zep.h
@@ -4,7 +4,7 @@ extern zend_class_entry *phalcon_mvc_model_resultset_simple_ce;
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Resultset_Simple);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, __construct);
-PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, valid);
+PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, current);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, toArray);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, serialize);
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize);
@@ -27,7 +27,7 @@ ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(phalcon_mvc_model_resultset_simple_method_entry) {
PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, __construct, arginfo_phalcon_mvc_model_resultset_simple___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, valid, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, current, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, toArray, arginfo_phalcon_mvc_model_resultset_simple_toarray, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, serialize, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Mvc_Model_Resultset_Simple, unserialize, arginfo_phalcon_mvc_model_resultset_simple_unserialize, ZEND_ACC_PUBLIC)
diff --git a/ext/phalcon/mvc/model/validationfailed.zep.c b/ext/phalcon/mvc/model/validationfailed.zep.c
index 2d1df993c55..8be8221e82c 100644
--- a/ext/phalcon/mvc/model/validationfailed.zep.c
+++ b/ext/phalcon/mvc/model/validationfailed.zep.c
@@ -12,6 +12,12 @@
#include
#include "kernel/main.h"
+#include "kernel/memory.h"
+#include "kernel/array.h"
+#include "kernel/fcall.h"
+#include "kernel/object.h"
+#include "ext/spl/spl_exceptions.h"
+#include "kernel/exception.h"
/**
@@ -22,7 +28,7 @@
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_ValidationFailed) {
- ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model, ValidationFailed, phalcon, mvc_model_validationfailed, phalcon_mvc_model_exception_ce, NULL, 0);
+ ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Mvc\\Model, ValidationFailed, phalcon, mvc_model_validationfailed, phalcon_mvc_model_exception_ce, phalcon_mvc_model_validationfailed_method_entry, 0);
zend_declare_property_null(phalcon_mvc_model_validationfailed_ce, SL("_model"), ZEND_ACC_PROTECTED TSRMLS_CC);
@@ -32,3 +38,59 @@ ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_ValidationFailed) {
}
+/**
+ * Phalcon\Mvc\Model\ValidationFailed constructor
+ *
+ * @param Model model
+ * @param Message[] validationMessages
+ */
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, __construct) {
+
+ int ZEPHIR_LAST_CALL_STATUS;
+ zval *validationMessages = NULL;
+ zval *model, *validationMessages_param = NULL, *messageStr = NULL, *message;
+
+ ZEPHIR_MM_GROW();
+ zephir_fetch_params(1, 2, 0, &model, &validationMessages_param);
+
+ validationMessages = validationMessages_param;
+
+
+
+ if (zephir_fast_count_int(validationMessages TSRMLS_CC) > 0) {
+ ZEPHIR_OBS_VAR(message);
+ zephir_array_fetch_long(&message, validationMessages, 0, PH_NOISY, "phalcon/mvc/model/validationfailed.zep", 51 TSRMLS_CC);
+ ZEPHIR_CALL_METHOD(&messageStr, message, "getmessage", NULL);
+ zephir_check_call_status();
+ } else {
+ ZEPHIR_INIT_NVAR(messageStr);
+ ZVAL_STRING(messageStr, "Validation failed", 1);
+ }
+ zephir_update_property_this(this_ptr, SL("_model"), model TSRMLS_CC);
+ zephir_update_property_this(this_ptr, SL("_messages"), validationMessages TSRMLS_CC);
+ ZEPHIR_CALL_PARENT(NULL, phalcon_mvc_model_validationfailed_ce, this_ptr, "__construct", NULL, messageStr);
+ zephir_check_call_status();
+ ZEPHIR_MM_RESTORE();
+
+}
+
+/**
+ * Returns the model that generated the messages
+ */
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, getModel) {
+
+
+ RETURN_MEMBER(this_ptr, "_model");
+
+}
+
+/**
+ * Returns the complete group of messages produced in the validation
+ */
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, getMessages) {
+
+
+ RETURN_MEMBER(this_ptr, "_messages");
+
+}
+
diff --git a/ext/phalcon/mvc/model/validationfailed.zep.h b/ext/phalcon/mvc/model/validationfailed.zep.h
index b4b53ecc0c2..131adb23ec2 100644
--- a/ext/phalcon/mvc/model/validationfailed.zep.h
+++ b/ext/phalcon/mvc/model/validationfailed.zep.h
@@ -3,3 +3,18 @@ extern zend_class_entry *phalcon_mvc_model_validationfailed_ce;
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_ValidationFailed);
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, __construct);
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, getModel);
+PHP_METHOD(Phalcon_Mvc_Model_ValidationFailed, getMessages);
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_validationfailed___construct, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, model, Phalcon\\Mvc\\Model, 0)
+ ZEND_ARG_ARRAY_INFO(0, validationMessages, 0)
+ZEND_END_ARG_INFO()
+
+ZEPHIR_INIT_FUNCS(phalcon_mvc_model_validationfailed_method_entry) {
+ PHP_ME(Phalcon_Mvc_Model_ValidationFailed, __construct, arginfo_phalcon_mvc_model_validationfailed___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(Phalcon_Mvc_Model_ValidationFailed, getModel, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Phalcon_Mvc_Model_ValidationFailed, getMessages, NULL, ZEND_ACC_PUBLIC)
+ PHP_FE_END
+};
diff --git a/ext/phalcon/mvc/model/validator/email.zep.c b/ext/phalcon/mvc/model/validator/email.zep.c
index 11301d70283..47264e3853f 100644
--- a/ext/phalcon/mvc/model/validator/email.zep.c
+++ b/ext/phalcon/mvc/model/validator/email.zep.c
@@ -42,7 +42,6 @@
*
* }
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Email) {
@@ -75,7 +74,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Email, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 64);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/email.zep", 63);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
diff --git a/ext/phalcon/mvc/model/validator/numericality.zep.c b/ext/phalcon/mvc/model/validator/numericality.zep.c
index 3e15a48c2f9..ec43ed3e469 100644
--- a/ext/phalcon/mvc/model/validator/numericality.zep.c
+++ b/ext/phalcon/mvc/model/validator/numericality.zep.c
@@ -42,7 +42,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Numericality) {
@@ -75,7 +74,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 63);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/numericality.zep", 62);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
diff --git a/ext/phalcon/mvc/model/validator/presenceof.zep.c b/ext/phalcon/mvc/model/validator/presenceof.zep.c
index e0256e76a49..de0a1727f6f 100644
--- a/ext/phalcon/mvc/model/validator/presenceof.zep.c
+++ b/ext/phalcon/mvc/model/validator/presenceof.zep.c
@@ -44,7 +44,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_PresenceOf) {
@@ -77,7 +76,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 64);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/presenceof.zep", 63);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
diff --git a/ext/phalcon/mvc/model/validator/regex.zep.c b/ext/phalcon/mvc/model/validator/regex.zep.c
index bff8c98ee1a..e9fdac3b732 100644
--- a/ext/phalcon/mvc/model/validator/regex.zep.c
+++ b/ext/phalcon/mvc/model/validator/regex.zep.c
@@ -44,7 +44,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Regex) {
@@ -77,7 +76,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 64);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/regex.zep", 63);
return;
}
ZEPHIR_INIT_NVAR(_0);
@@ -86,7 +85,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (!(zephir_is_true(_1))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 71);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Validator requires a perl-compatible regex pattern", "phalcon/mvc/model/validator/regex.zep", 70);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
@@ -114,7 +113,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Regex, validate) {
ZEPHIR_INIT_NVAR(_0);
zephir_preg_match(_0, pattern, value, matches, 0, 0 , 0 TSRMLS_CC);
if (zephir_is_true(_0)) {
- zephir_array_fetch_long(&_4, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 90 TSRMLS_CC);
+ zephir_array_fetch_long(&_4, matches, 0, PH_NOISY | PH_READONLY, "phalcon/mvc/model/validator/regex.zep", 89 TSRMLS_CC);
failed = !ZEPHIR_IS_EQUAL(_4, value);
} else {
failed = 1;
diff --git a/ext/phalcon/mvc/model/validator/stringlength.zep.c b/ext/phalcon/mvc/model/validator/stringlength.zep.c
index 3cba3e475f6..177772a5bd7 100644
--- a/ext/phalcon/mvc/model/validator/stringlength.zep.c
+++ b/ext/phalcon/mvc/model/validator/stringlength.zep.c
@@ -48,7 +48,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_StringLength) {
@@ -81,7 +80,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 68);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/stringlength.zep", 67);
return;
}
ZEPHIR_INIT_NVAR(_0);
@@ -99,7 +98,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_StringLength, validate) {
_1 = !zephir_is_true(isSetMax);
}
if (_1) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 78);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "A minimum or maximum must be set", "phalcon/mvc/model/validator/stringlength.zep", 77);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
diff --git a/ext/phalcon/mvc/model/validator/uniqueness.zep.c b/ext/phalcon/mvc/model/validator/uniqueness.zep.c
index b1cd79bee46..d52663c7d68 100644
--- a/ext/phalcon/mvc/model/validator/uniqueness.zep.c
+++ b/ext/phalcon/mvc/model/validator/uniqueness.zep.c
@@ -47,7 +47,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Uniqueness) {
@@ -105,7 +104,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) == IS_ARRAY) {
- zephir_is_iterable(field, &_2, &_1, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 121);
+ zephir_is_iterable(field, &_2, &_1, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 120);
for (
; zephir_hash_get_current_data_ex(_2, (void**) &_3, &_1) == SUCCESS
; zephir_hash_move_forward_ex(_2, &_1)
@@ -120,7 +119,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_4, "Column '", composeField, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 98 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 97 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -135,7 +134,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_4, "Column '", columnField, "' isn't part of the table columns");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _4);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 108 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 107 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -143,11 +142,11 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZVAL_LONG(&_6, number);
ZEPHIR_INIT_LNVAR(_7);
ZEPHIR_CONCAT_SVSV(_7, "[", composeField, "] = ?", &_6);
- zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 114);
+ zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 113);
ZEPHIR_CALL_METHOD(&_8, record, "readattribute", &_9, composeField);
zephir_check_call_status();
- zephir_array_append(&bindParams, _8, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 115);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 116);
+ zephir_array_append(&bindParams, _8, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 114);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 115);
number++;
}
} else {
@@ -160,7 +159,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_7, "Column '", field, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 128 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 127 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -175,17 +174,17 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_7, "Column '", columnField, "' isn't part of the table columns");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 138 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 137 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
ZEPHIR_INIT_LNVAR(_7);
ZEPHIR_CONCAT_SVS(_7, "[", field, "] = ?0");
- zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 144);
+ zephir_array_append(&conditions, _7, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 143);
ZEPHIR_CALL_METHOD(&_8, record, "readattribute", &_9, field);
zephir_check_call_status();
- zephir_array_append(&bindParams, _8, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 145);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 146);
+ zephir_array_append(&bindParams, _8, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 144);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 145);
number++;
}
ZEPHIR_CALL_METHOD(&_10, record, "getoperationmade", NULL);
@@ -200,7 +199,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
}
ZEPHIR_CALL_METHOD(&_8, metaData, "getprimarykeyattributes", NULL, record);
zephir_check_call_status();
- zephir_is_iterable(_8, &_12, &_11, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 191);
+ zephir_is_iterable(_8, &_12, &_11, 0, 0, "phalcon/mvc/model/validator/uniqueness.zep", 190);
for (
; zephir_hash_get_current_data_ex(_12, (void**) &_13, &_11) == SUCCESS
; zephir_hash_move_forward_ex(_12, &_11)
@@ -214,7 +213,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_7, "Column '", primaryField, "' isn't part of the table columns");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 168 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 167 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -227,7 +226,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZEPHIR_CONCAT_SVS(_14, "Column '", primaryField, "' isn't part of the column map");
ZEPHIR_CALL_METHOD(NULL, _0, "__construct", &_5, _14);
zephir_check_call_status();
- zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 176 TSRMLS_CC);
+ zephir_throw_exception_debug(_0, "phalcon/mvc/model/validator/uniqueness.zep", 175 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
@@ -238,11 +237,11 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Uniqueness, validate) {
ZVAL_LONG(&_6, number);
ZEPHIR_INIT_LNVAR(_4);
ZEPHIR_CONCAT_SVSV(_4, "[", attributeField, "] <> ?", &_6);
- zephir_array_append(&conditions, _4, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 185);
+ zephir_array_append(&conditions, _4, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 184);
ZEPHIR_CALL_METHOD(&_15, record, "readattribute", &_9, primaryField);
zephir_check_call_status();
- zephir_array_append(&bindParams, _15, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 186);
- zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 187);
+ zephir_array_append(&bindParams, _15, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 185);
+ zephir_array_append(&bindTypes, bindType, PH_SEPARATE, "phalcon/mvc/model/validator/uniqueness.zep", 186);
number++;
}
}
diff --git a/ext/phalcon/mvc/model/validator/url.zep.c b/ext/phalcon/mvc/model/validator/url.zep.c
index 6042f4a87a7..fb40d806f2b 100644
--- a/ext/phalcon/mvc/model/validator/url.zep.c
+++ b/ext/phalcon/mvc/model/validator/url.zep.c
@@ -42,7 +42,6 @@
*
*}
*
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Model_Validator_Url) {
@@ -75,7 +74,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Validator_Url, validate) {
zephir_check_temp_parameter(_0);
zephir_check_call_status();
if (Z_TYPE_P(field) != IS_STRING) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 63);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_model_exception_ce, "Field name must be a string", "phalcon/mvc/model/validator/url.zep", 62);
return;
}
ZEPHIR_CALL_METHOD(&value, record, "readattribute", NULL, field);
diff --git a/ext/phalcon/mvc/url.zep.c b/ext/phalcon/mvc/url.zep.c
index 2c2d3365e0d..819ba2121be 100644
--- a/ext/phalcon/mvc/url.zep.c
+++ b/ext/phalcon/mvc/url.zep.c
@@ -324,7 +324,7 @@ PHP_METHOD(Phalcon_Mvc_Url, get) {
if (Z_TYPE_P(uri) == IS_ARRAY) {
ZEPHIR_OBS_VAR(routeName);
if (!(zephir_array_isset_string_fetch(&routeName, uri, SS("for"), 0 TSRMLS_CC))) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "It's necessary to define the route name with the parameter 'for'", "phalcon/mvc/url.zep", 201);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "It's necessary to define the route name with the parameter 'for'", "phalcon/mvc/url.zep", 202);
return;
}
_5 = zephir_fetch_nproperty_this(this_ptr, SL("_router"), PH_NOISY_CC);
@@ -333,7 +333,7 @@ PHP_METHOD(Phalcon_Mvc_Url, get) {
_5 = zephir_fetch_nproperty_this(this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
ZEPHIR_CPY_WRT(dependencyInjector, _5);
if (Z_TYPE_P(dependencyInjector) != IS_OBJECT) {
- ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injector container is required to obtain the 'router' service", "phalcon/mvc/url.zep", 213);
+ ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_mvc_url_exception_ce, "A dependency injector container is required to obtain the 'router' service", "phalcon/mvc/url.zep", 214);
return;
}
ZEPHIR_INIT_VAR(_6);
@@ -354,7 +354,7 @@ PHP_METHOD(Phalcon_Mvc_Url, get) {
ZEPHIR_CONCAT_SVS(_7, "Cannot obtain a route using the name '", routeName, "'");
ZEPHIR_CALL_METHOD(NULL, _6, "__construct", &_8, _7);
zephir_check_call_status();
- zephir_throw_exception_debug(_6, "phalcon/mvc/url.zep", 225 TSRMLS_CC);
+ zephir_throw_exception_debug(_6, "phalcon/mvc/url.zep", 226 TSRMLS_CC);
ZEPHIR_MM_RESTORE();
return;
}
diff --git a/ext/phalcon/mvc/url/exception.zep.c b/ext/phalcon/mvc/url/exception.zep.c
index ed9f34486dd..75205003af3 100644
--- a/ext/phalcon/mvc/url/exception.zep.c
+++ b/ext/phalcon/mvc/url/exception.zep.c
@@ -18,7 +18,6 @@
* Phalcon\Mvc\Url\Exception
*
* Exceptions thrown in Phalcon\Mvc\Url will use this class
- *
*/
ZEPHIR_INIT_CLASS(Phalcon_Mvc_Url_Exception) {
diff --git a/ext/phalcon/mvc/view/engine/volt.zep.c b/ext/phalcon/mvc/view/engine/volt.zep.c
index a27a4042b8e..31640b8c971 100644
--- a/ext/phalcon/mvc/view/engine/volt.zep.c
+++ b/ext/phalcon/mvc/view/engine/volt.zep.c
@@ -322,26 +322,31 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, convertEncoding) {
*/
PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) {
- zephir_nts_static zephir_fcall_cache_entry *_7 = NULL;
- zend_bool _2;
- zephir_fcall_cache_entry *_1 = NULL, *_4 = NULL, *_5 = NULL, *_8 = NULL;
- int position, ZEPHIR_LAST_CALL_STATUS;
- zval *value, *start, *end = NULL, *length = NULL, *slice, *_0 = NULL, *_3 = NULL, *_6;
+ zephir_nts_static zephir_fcall_cache_entry *_6 = NULL;
+ zephir_fcall_cache_entry *_3 = NULL, *_4 = NULL, *_7 = NULL;
+ zend_bool _1;
+ int start, position, ZEPHIR_LAST_CALL_STATUS;
+ zval *value, *start_param = NULL, *end = NULL, *length, *slice, *_0 = NULL, *_2 = NULL, _5 = zval_used_for_init;
ZEPHIR_MM_GROW();
- zephir_fetch_params(1, 2, 1, &value, &start, &end);
+ zephir_fetch_params(1, 1, 2, &value, &start_param, &end);
+ if (!start_param) {
+ start = 0;
+ } else {
+ start = zephir_get_intval(start_param);
+ }
if (!end) {
- end = ZEPHIR_GLOBAL(global_null);
+ 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_VAR(length);
- ZVAL_LONG(length, zephir_fast_count_int(value TSRMLS_CC));
- } else {
- ZEPHIR_CPY_WRT(length, end);
+ ZEPHIR_INIT_NVAR(end);
+ ZVAL_LONG(end, (zephir_fast_count_int(value TSRMLS_CC) - 1));
}
position = 0;
ZEPHIR_INIT_VAR(slice);
@@ -349,54 +354,62 @@ PHP_METHOD(Phalcon_Mvc_View_Engine_Volt, slice) {
ZEPHIR_CALL_METHOD(NULL, value, "rewind", NULL);
zephir_check_call_status();
while (1) {
- ZEPHIR_CALL_METHOD(&_0, value, "valid", &_1);
+ ZEPHIR_CALL_METHOD(&_0, value, "valid", NULL);
zephir_check_call_status();
if (!(zephir_is_true(_0))) {
break;
}
- _2 = ZEPHIR_LT_LONG(start, position);
- if (_2) {
- _2 = ZEPHIR_GE_LONG(length, position);
+ _1 = position >= start;
+ if (_1) {
+ _1 = ZEPHIR_GE_LONG(end, position);
}
- if (_2) {
- ZEPHIR_CALL_METHOD(&_3, value, "current", &_4);
+ if (_1) {
+ ZEPHIR_CALL_METHOD(&_2, value, "current", &_3);
zephir_check_call_status();
- zephir_array_append(&slice, _3, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 239);
+ zephir_array_append(&slice, _2, PH_SEPARATE, "phalcon/mvc/view/engine/volt.zep", 233);
}
- ZEPHIR_CALL_METHOD(NULL, value, "next", &_5);
+ ZEPHIR_CALL_METHOD(NULL, value, "next", &_4);
zephir_check_call_status();
position++;
}
RETURN_CCTOR(slice);
}
- ZEPHIR_INIT_NVAR(length);
+ ZEPHIR_INIT_VAR(length);
if (Z_TYPE_P(end) != IS_NULL) {
- ZEPHIR_INIT_VAR(_6);
- sub_function(_6, end, start TSRMLS_CC);
- ZVAL_LONG(length, (zephir_get_numberval(_6) + 1));
+ ZVAL_LONG(length, (((zephir_get_numberval(end) - start)) + 1));
} else {
ZVAL_NULL(length);
}
if (Z_TYPE_P(value) == IS_ARRAY) {
- ZEPHIR_RETURN_CALL_FUNCTION("array_slice", &_7, value, start, length);
+ ZEPHIR_SINIT_VAR(_5);
+ ZVAL_LONG(&_5, start);
+ ZEPHIR_RETURN_CALL_FUNCTION("array_slice", &_6, value, &_5, 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_RETURN_CALL_FUNCTION("mb_substr", &_8, value, start, length);
+ ZEPHIR_SINIT_NVAR(_5);
+ ZVAL_LONG(&_5, start);
+ ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, value, &_5, length);
zephir_check_call_status();
RETURN_MM();
}
- ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_8, value, start);
+ ZEPHIR_SINIT_NVAR(_5);
+ ZVAL_LONG(&_5, start);
+ ZEPHIR_RETURN_CALL_FUNCTION("mb_substr", &_7, value, &_5);
zephir_check_call_status();
RETURN_MM();
}
if (Z_TYPE_P(length) != IS_NULL) {
- zephir_substr(return_value, value, zephir_get_intval(start), zephir_get_intval(length), 0);
+ ZEPHIR_SINIT_NVAR(_5);
+ ZVAL_LONG(&_5, start);
+ zephir_substr(return_value, value, zephir_get_intval(&_5), zephir_get_intval(length), 0);
RETURN_MM();
}
- zephir_substr(return_value, value, zephir_get_intval(start), 0, ZEPHIR_SUBSTR_NO_LENGTH);
+ ZEPHIR_SINIT_NVAR(_5);
+ ZVAL_LONG(&_5, start);
+ zephir_substr(return_value, value, zephir_get_intval(&_5), 0, ZEPHIR_SUBSTR_NO_LENGTH);
RETURN_MM();
}
diff --git a/ext/phalcon/mvc/view/engine/volt.zep.h b/ext/phalcon/mvc/view/engine/volt.zep.h
index ec2d12e0785..4077b2f2962 100644
--- a/ext/phalcon/mvc/view/engine/volt.zep.h
+++ b/ext/phalcon/mvc/view/engine/volt.zep.h
@@ -38,7 +38,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_view_engine_volt_convertencoding, 0,
ZEND_ARG_INFO(0, to)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_view_engine_volt_slice, 0, 0, 2)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_view_engine_volt_slice, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, start)
ZEND_ARG_INFO(0, end)
diff --git a/ext/phalcon/mvc/viewinterface.zep.c b/ext/phalcon/mvc/viewinterface.zep.c
index 46868882ae5..75b614ce017 100644
--- a/ext/phalcon/mvc/viewinterface.zep.c
+++ b/ext/phalcon/mvc/viewinterface.zep.c
@@ -105,7 +105,6 @@ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, setTemplateBefore);
/**
* Resets any template before layouts
- *
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, cleanTemplateBefore);
@@ -191,19 +190,16 @@ ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, getActiveRenderPath);
/**
* Disables the auto-rendering process
- *
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, disable);
/**
* Enables the auto-rendering process
- *
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, enable);
/**
* Resets the view component to its factory default values
- *
*/
ZEPHIR_DOC_METHOD(Phalcon_Mvc_ViewInterface, reset);