User tests: Successful: Unsuccessful:
Sets the pdomysql driver to use mysql non strict mode to have the same behavior that mysql and mysqli drivers.
Use a mysql 5.6.6+ db server (or emulate the strict sql mode in pdomysql driver).
@wilsonge: when solved the install language and find updates strict problems, i think you can merge this.
To emulate strict mode before the patch (like is default in mysql 5.6.29), go to https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/driver/pdomysql.php#L149
And add this line after
$this->connection->query("SET @@SESSION.sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';");
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
I'd argue that the Framework should actually remove the strict_mode thing given its intended audience and if developers can't figure out how to tune their MySQL servers and application code to work right they've got bigger issues.
makes sense
And reggarding the failing unit test can you help solving this?
Apply this diff:
diff --git a/tests/unit/suites/database/driver/pdomysql/JDatabaseDriverPdomysqlTest.php b/tests/unit/suites/database/driver/pdomysql/JDatabaseDriverPdomysqlTest.php
index 60da486..41ed865 100644
--- a/tests/unit/suites/database/driver/pdomysql/JDatabaseDriverPdomysqlTest.php
+++ b/tests/unit/suites/database/driver/pdomysql/JDatabaseDriverPdomysqlTest.php
@@ -629,18 +629,7 @@ class JDatabaseDriverPdomysqlTest extends TestCaseDatabasePdomysql
"REPLACE INTO `jos_dbtest` SET `id` = 5, `title` = 'testTitle', `start_date` = '2014-08-17 00:00:00', `description` = 'testDescription'"
);
- $this->assertThat(
- (bool) self::$driver->execute(),
- $this->isTrue(),
- __LINE__
- );
-
- $this->assertThat(
- self::$driver->insertid(),
- $this->equalTo(5),
- __LINE__
- );
-
+ $this->assertInstanceOf('PDOStatement', self::$driver->execute());
}
/**
Ya it's changing the test completely, but that second assertion isn't part of validating that the driver's execute method runs without an error (it's actually validating the insert data). To me this change is good enough for what we're aiming to test.
Labels |
Added:
?
|
I'd argue that the Framework should actually remove the strict_mode thing given its intended audience and if developers can't figure out how to tune their MySQL servers and application code to work right they've got bigger issues.
I agree with you, but mysql and mysqli drivers in the framework use sql_mode = ''
, so those should be removed to, or, my preferred option, define a strict mode to use in all drivers in the framework for consistency across mysql drivers and mysql versions.
Labels |
Added:
?
|
The Framework doesn't have a driver for ext/mysql
. Its MysqlDriver
is the PDO driver. So it's just MySQLi that needs to remove it.
@andrepereiradasilva I wanna help with test but not have such a new mysql version available.
For such a case, I assume for the before patch test, the pdomysql driver shall be hacked like it was with George's PRs, means in the same where your patch has this new line to set sql session mode to empty, I have to add the line with the hack to the file before patch right?
to emulate strict mode before the patch (like is default in mysql 5.6.29), go to https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/driver/pdomysql.php#L149
And add this line after
$this->connection->query("SET @@SESSION.sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';");
I have tested this item successfully on d7533fc
Tested on a mysql < 5.6.6 so I had to hack the pdomysql.php to get the error before patch.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-03-20 16:42:27 |
Closed_By | ⇒ | wilsonge |
Labels |
Removed:
?
|
@mbabker should this be in joomla framework too?
BTW this is failing a unit test
Anyone can help with this?