Estou recebendo um erro quando uso o bindParam do PDO, código:
Classe ConnectionPDO:
function __construct($dsn, $username = NULL, $password = NULL, $options = NULL) {
parent::__construct($dsn, $username, $password, $options);
$this->LoadDriverMethods();
}
public function insert($table, $data) {
$this->lastSQL = $this->driver->insert($table, $data);
$stmt = $this->prepare($this->lastSQL);
$this->driver->setParams($this->stmt);
return $this->stmt;
}
private function LoadDriverMethods(){
$driver = __DIR__ . DIRECTORY_SEPARATOR . 'drivers' .
DIRECTORY_SEPARATOR . 'sqldriver.' .
strtolower($this->getAttribute(PDO::ATTR_DRIVER_NAME)) . '.php';
if (!is_file($driver))
throw new Exception('Não foi possível carregar os métodos do driver', 1);
require_once $driver;
$this->driver = new SQLDriver();
}
Classe SQLDriver:
public function setParams(PDOStatement $stmt){
$params = $this->getParams();
if (is_array($params) && !empty($params))
foreach ($params as $param => $value)
$stmt->bindParam($param, $this->prepareParam($value), $this->getParamType($value));
}
Erro:
Strict Standards: Only variables should be passed by reference in \ConnectionPDO\drivers\sqldriver.mysql.php
Que se refere a seguinte linha na classe SQLDriver:
$stmt->bindParam($param, $this->prepareParam($value), $this->getParamType($value));