From 17da8cbe676681e8fb7cc2686742b8a1db6244a3 Mon Sep 17 00:00:00 2001 From: dreamsxin Date: Thu, 8 Aug 2013 10:51:58 +0800 Subject: [PATCH 1/2] Fix BUG #1022 --- ext/mvc/model.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ext/mvc/model.c b/ext/mvc/model.c index a520ddd7b28..78a88cde582 100644 --- a/ext/mvc/model.c +++ b/ext/mvc/model.c @@ -3068,7 +3068,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ zval *attribute_field = NULL, *exception_message = NULL; zval *value = NULL, *bind_type = NULL, *default_value, *use_explicit_identity; zval *success, *sequence_name = NULL, *support_sequences; - zval *source, *last_insert_id; + zval *schema, *source, *last_insert_id; HashTable *ah0; HashPosition hp0; zval **hd; @@ -3268,11 +3268,18 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ if (phalcon_method_exists_ex(this_ptr, SS("getsequencename") TSRMLS_CC) == SUCCESS) { phalcon_call_method(sequence_name, this_ptr, "getsequencename"); } else { + PHALCON_INIT_VAR(schema); + phalcon_call_method(schema, this_ptr, "getschema"); + PHALCON_INIT_VAR(source); phalcon_call_method(source, this_ptr, "getsource"); - - PHALCON_INIT_NVAR(sequence_name); - PHALCON_CONCAT_VSVS(sequence_name, source, "_", identity_field, "_seq"); + + if (PHALCON_IS_EMPTY(schema)) { + PHALCON_INIT_NVAR(sequence_name); + PHALCON_CONCAT_VSVS(sequence_name, source, "_", identity_field, "_seq"); + } else { + PHALCON_CONCAT_VSVSVS(sequence_name, schema, ".", source, "_", identity_field, "_seq"); + } } } From 71fc9d25f74a2ea6457ed48667539a8066b27942 Mon Sep 17 00:00:00 2001 From: Dreamszhu Date: Thu, 8 Aug 2013 11:01:38 +0800 Subject: [PATCH 2/2] Update model.c --- ext/mvc/model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mvc/model.c b/ext/mvc/model.c index 78a88cde582..cddaaaa3111 100644 --- a/ext/mvc/model.c +++ b/ext/mvc/model.c @@ -1,4 +1,3 @@ - /* +------------------------------------------------------------------------+ | Phalcon Framework | @@ -3278,6 +3277,7 @@ PHP_METHOD(Phalcon_Mvc_Model, _doLowInsert){ PHALCON_INIT_NVAR(sequence_name); PHALCON_CONCAT_VSVS(sequence_name, source, "_", identity_field, "_seq"); } else { + PHALCON_INIT_NVAR(sequence_name); PHALCON_CONCAT_VSVSVS(sequence_name, schema, ".", source, "_", identity_field, "_seq"); } }