Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix integer and string placeholders in Phalcon\Mvc\Model\Query\Builder #922

Merged
merged 2 commits into from Jul 25, 2013
Merged

Mix integer and string placeholders in Phalcon\Mvc\Model\Query\Builder #922

merged 2 commits into from Jul 25, 2013

Conversation

ghost
Copy link

@ghost ghost commented Jul 25, 2013

See #701

@jeffreycahyono
Copy link

Wow that was fast, Thanks. I hope it can be merged into 1.2.1 branch as well :)

@ghost
Copy link
Author

ghost commented Jul 25, 2013

If you are familiar with patches and git and can build phalcon yourself, you can just apply this patch to 1.2.1:

diff --git a/ext/mvc/model/query/builder.c b/ext/mvc/model/query/builder.c
index 6b7620f..8cc70a9 100644
--- a/ext/mvc/model/query/builder.c
+++ b/ext/mvc/model/query/builder.c
@@ -562,7 +562,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, where){
        phalcon_read_property_this(&current_bind_params, this_ptr, SL("_bindParams"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_params) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_params);
-           phalcon_fast_array_merge(merged_params, &current_bind_params, &bind_params TSRMLS_CC);
+           phalcon_add_function(merged_params, bind_params, current_bind_params TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_params, bind_params);
        }
@@ -579,7 +579,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, where){
        phalcon_read_property_this(&current_bind_types, this_ptr, SL("_bindTypes"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_types) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_types);
-           phalcon_fast_array_merge(merged_types, &current_bind_types, &bind_types TSRMLS_CC);
+           phalcon_add_function(merged_params, bind_types, current_bind_types TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_types, bind_types);
        }
@@ -646,7 +646,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, andWhere){
        phalcon_read_property_this(&current_bind_params, this_ptr, SL("_bindParams"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_params) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_params);
-           phalcon_fast_array_merge(merged_params, &current_bind_params, &bind_params TSRMLS_CC);
+           phalcon_add_function(merged_params, bind_params, current_bind_params TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_params, bind_params);
        }
@@ -663,7 +663,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, andWhere){
        phalcon_read_property_this(&current_bind_types, this_ptr, SL("_bindTypes"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_types) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_types);
-           phalcon_fast_array_merge(merged_types, &current_bind_types, &bind_types TSRMLS_CC);
+           phalcon_add_function(merged_params, bind_types, current_bind_types TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_types, bind_types);
        }
@@ -730,7 +730,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, orWhere){
        phalcon_read_property_this(&current_bind_params, this_ptr, SL("_bindParams"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_params) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_params);
-           phalcon_fast_array_merge(merged_params, &current_bind_params, &bind_params TSRMLS_CC);
+           phalcon_add_function(merged_params, bind_params, current_bind_params TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_params, bind_params);
        }
@@ -747,7 +747,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, orWhere){
        phalcon_read_property_this(&current_bind_types, this_ptr, SL("_bindTypes"), PH_NOISY_CC);
        if (Z_TYPE_P(current_bind_types) == IS_ARRAY) { 
            PHALCON_INIT_VAR(merged_types);
-           phalcon_fast_array_merge(merged_types, &current_bind_types, &bind_types TSRMLS_CC);
+           phalcon_add_function(merged_types, bind_types, current_bind_types TSRMLS_CC);
        } else {
            PHALCON_CPY_WRT(merged_types, bind_types);
        }

and recompile Phalcon :-)

phalcon pushed a commit that referenced this pull request Jul 25, 2013
Mix integer and string placeholders in Phalcon\Mvc\Model\Query\Builder
@phalcon phalcon merged commit 010d15d into phalcon:1.3.0 Jul 25, 2013
@ghost ghost deleted the issue-701 branch July 25, 2013 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants