Skip to content

Commit

Permalink
Remove PDO specific exception from interface
Browse files Browse the repository at this point in the history
  • Loading branch information
abnegate committed Dec 2, 2024
1 parent a13ea29 commit e7bfd89
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/Database/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,4 @@ abstract public function getConnectionId(): string;
* @return array<string>
*/
abstract public function getInternalIndexesKeys(): array;

abstract protected function processException(\PDOException $e): \Exception;
}
28 changes: 14 additions & 14 deletions src/Database/Adapter/MariaDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,20 @@ public function setTimeout(int $milliseconds, string $event = Database::EVENT_AL
});
}

/**
* @return string
*/
public function getConnectionId(): string
{
$stmt = $this->getPDO()->query("SELECT CONNECTION_ID();");
return $stmt->fetchColumn();
}

public function getInternalIndexesKeys(): array
{
return ['primary', '_created_at', '_updated_at', '_tenant_id'];
}

protected function processException(PDOException $e): \Exception
{
// Timeout
Expand Down Expand Up @@ -2419,18 +2433,4 @@ protected function processException(PDOException $e): \Exception

return $e;
}

/**
* @return string
*/
public function getConnectionId(): string
{
$stmt = $this->getPDO()->query("SELECT CONNECTION_ID();");
return $stmt->fetchColumn();
}

public function getInternalIndexesKeys(): array
{
return ['primary', '_created_at', '_updated_at', '_tenant_id'];
}
}
5 changes: 5 additions & 0 deletions src/Database/Adapter/SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -1146,4 +1146,9 @@ public function getInternalIndexesKeys(): array
{
return [];
}

protected function processException(PDOException $e): \Exception
{
return $e;
}
}

0 comments on commit e7bfd89

Please sign in to comment.