-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tableExists() cannot handle Database Name with dot #8647
Comments
CodeIgniter doesn’t support dots (.) in the database, table, and column names |
Yes, I have already noticed this. Since it is a hosting provider, I cannot provide a change as a database, so if a permanent solution is possible, not only me but also the errors that may occur in the future will be eliminated. I have already produced my own solution, I just wanted to report it. |
@mbnl Whats a solution you have? Feel free to send PR |
This is clearly documented. So this is not a bug.
Probably we cannot fix this. |
@mbnl If you have a good idea, feel free to send PRs. |
This is not a bug, but I am reopening it for reconsideration. |
@codeigniter4/database-team @codeigniter4/core-team CodeIgniter4/system/Database/MySQLi/Connection.php Lines 390 to 400 in 7109931
Is there possibility that If |
Yes, only the database name. There is no prefix or hostname. It is a mysql 8.0 database created through the hosting panel. |
The CodeIgniter4/app/Config/Database.php Line 34 in d8e4de2
and it is just a database name only. We also have hostname and schema in the config array.
So we can support database name with dots. |
Closed by #8664 |
PHP Version
8.1
CodeIgniter4 Version
4.4.5
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
MySQL 8.0
What happened?
Hello, I'm having a problem
My database name;
The operation I intend to perform is
tableExists('tableName')
.When I run this code, I receive a Database Exception error. Upon detailed examination of the error, I found that CodeIgniter 4 (CI4) was sending the following MySQL command:
Steps to Reproduce
That should have been the right command;
Due to the dots
.
in my database name, CI4 was treating it as `.`, thus causing the issue. However, since I'm using a hosting service, I cannot change the database name. Upon inspecting the source code, I found that insystem/Database/MySQLi/Connection.php
, line 391, the code was modified as follows:I identified that the problem stems from the
escapeIdentifiers
method. Instead of modifying this method, I updated the line as follows:so that the mysql command was correctly as follows
This solution temporarily resolved my issue. However, when I update to a new version of CI4, the old code will return, potentially causing the same error in the future. I would appreciate it if you could address this issue and provide a permanent solution.
Thank you.
Expected Output
Anything else?
No response
The text was updated successfully, but these errors were encountered: