Skip to content

Commit

Permalink
Fix: broken prepare statement in MySqlAdapter for MySql > 5.7
Browse files Browse the repository at this point in the history
MySql introduced a sql mode called only_full_group_by which broke
the prepare statement method. This is a workaround to be backwards
compatible.
  • Loading branch information
Steffen committed Apr 6, 2018
1 parent f40f8df commit 498c652
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Adapter/MySQLAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ public function prepareStatement($query, $options, $limit, $offset)
$objectsTable,
$objectsTable
);

// fix for the mysqli >= 5.7 only_full_group_by bug
if($this->connection->server_version >= 50700) {
$this->connection->query("SET SESSION sql_mode=''");
}
$query = sprintf(
'SELECT %s
FROM %s as rootContents
Expand Down

0 comments on commit 498c652

Please sign in to comment.