Skip to content

Commit

Permalink
Allow one to specify bound parameter types to Phalcon\Mvc\Manager::ex…
Browse files Browse the repository at this point in the history
…ecuteQuery()
  • Loading branch information
sjinks committed Aug 7, 2013
1 parent 57d2f8e commit 226cb01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ext/mvc/model/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}

Expand Down
1 change: 1 addition & 0 deletions ext/mvc/model/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 226cb01

Please sign in to comment.