Skip to content

Commit

Permalink
Remove src\TestSupport\TestQueryBuilderTrait::class from yiisoft\db. (#…
Browse files Browse the repository at this point in the history
…405)

* Remove src\TestSupport\TestQueryBuilderTrait::class from yiisoft\db.
  • Loading branch information
terabytesoftw committed Dec 6, 2022
1 parent 68e4d7e commit 1afe6cc
Show file tree
Hide file tree
Showing 16 changed files with 2,870 additions and 1,172 deletions.
37 changes: 16 additions & 21 deletions src/Command/Command.php
Expand Up @@ -577,6 +577,22 @@ public function upsert(
*/
abstract protected function getCacheKey(int $queryMode, string $rawSql): array;

/**
* Executes a prepared statement.
*
* @param string|null $rawSql the rawSql if it has been created.
*
* @throws Exception|Throwable
*/
abstract protected function internalExecute(string|null $rawSql): void;

abstract protected function internalGetQueryResult(int $queryMode): mixed;

/**
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
*/
abstract protected function refreshTableSchema(): void;

/**
* @param int $queryMode - one from modes QUERY_MODE_*
*
Expand Down Expand Up @@ -651,17 +667,6 @@ protected function queryWithoutCache(string $rawSql, int $queryMode): mixed
return $result;
}

/**
* Executes a prepared statement.
*
* @param string|null $rawSql the rawSql if it has been created.
*
* @throws Exception|Throwable
*/
abstract protected function internalExecute(string|null $rawSql): void;

abstract protected function internalGetQueryResult(int $queryMode): mixed;

/**
* Logs the current database query if query logging is enabled and returns the profiling token if profiling is
* enabled.
Expand All @@ -671,16 +676,6 @@ protected function logQuery(string $rawSql, string $category): void
$this->logger?->log(LogLevel::INFO, $rawSql, [$category]);
}

/**
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
*/
protected function refreshTableSchema(): void
{
if ($this->refreshTableName !== null) {
$this->queryBuilder()->schema()->refreshTableSchema($this->refreshTableName);
}
}

/**
* Marks a specified table schema to be refreshed after command execution.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Driver/PDO/CommandPDO.php
Expand Up @@ -174,6 +174,16 @@ protected function internalGetQueryResult(int $queryMode): mixed
return $result;
}

/**
* Refreshes table schema, which was marked by {@see requireTableSchemaRefresh()}.
*/
protected function refreshTableSchema(): void
{
if ($this->refreshTableName !== null) {
$this->db->getSchema()->refreshTableSchema($this->refreshTableName);
}
}

/**
* Executes a prepared statement.
*
Expand Down
2 changes: 1 addition & 1 deletion src/QueryBuilder/DMLQueryBuilder.php
Expand Up @@ -154,7 +154,7 @@ public function upsert(
bool|array $updateColumns,
array &$params
): string {
throw new NotSupportedException(static::class . ' does not support upsert.');
throw new NotSupportedException(__METHOD__ . ' is not supported by this DBMS.');
}

/**
Expand Down
5 changes: 0 additions & 5 deletions src/QueryBuilder/QueryBuilder.php
Expand Up @@ -378,11 +378,6 @@ public function resetSequence(string $tableName, int|string|null $value = null):
return $this->dmlBuilder->resetSequence($tableName, $value);
}

public function schema(): SchemaInterface
{
return $this->schema;
}

public function selectExists(string $rawSql): string
{
return $this->dqlBuilder->selectExists($rawSql);
Expand Down
6 changes: 0 additions & 6 deletions src/QueryBuilder/QueryBuilderInterface.php
Expand Up @@ -9,7 +9,6 @@
use Yiisoft\Db\Expression\ExpressionInterface;
use Yiisoft\Db\Schema\ColumnSchemaBuilder;
use Yiisoft\Db\Schema\QuoterInterface;
use Yiisoft\Db\Schema\SchemaInterface;

interface QueryBuilderInterface extends DDLQueryBuilderInterface, DMLQueryBuilderInterface, DQLQueryBuilderInterface
{
Expand Down Expand Up @@ -87,9 +86,4 @@ public function getExpressionBuilder(ExpressionInterface $expression): object;
* Return quoter interface instance.
*/
public function quoter(): QuoterInterface;

/**
* Return schema interface instance.
*/
public function schema(): SchemaInterface;
}
59 changes: 0 additions & 59 deletions src/TestSupport/TraversableObject.php

This file was deleted.

0 comments on commit 1afe6cc

Please sign in to comment.