Skip to content
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

Database Versioncheck syntax error #26526

Closed
ZitronePlus opened this issue Apr 6, 2021 · 1 comment · Fixed by #27731
Closed

Database Versioncheck syntax error #26526

ZitronePlus opened this issue Apr 6, 2021 · 1 comment · Fixed by #27731
Labels
2. developing Work in progress bug

Comments

@ZitronePlus
Copy link
Contributor

Using Nextcloud v.20.0.8 and MariaDB v.10.5.9

Issue:
Nextcloud systemcheck returns syntax error:

Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing 'SHOW VARIABLES LIKE "version";': SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"version"' at line 1

I suspect the error in line 65 NEXTCLOUD_DIR/apps/settings/lib/SetupChecks/SupportedDatabase.php

$result = $this->connection->prepare('SHOW VARIABLES LIKE "version";');

It seems that quotes and double quotes should be switched in this case.
As every other sql call also uses single quotes for sql variables.

Changing this manually to:
$result = $this->connection->prepare("SHOW VARIABLES LIKE 'version';");
has resolved the issue for me.

@J0WI J0WI transferred this issue from nextcloud/docker Apr 12, 2021
@szaimen szaimen added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label May 20, 2021
@szaimen
Copy link
Contributor

szaimen commented May 23, 2021

@ZitronePlus mind to create a PR with your fix for this?
Thanks!

@szaimen szaimen added 1. to develop Accepted and waiting to be taken care of bug needs info and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels May 23, 2021
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jun 30, 2021
fix for sql query
replaced double quotes with single quotes.
Query should now also work for dbs with sql_mode including "ANSI" and "ANSI_QUOTES"
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jun 30, 2021
@szaimen szaimen added 2. developing Work in progress and removed 1. to develop Accepted and waiting to be taken care of needs info labels Jun 30, 2021
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jul 1, 2021
Fix for nextcloud#26526

Signed-off-by: Tobias <scharft@hochschule-trier.de>
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jul 1, 2021
fix for sql query
replaced double quotes with single quotes.
Query should now also work for dbs with sql_mode including "ANSI" and "ANSI_QUOTES"

Signed-off-by: Tobias <scharft@hochschule-trier.de>
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jul 1, 2021
fix for sql query
replaced double quotes with single quotes.
Query should now also work for dbs with sql_mode including "ANSI" and "ANSI_QUOTES"

Signed-off-by: Tobias <scharft@hochschule-trier.de>
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jul 1, 2021
fix for sql query
replaced double quotes with single quotes.
Query should now also work for dbs with sql_mode including "ANSI" and "ANSI_QUOTES"

Signed-off-by: Tobias <scharft@hochschule-trier.de>
ZitronePlus added a commit to ZitronePlus/server-1 that referenced this issue Jul 1, 2021
fix for sql query
replaced double quotes with single quotes.
Query should now also work for dbs with sql_mode including "ANSI" and "ANSI_QUOTES"

Signed-off-by: Tobias <scharft@hochschule-trier.de>
@skjnldsv skjnldsv mentioned this issue Oct 25, 2021
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants