Skip to content

Commit 04b9841

Browse files
authored
Merge pull request #80 from artemeon/chore/add-missing-methods-to-connection-interface
2 parents 4a546f7 + 8169645 commit 04b9841

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/Connection.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ public function transactionRollback(): void
750750
$this->rollBack();
751751
}
752752

753+
#[\Override]
753754
public function hasOpenTransactions(): bool
754755
{
755756
return $this->numberOfOpenTransactions > 0;
@@ -810,6 +811,7 @@ public function getTables(?string $prefix = null): array
810811
* @throws ConnectionException
811812
* @deprecated
812813
*/
814+
#[\Override]
813815
public function getColumnsOfTable(string $tableName): array
814816
{
815817
if (!$this->hasTable($tableName)) {
@@ -1298,6 +1300,7 @@ public function dbsafeString(mixed $input, bool $htmlSpecialChars = true, bool $
12981300
/**
12991301
* Method to flush the query-cache.
13001302
*/
1303+
#[\Override]
13011304
public function flushQueryCache(): void
13021305
{
13031306
$this->queryCache = [];
@@ -1308,6 +1311,7 @@ public function flushQueryCache(): void
13081311
* Since the tables won't change during regular operations,
13091312
* flushing the tables cache is only required during package updates / installations.
13101313
*/
1314+
#[\Override]
13111315
public function flushTablesCache(): void
13121316
{
13131317
$this->tablesCache = [];
@@ -1319,6 +1323,7 @@ public function flushTablesCache(): void
13191323
*
13201324
* @throws ConnectionException
13211325
*/
1326+
#[\Override]
13221327
public function flushPreparedStatementsCache(): void
13231328
{
13241329
if (!$this->connected) {
@@ -1375,6 +1380,7 @@ public function isConnected(): bool
13751380
* method unifies the behaviour. In order to select a column, which contains a backslash you need to escape the value
13761381
* with this method.
13771382
*/
1383+
#[\Override]
13781384
public function escape(mixed $value): mixed
13791385
{
13801386
return $this->dbDriver->escape($value);

src/ConnectionInterface.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,19 @@ public function getJsonColumnExpression(string $column, string $key): string;
377377
* @return string The generated SQL snippet.
378378
*/
379379
public function getNthLastElementFromSlug(string $column, int $position): string;
380+
381+
public function flushQueryCache(): void;
382+
383+
public function flushTablesCache(): void;
384+
385+
public function flushPreparedStatementsCache(): void;
386+
387+
/**
388+
* @return array<string,array{columnName:string,columnType:DataType}>
389+
*/
390+
public function getColumnsOfTable(string $tableName): array;
391+
392+
public function escape(mixed $value): mixed;
393+
394+
public function hasOpenTransactions(): bool;
380395
}

src/MockConnection.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,37 @@ public function getNthLastElementFromSlug(string $column, int $position): string
419419
{
420420
return '';
421421
}
422+
423+
#[Override]
424+
public function flushQueryCache(): void
425+
{
426+
}
427+
428+
#[Override]
429+
public function flushTablesCache(): void
430+
{
431+
}
432+
433+
#[Override]
434+
public function flushPreparedStatementsCache(): void
435+
{
436+
}
437+
438+
#[Override]
439+
public function getColumnsOfTable(string $tableName): array
440+
{
441+
return [];
442+
}
443+
444+
#[Override]
445+
public function escape(mixed $value): mixed
446+
{
447+
return $value;
448+
}
449+
450+
#[Override]
451+
public function hasOpenTransactions(): bool
452+
{
453+
return false;
454+
}
422455
}

0 commit comments

Comments
 (0)