User tests: Successful: Unsuccessful:
This small change is a fix for #6232
There might be other ways, but looking at the other drivers it looks like no other driver does this, but no other calls to processLimit that I can find, but PR certainly works for PDO when using Mysql (Not tested with any other PDO backend other than mysql)
Labels |
Added:
?
|
Rel_Number | ⇒ | 6232 | |
Relation Type | ⇒ | Pull Request for |
Category | ⇒ | SQL |
Dont waste your time testing this yet - its crap code and breaks :)
Ok I have reworked on this with several test cases
The test Gist at https://gist.github.com/PhilETaylor/bdf4c5a29b6097098922 now gives 5's all the way
Joomla is now not complaining about the LIMIT 0, 5 being added twice when using the PDO driver
Just waiting to see if travis is happy. All unit tests run locally ok though
Excellent - Travis is now happy and all tests pass, even my own tests - woot woot :)
To test this you can run the Gist above, write your own custom code that limits a select query with the mysql pdo driver api, and also login to Joomla admin and make sure the first screen all loads fine (as that has several limited select queries running in the modules. Ensure your configuration.php uses the pdomysql driver in public $dbtype = 'pdomysql';
Paging (oh the pun!) @mbabker as I know you looked at the original issue reported.
Pre-patch I have 5/5/133/5
Post-patch I have 5/5/5/5
Setting to RTC thanks for testing
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
@PhilETaylor removing the $driverOptions
parameter from the function technically breaks backwards compatibility so this cannot be merged. Is that something needed for this fix?
Labels |
Removed:
?
|
Labels |
Added:
?
|
Issues re-adds the RTC automatically and apparently I cannot edit items in the tracker but please do not merge this without checking the B/C issue
Labels |
Removed:
?
|
Status | Ready to Commit | ⇒ | Pending |
Labels |
Added:
?
|
Labels |
Removed:
?
|
RTC removed
Removing the $driverOptions
parameter is not required for the original issue to be fixed, but there is an additional issue that when you instantiate JDatabaseDriverPdo
class you pass in the driverOptions
as part of the $options
array, and then in setQuery
you are basically ignoring those options you set in the construct!
So, if you want just to fix the original issue then we can reinstate the driveroptions on the setQuery call - if you want to be proper about it then the code should stand as per the PR as this is the correct way. Or third, then we should be using the driverOptions
from the options
array used in the construct.
Also note that PDO is the ONLY driver that allows the driverOptions to be set at the setQuery method - thus is probably wrong and probably not used by anyone at all as to be compatible with other drivers the options are set at the getInstance level and not at the setQuery level
Therefore I conclude that, as is, this PR breaks nothing, but enhances the PDO Driver to use driver options provided in the correct manner - at instantiation of the class.
I have now reinstated the driverOptions as it was as its not related to this bug, but will fork a new issue to tidy this up as we should be using the instances options as a default.
Ready for testing if you like - however only reinstated what was there before so no real testing needed before RTC
FYI This never made it into Joomla 3.4.1
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Thank you @PhilETaylor! Merged.
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-07-07 23:19:26 |
Closed_By | ⇒ | Kubik-Rubik |
Labels |
Removed:
?
|
Looks like this breaks the UnitTesting - I cant run the unit tests on my mac at the moment due to environment issues - I need to reinstall OSX soon :)
The PR fixes the issue, but breaks the unit tests :( Need someone to follow this up with fixed tests please :)