refactor: remove deprecations in Database#9986
refactor: remove deprecations in Database#9986paulbalandan wants to merge 1 commit intocodeigniter4:4.8from
Database#9986Conversation
0c550da to
1ab0d9a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
1ab0d9a to
8a0dbd7
Compare
847e72d to
e9532fe
Compare
e9532fe to
7a470bb
Compare
|
After all the fixes to the tests, I realise now why they are failing. if ($this->strictOn !== null) {
if ($this->strictOn) {
$initCommands[] = "sql_mode = CONCAT(@@sql_mode, ',', 'STRICT_ALL_TABLES')";
} else {
$initCommands[] = "sql_mode = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
@@sql_mode,
'STRICT_ALL_TABLES,', ''),
',STRICT_ALL_TABLES', ''),
'STRICT_ALL_TABLES', ''),
'STRICT_TRANS_TABLES,', ''),
',STRICT_TRANS_TABLES', ''),
'STRICT_TRANS_TABLES', '')";
}
}My question now is why are the tests look stricter without this? Are our tests not strict by default? Personally, I like the stricter tests I just fixed. |
| * | ||
| * @deprecated 4.5.0 Will move to MySQLi\Connection. | ||
| */ | ||
| protected $strictOn; |
There was a problem hiding this comment.
Use search
https://github.com/search?q=repo%3Acodeigniter4%2FCodeIgniter4%20strictOn&type=code
Has the functionality been migrated to mysqli yet?
There was a problem hiding this comment.
Oh, you made it faster than me)
There was a problem hiding this comment.
I haven't added yet.
There was a problem hiding this comment.
I realized that strict mode throws an error if we try to write a string of 11 characters in the varchar(10) field. In normal mode, this will just crop the text.
you can add a test for this?
With strict mode not set (default in version <= MariaDB 10.2.3), MariaDB will automatically adjust invalid values, for example, truncating strings that are too long, or adjusting numeric values that are out of range, and produce a warning.
When Code that relied on non-strict behavior (e.g., silent truncation, implicit numeric casting) may now receive SQL errors instead of warnings. For compatibility reasons, we have to allow this mode, although I have nothing against changing it to |
|
Well, I have nothing against non-strict mode. For compatibility, yes, I would expect the framework to use non-strict mode but I'm annoyingly surprised the tests are not running strictly. IMO that's counter-intuitive to us promoting to use Anyway, I'll open a PR to backport the fixes here to |
|
👋 Hi, @paulbalandan! |
Description
Removes deprecated items in database.
Checklist: