From 8e1ef75f557d04f25ea40c36ea99653a017b20d4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 19:11:38 +0900 Subject: [PATCH 01/12] test: refactor test code --- tests/system/Database/Live/ForgeTest.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index c9245e40bef3..d0981e221087 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -54,6 +54,7 @@ public function testCreateDatabase(): void if ($this->db->DBDriver === 'OCI8') { $this->markTestSkipped('OCI8 does not support create database.'); } + $databaseCreated = $this->forge->createDatabase('test_forge_database'); $this->assertTrue($databaseCreated); @@ -64,14 +65,16 @@ public function testCreateDatabaseIfNotExists(): void if ($this->db->DBDriver === 'OCI8') { $this->markTestSkipped('OCI8 does not support create database.'); } + $dbName = 'test_forge_database_exist'; $databaseCreateIfNotExists = $this->forge->createDatabase($dbName, true); + + $this->assertTrue($databaseCreateIfNotExists); + if ($this->db->DBDriver !== 'SQLite3') { $this->forge->dropDatabase($dbName); } - - $this->assertTrue($databaseCreateIfNotExists); } public function testCreateDatabaseIfNotExistsWithDb(): void @@ -79,15 +82,17 @@ public function testCreateDatabaseIfNotExistsWithDb(): void if ($this->db->DBDriver === 'OCI8') { $this->markTestSkipped('OCI8 does not support create database.'); } + $dbName = 'test_forge_database_exist'; $this->forge->createDatabase($dbName); $databaseExists = $this->forge->createDatabase($dbName, true); + + $this->assertTrue($databaseExists); + if ($this->db->DBDriver !== 'SQLite3') { $this->forge->dropDatabase($dbName); } - - $this->assertTrue($databaseExists); } public function testDropDatabase(): void From 39ada818c75fa2f3785cba5cd30b51d2dc202c00 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 19:14:55 +0900 Subject: [PATCH 02/12] test: add tests for escapeIdentifiers() --- tests/system/Database/BaseConnectionTest.php | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 365d29f84d71..246e7ffa7a48 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -283,4 +283,27 @@ public static function provideProtectIdentifiers(): iterable ], ]; } + + /** + * These tests are intended to confirm the current behavior. + * + * @dataProvider provideEscapeIdentifiers + */ + public function testEscapeIdentifiers(string $item, string $expected): void + { + $db = new MockConnection($this->options); + + $return = $db->escapeIdentifiers($item); + + $this->assertSame($expected, $return); + } + + public static function provideEscapeIdentifiers(): iterable + { + yield from [ + // $item, $expected + 'simple' => ['test', '"test"'], + 'with dots' => ['com.sitedb.web', '"com"."sitedb"."web"'], + ]; + } } From 371299e3fac8ad1a368c1d9be0cd155d6b3d428f Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 19:16:01 +0900 Subject: [PATCH 03/12] feat: add escapeIdentifier() method --- system/Database/BaseConnection.php | 18 +++++++++++++++++ tests/system/Database/BaseConnectionTest.php | 21 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 6be66bbbb39d..f109f7322176 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1188,6 +1188,24 @@ private function protectDotItem(string $item, string $alias, bool $protectIdenti return $item . $alias; } + /** + * Escape the SQL Identifier + * + * This function escapes single identifier. + * + * @param non-empty-string $item + */ + public function escapeIdentifier(string $item): string + { + return $this->escapeChar + . str_replace( + $this->escapeChar, + $this->escapeChar . $this->escapeChar, + $item + ) + . $this->escapeChar; + } + /** * Escape the SQL Identifiers * diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 246e7ffa7a48..60753e8b4ae3 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -306,4 +306,25 @@ public static function provideEscapeIdentifiers(): iterable 'with dots' => ['com.sitedb.web', '"com"."sitedb"."web"'], ]; } + + /** + * @dataProvider provideEscapeIdentifier + */ + public function testEscapeIdentifier(string $item, string $expected): void + { + $db = new MockConnection($this->options); + + $return = $db->escapeIdentifier($item); + + $this->assertSame($expected, $return); + } + + public static function provideEscapeIdentifier(): iterable + { + yield from [ + // $item, $expected + 'simple' => ['test', '"test"'], + 'with dots' => ['com.sitedb.web', '"com.sitedb.web"'], + ]; + } } From 712ab9cfdcbc04ea0c0a73b2fba83afdd3009bc8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 19:27:18 +0900 Subject: [PATCH 04/12] feat: createDatabase() and dropDatabase() supports database name with dots --- system/Database/Forge.php | 24 +++++++++++++--- tests/system/Database/Live/ForgeTest.php | 35 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/system/Database/Forge.php b/system/Database/Forge.php index e17bb8322dba..d6178c79306c 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -229,7 +229,14 @@ public function createDatabase(string $dbName, bool $ifNotExists = false): bool } try { - if (! $this->db->query(sprintf($ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, $dbName, $this->db->charset, $this->db->DBCollat))) { + if (! $this->db->query( + sprintf( + $ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, + $this->db->escapeIdentifier($dbName), + $this->db->charset, + $this->db->DBCollat + ) + )) { // @codeCoverageIgnoreStart if ($this->db->DBDebug) { throw new DatabaseException('Unable to create the specified database.'); @@ -268,7 +275,10 @@ private function databaseExists(string $dbName): bool return false; } - return $this->db->query($this->checkDatabaseExistStr, $dbName)->getRow() !== null; + return $this->db->query( + $this->checkDatabaseExistStr, + $this->db->escapeIdentifier($dbName) + )->getRow() !== null; } /** @@ -286,7 +296,9 @@ public function dropDatabase(string $dbName): bool return false; } - if (! $this->db->query(sprintf($this->dropDatabaseStr, $dbName))) { + if (! $this->db->query( + sprintf($this->dropDatabaseStr, $this->db->escapeIdentifier($dbName)) + )) { if ($this->db->DBDebug) { throw new DatabaseException('Unable to drop the specified database.'); } @@ -295,7 +307,11 @@ public function dropDatabase(string $dbName): bool } if (! empty($this->db->dataCache['db_names'])) { - $key = array_search(strtolower($dbName), array_map('strtolower', $this->db->dataCache['db_names']), true); + $key = array_search( + strtolower($dbName), + array_map('strtolower', $this->db->dataCache['db_names']), + true + ); if ($key !== false) { unset($this->db->dataCache['db_names'][$key]); } diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index d0981e221087..2e53ad1fef73 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -60,6 +60,23 @@ public function testCreateDatabase(): void $this->assertTrue($databaseCreated); } + public function testCreateDatabaseWithDots(): void + { + if ($this->db->DBDriver === 'OCI8') { + $this->markTestSkipped('OCI8 does not support create database.'); + } + + $dbName = 'test_com.sitedb.web'; + + $databaseCreated = $this->forge->createDatabase($dbName); + + $this->assertTrue($databaseCreated); + + if ($this->db->DBDriver !== 'SQLite3') { + $this->forge->dropDatabase($dbName); + } + } + public function testCreateDatabaseIfNotExists(): void { if ($this->db->DBDriver === 'OCI8') { @@ -95,6 +112,24 @@ public function testCreateDatabaseIfNotExistsWithDb(): void } } + public function testCreateDatabaseIfNotExistsWithDbWithDots(): void + { + if ($this->db->DBDriver === 'OCI8') { + $this->markTestSkipped('OCI8 does not support create database.'); + } + + $dbName = 'test_forge.database.exist'; + + $this->forge->createDatabase($dbName); + $databaseExists = $this->forge->createDatabase($dbName, true); + + $this->assertTrue($databaseExists); + + if ($this->db->DBDriver !== 'SQLite3') { + $this->forge->dropDatabase($dbName); + } + } + public function testDropDatabase(): void { if ($this->db->DBDriver === 'OCI8') { From 11e23a4f96df98a3cdb2ac84af42896b1c7f36c0 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 19:43:40 +0900 Subject: [PATCH 05/12] feat: tableExists() supports database name with dots --- system/Database/MySQLi/Connection.php | 2 +- tests/system/Database/Live/ForgeTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 11e6829dd093..77bada5f32cf 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -389,7 +389,7 @@ public function escapeLikeStringDirect($str) */ protected function _listTables(bool $prefixLimit = false, ?string $tableName = null): string { - $sql = 'SHOW TABLES FROM ' . $this->escapeIdentifiers($this->database); + $sql = 'SHOW TABLES FROM ' . $this->escapeIdentifier($this->database); if ($tableName !== null) { return $sql . ' LIKE ' . $this->escape($tableName); diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index 2e53ad1fef73..e7c1e63a5879 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -72,6 +72,15 @@ public function testCreateDatabaseWithDots(): void $this->assertTrue($databaseCreated); + // Checks if tableExists() works. + $config = config(Database::class)->{$this->DBGroup}; + $config['database'] = $dbName; + $db = db_connect($config); + $result = $db->tableExists('not_exist'); + + $this->assertFalse($result); + + $db->close(); if ($this->db->DBDriver !== 'SQLite3') { $this->forge->dropDatabase($dbName); } From 7c2b4e25d7f299af1a7190a8d7e30690e5f27ff7 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 21:08:49 +0900 Subject: [PATCH 06/12] docs: add PHPDoc types --- system/Test/Mock/MockConnection.php | 3 +++ tests/system/Database/BaseConnectionTest.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index 7017937c204a..f28724ac508a 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -23,6 +23,9 @@ */ class MockConnection extends BaseConnection { + /** + * @var array{connect?: mixed, execute?: bool|object} + */ protected $returnValues = []; /** diff --git a/tests/system/Database/BaseConnectionTest.php b/tests/system/Database/BaseConnectionTest.php index 60753e8b4ae3..6c7624ce795a 100644 --- a/tests/system/Database/BaseConnectionTest.php +++ b/tests/system/Database/BaseConnectionTest.php @@ -298,6 +298,9 @@ public function testEscapeIdentifiers(string $item, string $expected): void $this->assertSame($expected, $return); } + /** + * @return array> + */ public static function provideEscapeIdentifiers(): iterable { yield from [ @@ -319,6 +322,9 @@ public function testEscapeIdentifier(string $item, string $expected): void $this->assertSame($expected, $return); } + /** + * @return array> + */ public static function provideEscapeIdentifier(): iterable { yield from [ From fe26efeb0e663fa7de611bb22bac51a743c367ab Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 21:19:25 +0900 Subject: [PATCH 07/12] fix: add missing $sql --- system/Test/Mock/MockConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Test/Mock/MockConnection.php b/system/Test/Mock/MockConnection.php index f28724ac508a..83826c347c98 100644 --- a/system/Test/Mock/MockConnection.php +++ b/system/Test/Mock/MockConnection.php @@ -87,7 +87,7 @@ public function query(string $sql, $binds = null, bool $setEscapeFlags = true, s $query->setDuration($startTime); // resultID is not false, so it must be successful - if ($query->isWriteType()) { + if ($query->isWriteType($sql)) { return true; } From 591b97115146660abfa5e115667e65129b4b108d Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 26 Mar 2024 21:19:42 +0900 Subject: [PATCH 08/12] chore: update phpstan-baseline --- phpstan-baseline.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 6e457d1f8591..0bb95ad0aefc 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -8981,11 +8981,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:\\$returnValues has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockConnection.php', -]; $ignoreErrors[] = [ 'message' => '#^Return type \\(array\\{code\\: int\\|string\\|null, message\\: string\\|null\\}\\) of method CodeIgniter\\\\Test\\\\Mock\\\\MockConnection\\:\\:error\\(\\) should be covariant with return type \\(array\\\\) of method CodeIgniter\\\\Database\\\\ConnectionInterface\\\\:\\:error\\(\\)$#', 'count' => 1, @@ -12676,11 +12671,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/system/Database/BaseConnectionTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Property class@anonymous/tests/system/Database/BaseConnectionTest\\.php\\:121\\:\\:\\$returnValues has no type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/Database/BaseConnectionTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Database\\\\BaseQueryTest\\:\\:provideHighlightQueryKeywords\\(\\) return type has no value type specified in iterable type iterable\\.$#', 'count' => 1, From c8a92fbc38e631c72aaa0e721f2bb3c69a7a57cf Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 27 Mar 2024 10:12:23 +0900 Subject: [PATCH 09/12] fix: remove unneeded escape --- system/Database/Forge.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/Database/Forge.php b/system/Database/Forge.php index d6178c79306c..93f1bd550d4c 100644 --- a/system/Database/Forge.php +++ b/system/Database/Forge.php @@ -275,10 +275,7 @@ private function databaseExists(string $dbName): bool return false; } - return $this->db->query( - $this->checkDatabaseExistStr, - $this->db->escapeIdentifier($dbName) - )->getRow() !== null; + return $this->db->query($this->checkDatabaseExistStr, $dbName)->getRow() !== null; } /** From 41a48ecb70d6eed238cdd37b8b4c8052fe62ebfe Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 27 Mar 2024 11:34:22 +0900 Subject: [PATCH 10/12] fix: add SQLSRV\Forge::createDatabase() --- system/Database/SQLSRV/Forge.php | 51 +++++++++++++++++++++++- tests/system/Database/Live/ForgeTest.php | 15 +++---- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/system/Database/SQLSRV/Forge.php b/system/Database/SQLSRV/Forge.php index dc5567433215..cae4eda2a4f5 100755 --- a/system/Database/SQLSRV/Forge.php +++ b/system/Database/SQLSRV/Forge.php @@ -14,7 +14,9 @@ namespace CodeIgniter\Database\SQLSRV; use CodeIgniter\Database\BaseConnection; +use CodeIgniter\Database\Exceptions\DatabaseException; use CodeIgniter\Database\Forge as BaseForge; +use Throwable; /** * Forge for SQLSRV @@ -42,7 +44,7 @@ class Forge extends BaseForge * * @var string */ - protected $createDatabaseIfStr = "DECLARE @DBName VARCHAR(255) = '%s'\nDECLARE @SQL VARCHAR(max) = 'IF DB_ID( ''' + @DBName + ''' ) IS NULL CREATE DATABASE ' + @DBName\nEXEC( @SQL )"; + protected $createDatabaseIfStr = "DECLARE @DBName VARCHAR(255) = '%s'\nDECLARE @SQL VARCHAR(max) = 'IF DB_ID( ''' + @DBName + ''' ) IS NULL CREATE DATABASE %s'\nEXEC( @SQL )"; /** * CREATE DATABASE IF statement @@ -119,6 +121,53 @@ public function __construct(BaseConnection $db) $this->dropIndexStr = 'DROP INDEX %s ON ' . $this->db->escapeIdentifiers($this->db->schema) . '.%s'; } + /** + * Create database + * + * @param bool $ifNotExists Whether to add IF NOT EXISTS condition + * + * @throws DatabaseException + */ + public function createDatabase(string $dbName, bool $ifNotExists = false): bool + { + if ($ifNotExists) { + $sql = sprintf( + $this->createDatabaseIfStr, + $dbName, + $this->db->escapeIdentifier($dbName) + ); + } else { + $sql = sprintf( + $this->createDatabaseStr, + $this->db->escapeIdentifier($dbName) + ); + } + + try { + if (! $this->db->query($sql)) { + // @codeCoverageIgnoreStart + if ($this->db->DBDebug) { + throw new DatabaseException('Unable to create the specified database.'); + } + + return false; + // @codeCoverageIgnoreEnd + } + + if (isset($this->db->dataCache['db_names'])) { + $this->db->dataCache['db_names'][] = $dbName; + } + + return true; + } catch (Throwable $e) { + if ($this->db->DBDebug) { + throw new DatabaseException('Unable to create the specified database.', 0, $e); + } + + return false; // @codeCoverageIgnore + } + } + /** * CREATE TABLE attributes */ diff --git a/tests/system/Database/Live/ForgeTest.php b/tests/system/Database/Live/ForgeTest.php index e7c1e63a5879..cdab38096b1b 100644 --- a/tests/system/Database/Live/ForgeTest.php +++ b/tests/system/Database/Live/ForgeTest.php @@ -155,17 +155,14 @@ public function testDropDatabase(): void public function testCreateDatabaseExceptionNoCreateStatement(): void { - $this->setPrivateProperty($this->forge, 'createDatabaseStr', false); + if ($this->db->DBDriver !== 'OCI8') { + $this->markTestSkipped($this->db->DBDriver . ' does support drop database.'); + } - if ($this->db->DBDriver === 'SQLite3') { - $databaseCreated = $this->forge->createDatabase('test_forge_database'); - $this->assertTrue($databaseCreated); - } else { - $this->expectException(DatabaseException::class); - $this->expectExceptionMessage('This feature is not available for the database you are using.'); + $this->expectException(DatabaseException::class); + $this->expectExceptionMessage('This feature is not available for the database you are using.'); - $this->forge->createDatabase('test_forge_database'); - } + $this->forge->createDatabase('test_forge_database'); } public function testDropDatabaseExceptionNoDropStatement(): void From 927a829c80eaecfcd48d739a3c30732140ac62a4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 27 Mar 2024 11:58:56 +0900 Subject: [PATCH 11/12] docs: add user guide --- user_guide_src/source/changelogs/v4.5.0.rst | 2 ++ user_guide_src/source/database/configuration.rst | 2 +- user_guide_src/source/database/examples.rst | 2 +- user_guide_src/source/database/queries.rst | 2 +- user_guide_src/source/database/query_builder.rst | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index 7108fc6b2e65..5811db991cc2 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -72,6 +72,8 @@ Forge Others ------ +- Added support for database names containing dots (``.``). + Model ===== diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index bd2b3c8ac59c..f06ed8c09f9b 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -149,7 +149,7 @@ Explanation of Values **password** The password used to connect to the database. (``SQLite3`` does not use this.) **database** The name of the database you want to connect to. - .. note:: CodeIgniter doesn't support dots (``.``) in the database, table, and column names. + .. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. **DBDriver** The database driver name. The case must match the driver name. You can set a fully qualified classname to use your custom driver. Supported drivers: ``MySQLi``, ``Postgre``, ``SQLite3``, ``SQLSRV``, and ``OCI8``. diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst index 2666c2e4dc09..62d11990953a 100644 --- a/user_guide_src/source/database/examples.rst +++ b/user_guide_src/source/database/examples.rst @@ -6,7 +6,7 @@ The following page contains example code showing how the database class is used. For complete details please read the individual pages describing each function. -.. note:: CodeIgniter doesn't support dots (``.``) in the database, table, and column names. +.. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. .. contents:: :local: diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index b3904418b8a6..d39d2703d59f 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -10,7 +10,7 @@ Queries Query Basics ************ -.. note:: CodeIgniter doesn't support dots (``.``) in the database, table, and column names. +.. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. Regular Queries =============== diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 7caa04d3eeb0..1020ace713b9 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -15,7 +15,7 @@ the query syntax is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system. -.. note:: CodeIgniter doesn't support dots (``.``) in the database, table, and column names. +.. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. .. contents:: :local: From 6a552e038bb915f290803569ee84ca5b76df69f1 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Mar 2024 11:15:34 +0900 Subject: [PATCH 12/12] docs: add since v4.5.0 db names with dots are supported --- user_guide_src/source/database/configuration.rst | 1 + user_guide_src/source/database/examples.rst | 1 + user_guide_src/source/database/queries.rst | 1 + user_guide_src/source/database/query_builder.rst | 1 + 4 files changed, 4 insertions(+) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index f06ed8c09f9b..26b7515bab12 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -150,6 +150,7 @@ Explanation of Values **database** The name of the database you want to connect to. .. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. + Since v4.5.0, database names with dots are supported. **DBDriver** The database driver name. The case must match the driver name. You can set a fully qualified classname to use your custom driver. Supported drivers: ``MySQLi``, ``Postgre``, ``SQLite3``, ``SQLSRV``, and ``OCI8``. diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst index 62d11990953a..a88608e85651 100644 --- a/user_guide_src/source/database/examples.rst +++ b/user_guide_src/source/database/examples.rst @@ -7,6 +7,7 @@ is used. For complete details please read the individual pages describing each function. .. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. + Since v4.5.0, database names with dots are supported. .. contents:: :local: diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst index d39d2703d59f..af66a62360aa 100644 --- a/user_guide_src/source/database/queries.rst +++ b/user_guide_src/source/database/queries.rst @@ -11,6 +11,7 @@ Query Basics ************ .. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. + Since v4.5.0, database names with dots are supported. Regular Queries =============== diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 1020ace713b9..5dac7926f7a8 100755 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -16,6 +16,7 @@ for safer queries, since the values are escaped automatically by the system. .. note:: CodeIgniter doesn't support dots (``.``) in the table and column names. + Since v4.5.0, database names with dots are supported. .. contents:: :local: