Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('build')
->exclude('vendor')
;

return (new PhpCsFixer\Config())
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGES for crate-dbal
Unreleased
==========

- Added support for Doctrine 3, dropped support for Doctrine 2.
- Added support for Doctrine DBAL 3, dropped support for Doctrine DBAL 2.

2025/11/13 4.0.3
================
Expand Down
33 changes: 15 additions & 18 deletions src/Crate/DBAL/Driver/PDOCrate/CrateStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@

use Crate\PDO\PDOInterface;
use Crate\PDO\PDOStatement;
use Doctrine\DBAL\Driver\PDO\Exception;
use Doctrine\DBAL\Driver\PDOStatementImplementations;
use Doctrine\DBAL\Driver\Result as ResultInterface;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\ParameterType;
use Doctrine\Deprecations\Deprecation;
use PDO;
use PDOException;

/**
* @internal
Expand Down Expand Up @@ -62,10 +61,14 @@ public function execute($params = null): ResultInterface
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5556',
'Passing $params to Statement::execute() is deprecated. Bind parameters using'
. ' Statement::bindParam() or Statement::bindValue() instead.',
. ' Statement::bindValue() instead.',
);
}
$this->stmt->execute($params);
try {
$this->stmt->execute($params);
} catch (PDOException $exception) {
throw Exception::new($exception);
}
return new Result($this);
}

Expand All @@ -88,16 +91,22 @@ public function rowCount(): int
/**
* {@inheritDoc}
*/
public function bindValue($param, $value, $type = ParameterType::STRING)
public function bindValue($param, $value, $type = ParameterType::STRING): void
{
return $this->stmt->bindValue($param, $value, $type);
$this->stmt->bindValue($param, $value, $type);
}

/**
* @deprecated Use bindValue() instead.
* {@inheritDoc}
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5563',
'Statement::bindParam() was deprecated. Please use Statement::bindValue() instead.',
);
return $this->stmt->bindParam($param, $variable, $type, $length);
}

Expand All @@ -112,18 +121,6 @@ public function fetch(
return $this->stmt->fetch($fetch_style, $cursor_orientation, $cursor_offset);
}

/**
* @phpstan-param PDO::FETCH_* $mode
*
* @return list<mixed>
*
* @throws Exception
*/
public function fetchAll(int $mode): array
{
return $this->stmt->fetchAll($mode);
}

public function fetchColumn($column_number = 0)
{
return $this->stmt->fetchColumn($column_number);
Expand Down
16 changes: 7 additions & 9 deletions src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ public function __construct($dsn, $user = null, $password = null, ?array $option
$this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

public function getServerVersion()
public function getServerVersion(): string
{
// Unable to detect platform version.
return null;
// TODO: Need to retrieve and propagate CrateDB server version here?
return "0.0.0";
}

public function getNativeConnection(): PDOCrateDB
Expand Down Expand Up @@ -107,23 +108,20 @@ public function quote($value, $type = ParameterType::STRING): string
return $this->connection->quote($value, $type);
}

public function lastInsertId($name = null): string|false
public function lastInsertId($name = null): string
{
return $this->connection->lastInsertId($name);
}

public function beginTransaction(): bool
public function beginTransaction(): void
{
return true;
}

public function commit(): bool
public function commit(): void
{
return true;
}

public function rollBack(): bool
public function rollBack(): void
{
return true;
}
}
6 changes: 3 additions & 3 deletions src/Crate/DBAL/Driver/PDOCrate/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ public function __construct(CrateStatement $statement)
/**
* {@inheritDoc}
*/
public function fetchNumeric()
public function fetchNumeric(): false|array
{
return $this->fetch(PDO::FETCH_NUM);
}

/**
* {@inheritDoc}
*/
public function fetchAssociative()
public function fetchAssociative(): false|array
{
return $this->fetch(PDO::FETCH_ASSOC);
}

/**
* {@inheritDoc}
*/
public function fetchOne()
public function fetchOne(): mixed
{
return FetchUtils::fetchOne($this);
}
Expand Down
Loading
Loading