? Success
Referenced as Related to: # 3602

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
21 Oct 2014

Issue

Currently, MSSQL creates an error for each database query where no limit is set. Like for inserts, updates and the like.
See #3602 and #4869 for the issue reports.

Solution

Add a check to the sqlsrv query class in the processLimit() method. Similar to what we already do in MySQL and PostgreSQL.

Testing

@sovainfo can you explain how to reproduce the issue? As far as I understood one sees that on first page after updating?

avatar Bakual Bakual - open - 21 Oct 2014
avatar jissues-bot jissues-bot - change - 21 Oct 2014
Labels Added: ?
avatar sovainfo
sovainfo - comment - 21 Oct 2014

According to me the issue is that the limit is applied while there is no need:

  • It is called several times by $db->setQuery($query, 0, 1); while result of the query is always no row or 1 row.
  • It is called for statements other than type SELECT
  • It is called even when both limit and offset are 0

This is independent of MSSQL, it applies to MySQL and PostgreSQL as well.

Don't mind that the function returns when both are not set. But that doesn't stop the errors on #__session deleting 1 row !

As explained in #4869 the update from J336 when set to test fails.

avatar brianteeman brianteeman - change - 21 Oct 2014
Category MS SQL
avatar Bakual
Bakual - comment - 21 Oct 2014

This is independent of MSSQL, it applies to MySQL and PostgreSQL as well.

I'm not aware of any issues like this in MySQL and PostgreSQL. And judging from code, there should be any issues since they have a similar check already in their processLimit() method.

Don't mind that the function returns when both are not set. But that doesn't stop the errors on #__session deleting 1 row !

That may be a different issue. I don't know how you have to apply limits to a DELETE on MSSQL. Maybe the processLimit method needs to be adjusted to take care of that special case.

avatar sovainfo
sovainfo - comment - 21 Oct 2014

I thought the purpose of Joomla was to be independent of RDBMS. That means you need to do the right thing for all, not just one!. Calling routines when they shouldn't is still wrong. It doesn't make it right when it doesn't give problems in certain situations.

Just because PHP and MySQL allows sloppy programming, it doesn't means you should do it!
Specially if want to support other environments as well. Better to remove MSSQL and PostgreSQL from Joomla. They are never going to work as MySQL. And that seems to be the requirement here!

avatar Bakual
Bakual - comment - 21 Oct 2014

Just to be clear: This PR just adds a behavior to MSSQL which is already present in PostgreSQL and MySQL query classes.
It makes it consistent on where it is checked and leaves the responsibility in the database specific query class. Which imho is correct.

avatar jbultena
jbultena - comment - 22 Oct 2014

finnaly this bug gonna get fixed.

avatar joomlacorner joomlacorner - test_item - 22 Oct 2014 - Tested successfully
avatar Bakual
Bakual - comment - 3 Dec 2014

Closing as fixed with #5293

avatar Bakual Bakual - close - 3 Dec 2014
avatar Bakual Bakual - close - 3 Dec 2014
avatar Bakual Bakual - change - 3 Dec 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-12-03 07:54:25
avatar Bakual Bakual - head_ref_deleted - 3 Dec 2014

Add a Comment

Login with GitHub to post a comment