CodeIgniter4: Bug: getCompiledUpdate() & getCompiledInsert() throws DatabaseException
PHP Version
7.4
CodeIgniter4 Version
4.1.5
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter
)
Which operating systems have you tested for this bug?
Windows, Linux
Which server did you use?
apache
Database
MySQL 8.0.27-0ubuntu0.20.04.1
What happened?
Calling methods getCompiledInsert() & getCompiledUpdate() while using MySql adapter does not work.
Steps to Reproduce
The below is the code that tries to retreive compiled update and compiled insert, in both cases it produces the same error: [CodeIgniter\Database\Exceptions\DatabaseException 8] You must use the “set” method to update an entry.
$model = new Model();
$compiledUpdate = $model->set("test", "1")->where("id", 1)->getCompiledUpdate();
$compiledInsert = $model->set("test", "1")->getCompiledInsert();
Expected Output
In case of getCompiledUpdate() the expected string is:
UPDATE testTable SET id= 1 WHERE id = 1;
In case of getCompiledInsert() the expected string is:
INSERT INTO testTable (test) VALUES (1);
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 21 (15 by maintainers)
Commits related to this issue
- fix: Model's getCompiledUpdate() & getCompiledInsert() throws DatabaseException Fixes #5549 — committed to kenjis/CodeIgniter4 by kenjis 2 years ago
- fix: Model's getCompiledUpdate() & getCompiledInsert() throws DatabaseException Fixes #5549 — committed to kenjis/CodeIgniter4 by kenjis 2 years ago
- docs: add about Model and Query Builder See https://github.com/codeigniter4/CodeIgniter4/issues/5549 — committed to kenjis/CodeIgniter4 by kenjis 2 years ago
So how can I report design flaw 😄