PlasmaPHP / driver-mysql

The plasma driver for MySQL / MariaDB.

Home Page:https://plasmaphp.github.io/driver-mysql/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Move params replacing to core

opened this issue · comments

Move the replacing of params in Statement::execute to the plasma/core utilities.

if(\count($params) < \count($this->params)) {
throw new \Plasma\Exception('Not enough parameters for this statement, expected '.\count($this->params).', got '.\count($params));
}
$realParams = array();
$pos = (\array_key_exists(0, $params) ? 0 : 1);
foreach($this->rewrittenParams as $param) {
$key = ($param[0] === ':' ? $param : ($pos++));
if(!\array_key_exists($key, $params)) {
throw new \Plasma\Exception('Missing parameter with key "'.$key.'"');
}
$realParams[] = $params[$key];
}