-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
tests/Doctrine/Tests/DBAL/Functional/LockModeSQLLogger.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\DBAL\Functional; | ||
|
||
use Doctrine\DBAL\Logging\SQLLogger; | ||
|
||
use function microtime; | ||
|
||
class LockModeSQLLogger implements SQLLogger | ||
{ | ||
/** @var int */ | ||
private $cid; | ||
|
||
/** @var list<array{cid: int, time: float, sql: string}> */ | ||
private $queries = []; | ||
|
||
public function __construct(int $cid) | ||
{ | ||
$this->cid = $cid; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function startQuery($sql, ?array $params = null, ?array $types = null): void | ||
{ | ||
$this->queries[] = [ | ||
'cid' => $this->cid, | ||
'time' => microtime(true), | ||
'sql' => $sql, | ||
]; | ||
} | ||
|
||
public function stopQuery(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @return list<array{cid: int, time: float, sql: string}> | ||
*/ | ||
public function getQueries(): array | ||
{ | ||
return $this->queries; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters