-
Notifications
You must be signed in to change notification settings - Fork 42
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
Compatibility with Nextcloud 18 and MySQL 8.0 #362
base: master
Are you sure you want to change the base?
Conversation
@@ -10,6 +10,6 @@ | |||
<dependencies> | |||
<lib>curl</lib> | |||
<owncloud min-version="7.0.3" max-version="10.0.10" /> | |||
<nextcloud min-version="9.1" max-version="17" /> | |||
<nextcloud min-version="9.1" max-version="18" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right.
@@ -136,7 +136,7 @@ public function getListing($FOLDER, $showdel) { | |||
// Get the listing from the database | |||
$requery = false; | |||
$uid = \OCP\User::getUser(); | |||
$query = "SELECT id, name, grouping, mtime, deleted FROM *PREFIX*ownnote WHERE uid=? ORDER BY name"; | |||
$query = "SELECT id, name, `grouping`, mtime, deleted FROM *PREFIX*ownnote WHERE uid=? ORDER BY name"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious about this change. I don't see this needed based on column type and MySQL 8 release/change notes so am curious about documentation as to why these backticks are required now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the link I provided in the PR description (https://dev.mysql.com/doc/refman/8.0/en/keywords.html):
GROUPING (R); added in 8.0.1 (reserved)
Grouping is a reserved keyword starting with MySQL 8.0.1, hence its unquoted usage in queries will cause an error.
Example output from a MySQL database with ownnote installed:
mysql> SELECT id, name, grouping, mtime, deleted FROM oc_ownnote ORDER BY name LIMIT 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', mtime, deleted FROM oc_ownnote ORDER BY name LIMIT 1' at line 1
mysql> SELECT id, name, `grouping`, mtime, deleted FROM oc_ownnote ORDER BY name LIMIT 1;
+----+------------+----------+------------+---------+
| id | name | grouping | mtime | deleted |
+----+------------+----------+------------+---------+
| 34 | Abrechnung | | 1587824928 | 0 |
+----+------------+----------+------------+---------+
1 row in set (0.00 sec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mh0rst I apologize. I did not see that GROUPING had become reserved. Thank you for educating me.
@Fmstrat I am currently testing this PR, and it is working. I am not running MySQL 8 on my test instance, so I cannot verify that it is working there, but it certainly is not causing any backwards compatibility issues for me and app is working fine. |
Increase Nextcloud compatibility version and fix use of reserved word "grouping" with MySQL 8 (https://dev.mysql.com/doc/refman/8.0/en/keywords.html)