Skip to content

Commit e42d0a3

Browse files
committed
Engine::delimite() -> delimit() (BC break)
1 parent 2159ebd commit e42d0a3

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
@@ -40,7 +40,7 @@ function convertToPhp(mixed $value, array $meta, TypeConverter $converter): mixe
4040
/********************* SQL utilities ****************d*g**/
4141

4242
/** Adds delimiters around database identifier. */
43-
function delimite(string $name): string;
43+
function delimit(string $name): string;
4444

4545
/** Formats a date-time value for use in an SQL statement. */
4646
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) . '`';
@@ -114,7 +114,7 @@ public function getTables(): array
114114
public function getColumns(string $table): array
115115
{
116116
$columns = [];
117-
$rows = $this->connection->query('SHOW FULL COLUMNS FROM ' . $this->delimite($table));
117+
$rows = $this->connection->query('SHOW FULL COLUMNS FROM ' . $this->delimit($table));
118118
while ($row = $rows->fetch()) {
119119
$row = array_change_key_case($row);
120120
$typeInfo = Nette\Database\Helpers::parseColumnType($row['type']);
@@ -140,7 +140,7 @@ public function getColumns(string $table): array
140140
public function getIndexes(string $table): array
141141
{
142142
$indexes = [];
143-
$rows = $this->connection->query('SHOW INDEX FROM ' . $this->delimite($table));
143+
$rows = $this->connection->query('SHOW INDEX FROM ' . $this->delimit($table));
144144
while ($row = $rows->fetch()) {
145145
$id = $row['Key_name'];
146146
$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) . '"';
@@ -155,7 +155,7 @@ public function getColumns(string $table): array
155155
AND NOT a.attisdropped
156156
ORDER BY
157157
a.attnum
158-
X, [$this->delimiteFQN($table)]);
158+
X, [$this->delimitFQN($table)]);
159159

160160
while ($row = $rows->fetch()) {
161161
$column = $row;
@@ -186,7 +186,7 @@ public function getIndexes(string $table): array
186186
WHERE
187187
c1.relkind IN ('r', 'p')
188188
AND c1.oid = ?::regclass
189-
X, [$this->delimiteFQN($table)]);
189+
X, [$this->delimitFQN($table)]);
190190

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

226226
while ($row = $rows->fetch()) {
227227
$id = $row['name'];
@@ -246,8 +246,8 @@ public function convertToPhp(mixed $value, array $meta, TypeConverter $converter
246246
/**
247247
* Converts: schema.name => "schema"."name"
248248
*/
249-
private function delimiteFQN(string $name): string
249+
private function delimitFQN(string $name): string
250250
{
251-
return implode('.', array_map([$this, 'delimite'], explode('.', $name)));
251+
return implode('.', array_map([$this, 'delimit'], explode('.', $name)));
252252
}
253253
}

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
}
@@ -144,7 +144,7 @@ public function getColumns(string $table): array
144144
X, [$table, $table])->fetch();
145145

146146
$columns = [];
147-
$rows = $this->connection->query("PRAGMA table_info({$this->delimite($table)})");
147+
$rows = $this->connection->query("PRAGMA table_info({$this->delimit($table)})");
148148
while ($row = $rows->fetch()) {
149149
$column = $row['name'];
150150
$pattern = "/(\"$column\"|`$column`|\\[$column\\]|$column)\\s+[^,]+\\s+PRIMARY\\s+KEY\\s+AUTOINCREMENT/Ui";
@@ -171,7 +171,7 @@ public function getColumns(string $table): array
171171
public function getIndexes(string $table): array
172172
{
173173
$indexes = [];
174-
$rows = $this->connection->query("PRAGMA index_list({$this->delimite($table)})");
174+
$rows = $this->connection->query("PRAGMA index_list({$this->delimit($table)})");
175175
while ($row = $rows->fetch()) {
176176
$id = $row['name'];
177177
$indexes[$id]['name'] = $id;
@@ -180,7 +180,7 @@ public function getIndexes(string $table): array
180180
}
181181

182182
foreach ($indexes as $index => $values) {
183-
$res = $this->connection->query("PRAGMA index_info({$this->delimite($index)})");
183+
$res = $this->connection->query("PRAGMA index_info({$this->delimit($index)})");
184184
while ($row = $res->fetch()) {
185185
$indexes[$index]['columns'][] = $row['name'];
186186
}
@@ -218,7 +218,7 @@ public function getIndexes(string $table): array
218218
public function getForeignKeys(string $table): array
219219
{
220220
$keys = [];
221-
$rows = $this->connection->query("PRAGMA foreign_key_list({$this->delimite($table)})");
221+
$rows = $this->connection->query("PRAGMA foreign_key_list({$this->delimit($table)})");
222222
while ($row = $rows->fetch()) {
223223
$id = $row['id'];
224224
$keys[$id]['name'] = $id;

src/Database/SqlPreprocessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,6 @@ private function formatLiteral(SqlLiteral $value): string
351351
*/
352352
private function delimit(string $name): string
353353
{
354-
return implode('.', array_map($this->engine->delimite(...), explode('.', $name)));
354+
return implode('.', array_map($this->engine->delimit(...), explode('.', $name)));
355355
}
356356
}

src/Database/Table/Selection.php

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

811811
// First check sequence
812812
if (!empty($primarySequenceName) && $primaryAutoincrementKey) {
813-
$primaryKey[$primaryAutoincrementKey] = $this->explorer->getInsertId($this->explorer->getDatabaseEngine()->delimite($primarySequenceName));
813+
$primaryKey[$primaryAutoincrementKey] = $this->explorer->getInsertId($this->explorer->getDatabaseEngine()->delimit($primarySequenceName));
814814

815815
// Autoincrement primary without sequence
816816
} elseif ($primaryAutoincrementKey) {

0 commit comments

Comments
 (0)