[4.0] Add prepared statements for plg_content_contact#25052
[4.0] Add prepared statements for plg_content_contact#25052wilsonge merged 29 commits intojoomla:4.0-devfrom
Conversation
…plg-content-joomla
…omla-cms into prepared-plg-content-contact
Co-Authored-By: Quy <quy@fluxbb.org>
|
Conflicts please |
…plg-content-contact # Conflicts: # plugins/content/contact/contact.php
…ntact-fix-sql PHPCS
|
All tests passed in Drone, including all mysql8 and postgresql related 😄 |
|
I have tested this item ✅ successfully on c2760ad @waader Could you test this PR again and see if you still have this issue you've mentioned in your comment #25052 (comment)? It should be fixed now. The server variable setiing is not exotic, it is more standard. Before MySQL 8, the default value was for compatibility with older MySQL versions, but with MySQL 8 they want to have default settings closed to standards, that's why issues appear more with 8. I would be happy if you could find some time for a test. Thanks in advance. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25052. |
|
The error message changed a little bit to: Tested with mysql 8.0.17 |
|
@waader @HLeithner @wilsonge Hmm, it seems then I have to change it to use a subquery. Stay tuned, it may take a while because have other stuff to do right now. |
|
@SharkyKZ Do you have an idea how to change the SQL statement handled with this PR to using a subquery in an elegant way? |
|
We don't support |
|
But I think we could fix it here at least by using a subquery for the "contact_1" part in that statement. |
|
I think |
@SharkyKZ Good idea. Could you make a code proposal here as comment or a PR against Harald's branch? That would be fastest solution. I would have to look that up, limit and so on. |
|
OK, I will. This will also correct the issue where data from different contacts is being selected. I think the idea here was to use the newest contact. |
|
Submitted HLeithner#30. |
[plg_content_contact] Remove unnecessary MAX() use
| $db->quoteName('contact.webpage'), | ||
| $db->quoteName('contact.email_to'), | ||
| ] | ||
| $query->select($db->quoteName('contact.id', 'contactid')) |
There was a problem hiding this comment.
This is actually doing the opposite of reducing function calls. Joomla\Database\DatabaseDriver::quoteName() is written in a recursive manner. If array is passed, it runs additional checks and then calls quoteName() again for each array element.
There was a problem hiding this comment.
This is actually doing the opposite of reducing function calls.
Joomla\Database\DatabaseDriver::quoteName()is written in a recursive manner. If array is passed, it runs additional checks and then callsquoteName()again for each array element.
You are right but I think the quoteName function should be optimized.
|
@waader Sorry to bother you again. Could you test this PR again? With the last change it should work now. I will test, too, but because I don't have MySQL 8 I could not reproduce the issue you had. |
|
I have tested this item ✅ successfully on acbbd4e This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25052. |
|
I have tested this item ✅ successfully on acbbd4e This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25052. |
|
Thanks to @HLeithner and @SharkyKZ , they fixed it. I've only tried and failed. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25052. |
|
Good teamwork guys and thanks for the test spotting this @waader ! |
|
thx for testing and fixing! |
Summary of Changes
Updated SQL queries to prepared statements and made some cleanups around the queries.
Testing Instructions
Use the plugin in all ways you can think of.
Expected result
Nothing changed.