Skip to content

Commit 1ef0bd4

Browse files
committed
Engine::delimite() -> delimit() (BC break)
1 parent 24167bc commit 1ef0bd4

File tree

14 files changed

+57
-57
lines changed

14 files changed

+57
-57
lines changed

src/Database/Drivers/Engine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function convertToPhp(mixed $value, array $meta, TypeConverter $converter): mixe
4141
/********************* SQL utilities ****************d*g**/
4242

4343
/** Escapes an identifier for use in an SQL statement. */
44-
function delimite(string $name): string;
44+
function delimit(string $name): string;
4545

4646
/** Formats a date-time value for use in an SQL statement. */
4747
function formatDateTime(\DateTimeInterface $value): string;

src/Database/Drivers/Engines/MSSQLEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
4141
/********************* SQL ****************d*g**/
4242

4343

44-
public function delimite(string $name): string
44+
public function delimit(string $name): string
4545
{
4646
// @see https://msdn.microsoft.com/en-us/library/ms176027.aspx
4747
return '[' . str_replace(['[', ']'], ['[[', ']]'], $name) . ']';

src/Database/Drivers/Engines/MySQLEngine.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
5252
/********************* SQL ****************d*g**/
5353

5454

55-
public function delimite(string $name): string
55+
public function delimit(string $name): string
5656
{
5757
// @see http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
5858
return '`' . str_replace('`', '``', $name) . '`';
@@ -108,7 +108,7 @@ public function getTables(): array
108108
public function getColumns(string $table): array
109109
{
110110
$columns = [];
111-
$rows = $this->connection->query('SHOW FULL COLUMNS FROM ' . $this->delimite($table));
111+
$rows = $this->connection->query('SHOW FULL COLUMNS FROM ' . $this->delimit($table));
112112
while ($row = $rows->fetch()) {
113113
$row = array_change_key_case($row);
114114
$typeInfo = Nette\Database\Helpers::parseColumnType($row['type']);
@@ -133,7 +133,7 @@ public function getColumns(string $table): array
133133
public function getIndexes(string $table): array
134134
{
135135
$indexes = [];
136-
$rows = $this->connection->query('SHOW INDEX FROM ' . $this->delimite($table));
136+
$rows = $this->connection->query('SHOW INDEX FROM ' . $this->delimit($table));
137137
while ($row = $rows->fetch()) {
138138
$id = $row['Key_name'];
139139
$indexes[$id]['name'] = $id;

src/Database/Drivers/Engines/ODBCEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
3434
/********************* SQL ****************d*g**/
3535

3636

37-
public function delimite(string $name): string
37+
public function delimit(string $name): string
3838
{
3939
return '[' . str_replace(['[', ']'], ['[[', ']]'], $name) . ']';
4040
}

src/Database/Drivers/Engines/OracleEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
5050
/********************* SQL ****************d*g**/
5151

5252

53-
public function delimite(string $name): string
53+
public function delimit(string $name): string
5454
{
5555
// @see http://download.oracle.com/docs/cd/B10500_01/server.920/a96540/sql_elements9a.htm
5656
return '"' . str_replace('"', '""', $name) . '"';

src/Database/Drivers/Engines/PostgreSQLEngine.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
4848
/********************* SQL ****************d*g**/
4949

5050

51-
public function delimite(string $name): string
51+
public function delimit(string $name): string
5252
{
5353
// @see http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
5454
return '"' . str_replace('"', '""', $name) . '"';
@@ -152,7 +152,7 @@ public function getColumns(string $table): array
152152
AND NOT a.attisdropped
153153
ORDER BY
154154
a.attnum
155-
X, [$this->delimiteFQN($table)]);
155+
X, [$this->delimitFQN($table)]);
156156

157157
while ($row = $rows->fetch()) {
158158
$column = $row;
@@ -183,7 +183,7 @@ public function getIndexes(string $table): array
183183
WHERE
184184
c1.relkind IN ('r', 'p')
185185
AND c1.oid = ?::regclass
186-
X, [$this->delimiteFQN($table)]);
186+
X, [$this->delimitFQN($table)]);
187187

188188
while ($row = $rows->fetch()) {
189189
$id = $row['name'];
@@ -218,7 +218,7 @@ public function getForeignKeys(string $table): array
218218
co.contype = 'f'
219219
AND cl.oid = ?::regclass
220220
AND nf.nspname = ANY (pg_catalog.current_schemas(FALSE))
221-
X, [$this->delimiteFQN($table)]);
221+
X, [$this->delimitFQN($table)]);
222222

223223
while ($row = $rows->fetch()) {
224224
$id = $row['name'];
@@ -243,8 +243,8 @@ public function convertToPhp(mixed $value, array $meta, TypeConverter $converter
243243
/**
244244
* Converts: schema.name => "schema"."name"
245245
*/
246-
private function delimiteFQN(string $name): string
246+
private function delimitFQN(string $name): string
247247
{
248-
return implode('.', array_map([$this, 'delimite'], explode('.', $name)));
248+
return implode('.', array_map([$this, 'delimit'], explode('.', $name)));
249249
}
250250
}

src/Database/Drivers/Engines/SQLServerEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
4141
/********************* SQL ****************d*g**/
4242

4343

44-
public function delimite(string $name): string
44+
public function delimit(string $name): string
4545
{
4646
/** @see https://msdn.microsoft.com/en-us/library/ms176027.aspx */
4747
return '[' . str_replace(']', ']]', $name) . ']';

src/Database/Drivers/Engines/SQLiteEngine.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function classifyException(Nette\Database\DriverException $e): ?string
7070
/********************* SQL ****************d*g**/
7171

7272

73-
public function delimite(string $name): string
73+
public function delimit(string $name): string
7474
{
7575
return '[' . strtr($name, '[]', ' ') . ']';
7676
}
@@ -143,7 +143,7 @@ public function getColumns(string $table): array
143143
X, [$table, $table])->fetch();
144144

145145
$columns = [];
146-
$rows = $this->connection->query("PRAGMA table_info({$this->delimite($table)})");
146+
$rows = $this->connection->query("PRAGMA table_info({$this->delimit($table)})");
147147
while ($row = $rows->fetch()) {
148148
$column = $row['name'];
149149
$pattern = "/(\"$column\"|`$column`|\\[$column\\]|$column)\\s+[^,]+\\s+PRIMARY\\s+KEY\\s+AUTOINCREMENT/Ui";
@@ -169,7 +169,7 @@ public function getColumns(string $table): array
169169
public function getIndexes(string $table): array
170170
{
171171
$indexes = [];
172-
$rows = $this->connection->query("PRAGMA index_list({$this->delimite($table)})");
172+
$rows = $this->connection->query("PRAGMA index_list({$this->delimit($table)})");
173173
while ($row = $rows->fetch()) {
174174
$id = $row['name'];
175175
$indexes[$id]['name'] = $id;
@@ -178,7 +178,7 @@ public function getIndexes(string $table): array
178178
}
179179

180180
foreach ($indexes as $index => $values) {
181-
$res = $this->connection->query("PRAGMA index_info({$this->delimite($index)})");
181+
$res = $this->connection->query("PRAGMA index_info({$this->delimit($index)})");
182182
while ($row = $res->fetch()) {
183183
$indexes[$index]['columns'][] = $row['name'];
184184
}
@@ -216,7 +216,7 @@ public function getIndexes(string $table): array
216216
public function getForeignKeys(string $table): array
217217
{
218218
$keys = [];
219-
$rows = $this->connection->query("PRAGMA foreign_key_list({$this->delimite($table)})");
219+
$rows = $this->connection->query("PRAGMA foreign_key_list({$this->delimit($table)})");
220220
while ($row = $rows->fetch()) {
221221
$id = $row['id'];
222222
$keys[$id]['name'] = $id;

src/Database/SqlPreprocessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,6 @@ private function formatValue(mixed $value, ?string $mode = null): string
320320

321321
private function delimite(string $name): string
322322
{
323-
return implode('.', array_map($this->engine->delimite(...), explode('.', $name)));
323+
return implode('.', array_map($this->engine->delimit(...), explode('.', $name)));
324324
}
325325
}

src/Database/Table/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ public function insert(iterable $data): ActiveRow|array|int|bool
790790

791791
// First check sequence
792792
if (!empty($primarySequenceName) && $primaryAutoincrementKey) {
793-
$primaryKey[$primaryAutoincrementKey] = $this->explorer->getInsertId($this->explorer->getDatabaseEngine()->delimite($primarySequenceName));
793+
$primaryKey[$primaryAutoincrementKey] = $this->explorer->getInsertId($this->explorer->getDatabaseEngine()->delimit($primarySequenceName));
794794

795795
// Autoincrement primary without sequence
796796
} elseif ($primaryAutoincrementKey) {

0 commit comments

Comments
 (0)