J4 Issue ?
avatar dneukirchen
dneukirchen
23 Feb 2018

Steps to reproduce the issue

use mysql (pdo) database driver in system config
save an article

Expected result

Saved article + Reordering of existing articles.

Actual result

Save failed with the following error: SQLSTATE[42000]: Syntax error or access violation: 1064 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 '(ORDER BY `ordering`) AS new_ordering,`id` AS `pk__0` FROM mmg7m_content WHERE c' at line 3

System information (as much as possible)

4.0dev

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
1.00

avatar dneukirchen dneukirchen - open - 23 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 23 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Feb 2018
avatar mbabker
mbabker - comment - 23 Feb 2018

In the ExceptionHandler can you add if ($error instanceof \Joomla\Database\Exception\ExecutionFailureException) { echo $error->getQuery(); } line? That'll at least print out the query that it's having issues with instead of trying to blindly chase this one.

avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Feb 2018
Category com_content
avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Feb 2018
Status New Information Required
Build staging 4.0-dev
avatar joomla-cms-bot joomla-cms-bot - edited - 23 Feb 2018
avatar dneukirchen
dneukirchen - comment - 23 Feb 2018

Can do that later. for now:

The problem is that MysqlQuery has no method selectRowNumber (which is called when we reorder in Table), so it uses DatabaseQuery::selectRowNumber()

and ROW_NUMBER() OVER causes the mysql error...

avatar mbabker
mbabker - comment - 23 Feb 2018

https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/database/query.php#L1853

:sigh: Why are we putting code in a base class that isn't database agnostic? ?‍♂️ (At least in this case it's easy to copy the same method from the MySQLi query class, but still...)

avatar alikon
alikon - comment - 23 Feb 2018

4.0 wrong sync ?
on the staging branch is from #13505
and works so ....

avatar mbabker
mbabker - comment - 23 Feb 2018

4.0 wrong sync ?

No. 4.0 uses the Framework's Database package. There are architectural differences in the two packages. So in this case the problem is the PDO MySQL query class doesn't extend the MySQLi query class so the method needs to be copied in the appropriate repo.

But that still doesn't address the architectural problem of the concrete implementation in the root query class not being generic/usable for all drivers. If this can't be done in a reusable way then it needs to be made abstract, which sounds like is the case.

avatar mbabker
mbabker - comment - 23 Feb 2018

Ultimately most of the problem boils down to every change in the CMS repo for the database package never got ported to the Framework (bug fixes or features). So we've had to do a scramble and try to merge years of PRs into the right repo and clearly some stuff didn't get ported over 100% either because it was done in a mad rush or the architectural differences weren't accounted for.

avatar alikon
alikon - comment - 23 Feb 2018

Fortunately 4.x should manage less database drivers ?

p.s.
you hit the nail

avatar mbabker
mbabker - comment - 18 Mar 2018

Should be fixed after 09347f4 (more specifically joomla-framework/database@bd0e71e from upstream)

avatar kroonsbe
kroonsbe - comment - 19 Mar 2018

When trying to save a testarticle I got below mentioned error. I do not know how to fix this in the Joomla 4.0 environment. Database is setvto MySQL(PDO)because that's the only setting I can do during installation.

Error
[code]Save failed with the following error: SQLSTATE[42000]: Syntax error or access violation: 1064 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 '(ORDER BY ordering) AS new_ordering,id AS pk__0 FROM si51x_content WHERE c' at line 3[/code]


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19767.

avatar csthomas
csthomas - comment - 19 Mar 2018

A few minutes ago I tested the latest 4.0-dev branch and it works on mysql 5.7 by PDO.

avatar kroonsbe
kroonsbe - comment - 19 Mar 2018

You have a link to the latest dev. version you used?

avatar csthomas
csthomas - comment - 19 Mar 2018
avatar kroonsbe
kroonsbe - comment - 19 Mar 2018

thanks, will try that one.

avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J4 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Apr 2018
Status Information Required Discussion
avatar brianteeman brianteeman - close - 10 Apr 2018
avatar brianteeman
brianteeman - comment - 10 Apr 2018

I am closing this at this time as there has been a lot of work on this and related issues since this was last updated. It can always be re-opened if there is still an issue

avatar brianteeman brianteeman - change - 10 Apr 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-04-10 12:32:13
Closed_By brianteeman

Add a Comment

Login with GitHub to post a comment