From 226cb01186e7aa7d9cedc74ab67d44b343646f0c Mon Sep 17 00:00:00 2001 From: Vladimir Kolesnikov Date: Thu, 8 Aug 2013 02:24:38 +0300 Subject: [PATCH] Allow one to specify bound parameter types to Phalcon\Mvc\Manager::executeQuery() --- ext/mvc/model/manager.c | 10 +++++++--- ext/mvc/model/manager.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ext/mvc/model/manager.c b/ext/mvc/model/manager.c index 6cf4b645321..8c0c12534cc 100644 --- a/ext/mvc/model/manager.c +++ b/ext/mvc/model/manager.c @@ -2828,17 +2828,21 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, createQuery){ */ PHP_METHOD(Phalcon_Mvc_Model_Manager, executeQuery){ - zval *phql, *placeholders = NULL, *dependency_injector; + zval *phql, *placeholders = NULL, *types = NULL, *dependency_injector; zval *query; PHALCON_MM_GROW(); - phalcon_fetch_params(1, 1, 1, &phql, &placeholders); + phalcon_fetch_params(1, 1, 2, &phql, &placeholders, &types); if (!placeholders) { PHALCON_INIT_VAR(placeholders); } + if (!types) { + PHALCON_INIT_VAR(types); + } + PHALCON_OBS_VAR(dependency_injector); phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC); if (Z_TYPE_P(dependency_injector) != IS_OBJECT) { @@ -2859,7 +2863,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, executeQuery){ /** * Execute the query */ - phalcon_call_method_p1(return_value, query, "execute", placeholders); + phalcon_call_method_p2(return_value, query, "execute", placeholders, types); RETURN_MM(); } diff --git a/ext/mvc/model/manager.h b/ext/mvc/model/manager.h index 6cc0c1dc0b7..3277981642f 100644 --- a/ext/mvc/model/manager.h +++ b/ext/mvc/model/manager.h @@ -332,6 +332,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_manager_executequery, 0, 0, 1) ZEND_ARG_INFO(0, phql) ZEND_ARG_INFO(0, placeholders) + ZEND_ARG_INFO(0, types) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_model_manager_createbuilder, 0, 0, 0)