protected function _executePrepared($statement, $bind)
{
foreach ($bind as $parameter => $value) {
if (is_string($value)) {
$type = \PDO::PARAM_STR;
} elseif (is_int($value)) {
$type = \PDO::PARAM_INT;
} elseif (is_bool($value)) {
$type = \PDO::PARAM_BOOL;
} elseif ($value === null) {
$type = \PDO::PARAM_NULL;
} else {
throw new DbException('The `:type` type of `:parameter` parameter is not support', ['parameter' => $parameter, 'type' => gettype($value)]);
}
if (is_int($parameter)) {
$statement->bindValue($parameter + 1, $value, $type);
} else {
if ($parameter[0] === ':') {
throw new DbException('Bind does not require started with `:` for `:parameter` parameter', ['parameter' => $parameter]);
}
$statement->bindValue(':' . $parameter, $value, $type);
}
}
$statement->execute();
return $statement;
}