mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix(db)!: OCP\DB\IPreparedStatement::bindParam() is deprecated and calls bindValue() internally
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
715656927c
commit
66aac18bad
2 changed files with 9 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ use Doctrine\DBAL\ParameterType;
|
|||
use Doctrine\DBAL\Statement;
|
||||
use OCP\DB\IPreparedStatement;
|
||||
use OCP\DB\IResult;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
|
|
@ -58,11 +59,16 @@ class PreparedStatement implements IPreparedStatement {
|
|||
}
|
||||
|
||||
public function bindValue($param, $value, $type = ParameterType::STRING): bool {
|
||||
return $this->statement->bindValue($param, $value, $type);
|
||||
$this->statement->bindValue($param, $value, $type);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool {
|
||||
return $this->statement->bindParam($param, $variable, $type, $length);
|
||||
if ($type !== IQueryBuilder::PARAM_STR) {
|
||||
\OC::$server->getLogger()->warning('PreparedStatement::bindParam() is no longer supported. Use bindValue() instead.', ['exception' => new \BadMethodCallException('bindParam() is no longer supported')]);
|
||||
}
|
||||
$this->bindValue($param, $variable, $type);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function execute($params = null): IResult {
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ interface IPreparedStatement {
|
|||
* @throws Exception
|
||||
*
|
||||
* @since 21.0.0
|
||||
* @deprecated 30.0.0 Use {@see self::bindValue()} instead
|
||||
*/
|
||||
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue