Skip to content

Commit

Permalink
Merge pull request phalcon#1940 from sjinks/issue-1011
Browse files Browse the repository at this point in the history
Autodetect integer bound parameters
  • Loading branch information
Phalcon committed Jan 31, 2014
2 parents d00649b + 9a210c6 commit 65e20f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion ext/db/adapter/pdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ PHP_METHOD(Phalcon_Db_Adapter_Pdo, executePrepared){

} else {
PHALCON_INIT_NVAR(type);
ZVAL_LONG(type, 2 /* BIND_PARAM_STR */);
if (Z_TYPE_P(value) == IS_LONG) {
ZVAL_LONG(type, 1 /* BIND_PARAM_INT */);
}
else {
ZVAL_LONG(type, 2 /* BIND_PARAM_STR */);
}
Z_SET_ISREF_P(value);
phalcon_call_method_p3_noret(statement, "bindparam", parameter, value, type);
Z_UNSET_ISREF_P(value);
Expand Down
4 changes: 2 additions & 2 deletions unit-tests/ModelsQueryExecuteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public function _testUpdateExecute($di)
"email" => "le-marina@hotmail.com",
"limit" => 1,
),
array('email' => \Phalcon\Db\Column::BIND_PARAM_STR, 'limit' => \Phalcon\Db\Column::BIND_PARAM_INT)
array('email' => \Phalcon\Db\Column::BIND_PARAM_STR, /*'limit' => \Phalcon\Db\Column::BIND_PARAM_INT*/)
);
$this->assertTrue($status->success());
}
Expand Down Expand Up @@ -824,7 +824,7 @@ public function _testDeleteExecute($di)
"email" => "fuego@hotmail.com",
"limit" => 1,
),
array('email' => \Phalcon\Db\Column::BIND_PARAM_STR, 'limit' => \Phalcon\Db\Column::BIND_PARAM_INT)
array('email' => \Phalcon\Db\Column::BIND_PARAM_STR,/* 'limit' => \Phalcon\Db\Column::BIND_PARAM_INT */)
);
$this->assertTrue($status->success());
}
Expand Down

0 comments on commit 65e20f7

Please sign in to comment.