Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jan 26, 2024
1 parent 6c06f6b commit 7e37991
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Enh #801: Deprecate `AbstractSchema::normalizeRowKeyCase()` method (@Tigrov)
- Enh #801: Deprecate `SchemaInterface::getRawTableName()` and add `QuoterInterface::getRawTableName()` method (@Tigrov)
- Enh #801: Deprecate `SchemaInterface::isReadQuery()` and add `DbStringHelper::isReadQuery()` method (@Tigrov)
- Enh #801: Remove unnecessary symbol `\\` from `rtrim()` function inside `DbStringHelper::baseName()` method (@Tigrov)

## 1.2.0 November 12, 2023

Expand Down
8 changes: 5 additions & 3 deletions src/Schema/AbstractSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function getDataType(mixed $data): int
};
}

/** @deprecated Use {@see QuoterInterface::getRawTableName()}. Will be removed in version 2.0.0. */
public function getRawTableName(string $name): string
{
if (str_contains($name, '{{')) {
Expand Down Expand Up @@ -315,6 +316,7 @@ public function getTableUniques(string $name, bool $refresh = false): array
return is_array($tableUniques) ? $tableUniques : [];
}

/** @deprecated Use {@see DbStringHelper::isReadQuery()}. Will be removed in version 2.0.0. */
public function isReadQuery(string $sql): bool
{
$pattern = '/^\s*(SELECT|SHOW|DESCRIBE)\b/i';
Expand All @@ -340,7 +342,7 @@ public function refresh(): void
*/
public function refreshTableSchema(string $name): void
{
$rawName = $this->getRawTableName($name);
$rawName = $this->db->getQuoter()->getRawTableName($name);

unset($this->tableMetadata[$rawName]);

Expand Down Expand Up @@ -470,7 +472,7 @@ protected function getSchemaMetadata(string $schema, string $type, bool $refresh
*/
protected function getTableMetadata(string $name, string $type, bool $refresh = false): mixed
{
$rawName = $this->getRawTableName($name);
$rawName = $this->db->getQuoter()->getRawTableName($name);

if (!isset($this->tableMetadata[$rawName])) {
$this->loadTableMetadataFromCache($rawName);
Expand Down Expand Up @@ -571,7 +573,7 @@ protected function resolveTableName(string $name): TableSchemaInterface
protected function setTableMetadata(string $name, string $type, mixed $data): void
{
/** @psalm-suppress MixedArrayAssignment */
$this->tableMetadata[$this->getRawTableName($name)][$type] = $data;
$this->tableMetadata[$this->db->getQuoter()->getRawTableName($name)][$type] = $data;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/SchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function getDataType(mixed $data): int;
*
* @return string The real name of the given table name.
*
* @deprecated Use {@see Quoter::getRawTableName()}. Will be removed in version 2.0.0.
* @deprecated Use {@see QuoterInterface::getRawTableName()}. Will be removed in version 2.0.0.
*/
public function getRawTableName(string $name): string;

Expand Down

0 comments on commit 7e37991

Please sign in to comment.