[3.x] Use row_number window function on MySQL and MariaDB if supported#308
Closed
richard67 wants to merge 2 commits intojoomla-framework:3.x-devfrom
Closed
[3.x] Use row_number window function on MySQL and MariaDB if supported#308richard67 wants to merge 2 commits intojoomla-framework:3.x-devfrom
richard67 wants to merge 2 commits intojoomla-framework:3.x-devfrom
Conversation
Add $rownum variable and hasRowNumberSupport method to the database driver to tell if the database engine supports the ROW_NUMBER() window function.
In the selectRowNumber method, use parent method with ROW_NUMBER() window function if the database engine supports it
This was referenced Aug 3, 2024
Contributor
Author
|
Closing in favour of PR #300 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #290 .
Alternative to PRs #291 and #300 .
See also joomla/joomla-cms#42333 .
Summary of Changes
Use the
ROW_NUMBER()window function in theselectRowNumbermethod on MySQL >= 8.0.0 and MariaDB >= 10.2.0.Different to PR #300 , this one here extends the database driver and database interface by the new method
hasRowNumberSupportto tell if the database engine supports theROW_NUMBER()window function, and theMysqlQueryBuilderuses that method. The new method might be used by 3rd party extensions of the CMS, too.The MySQL drivers set a new property
rownumwhen connecting to the database, and the newhasRowNumberSupportmethod just returns the value of that property, so the checks for MariaDB and the version are not done with every call to theselectRowNumberquery method like it is done in PR #300 , so it should be a bit faster.Also different to PR #300 , this one here uses the
ROW_NUMBER()window function whenever supported, i.e. as said with MySQL >= 8.0.0 and MariaDB >= 10.2.0. The other PR #300 does that only for MariaDB >= 11.0.0 in order to play safe and because issues where only reported for MariaDB 11, but I think that's not really necessary. Using theROW_NUMBER()is more reliable than the "hack" with the SQL variable (@rownum).I could not find any unit tests for the
selectRowNumbermethod, so no changes on unit tests with this PR.Testing Instructions
See joomla/joomla-cms#42333 .
Documentation Changes Required
None.