Skip to content

Commit 1afe6cc

Browse files
Remove src\TestSupport\TestQueryBuilderTrait::class from yiisoft\db. (#405)
* Remove src\TestSupport\TestQueryBuilderTrait::class from yiisoft\db.
1 parent 68e4d7e commit 1afe6cc

16 files changed

Lines changed: 2870 additions & 1172 deletions

src/Command/Command.php

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,22 @@ public function upsert(
577577
*/
578578
abstract protected function getCacheKey(int $queryMode, string $rawSql): array;
579579

580+
/**
581+
* Executes a prepared statement.
582+
*
583+
* @param string|null $rawSql the rawSql if it has been created.
584+
*
585+
* @throws Exception|Throwable
586+
*/
587+
abstract protected function internalExecute(string|null $rawSql): void;
588+
589+
abstract protected function internalGetQueryResult(int $queryMode): mixed;
590+
591+
/**
592+
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
593+
*/
594+
abstract protected function refreshTableSchema(): void;
595+
580596
/**
581597
* @param int $queryMode - one from modes QUERY_MODE_*
582598
*
@@ -651,17 +667,6 @@ protected function queryWithoutCache(string $rawSql, int $queryMode): mixed
651667
return $result;
652668
}
653669

654-
/**
655-
* Executes a prepared statement.
656-
*
657-
* @param string|null $rawSql the rawSql if it has been created.
658-
*
659-
* @throws Exception|Throwable
660-
*/
661-
abstract protected function internalExecute(string|null $rawSql): void;
662-
663-
abstract protected function internalGetQueryResult(int $queryMode): mixed;
664-
665670
/**
666671
* Logs the current database query if query logging is enabled and returns the profiling token if profiling is
667672
* enabled.
@@ -671,16 +676,6 @@ protected function logQuery(string $rawSql, string $category): void
671676
$this->logger?->log(LogLevel::INFO, $rawSql, [$category]);
672677
}
673678

674-
/**
675-
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
676-
*/
677-
protected function refreshTableSchema(): void
678-
{
679-
if ($this->refreshTableName !== null) {
680-
$this->queryBuilder()->schema()->refreshTableSchema($this->refreshTableName);
681-
}
682-
}
683-
684679
/**
685680
* Marks a specified table schema to be refreshed after command execution.
686681
*

src/Driver/PDO/CommandPDO.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ protected function internalGetQueryResult(int $queryMode): mixed
174174
return $result;
175175
}
176176

177+
/**
178+
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
179+
*/
180+
protected function refreshTableSchema(): void
181+
{
182+
if ($this->refreshTableName !== null) {
183+
$this->db->getSchema()->refreshTableSchema($this->refreshTableName);
184+
}
185+
}
186+
177187
/**
178188
* Executes a prepared statement.
179189
*

src/QueryBuilder/DMLQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function upsert(
154154
bool|array $updateColumns,
155155
array &$params
156156
): string {
157-
throw new NotSupportedException(static::class . ' does not support upsert.');
157+
throw new NotSupportedException(__METHOD__ . ' is not supported by this DBMS.');
158158
}
159159

160160
/**

src/QueryBuilder/QueryBuilder.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,6 @@ public function resetSequence(string $tableName, int|string|null $value = null):
378378
return $this->dmlBuilder->resetSequence($tableName, $value);
379379
}
380380

381-
public function schema(): SchemaInterface
382-
{
383-
return $this->schema;
384-
}
385-
386381
public function selectExists(string $rawSql): string
387382
{
388383
return $this->dqlBuilder->selectExists($rawSql);

src/QueryBuilder/QueryBuilderInterface.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Yiisoft\Db\Expression\ExpressionInterface;
1010
use Yiisoft\Db\Schema\ColumnSchemaBuilder;
1111
use Yiisoft\Db\Schema\QuoterInterface;
12-
use Yiisoft\Db\Schema\SchemaInterface;
1312

1413
interface QueryBuilderInterface extends DDLQueryBuilderInterface, DMLQueryBuilderInterface, DQLQueryBuilderInterface
1514
{
@@ -87,9 +86,4 @@ public function getExpressionBuilder(ExpressionInterface $expression): object;
8786
* Return quoter interface instance.
8887
*/
8988
public function quoter(): QuoterInterface;
90-
91-
/**
92-
* Return schema interface instance.
93-
*/
94-
public function schema(): SchemaInterface;
9589
}

src/TestSupport/TraversableObject.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)