asprin
Active member
One of my repositories contains the following lines of code:
Upon inspecting the queries being run behind the scenes (via
So I was wondering if, given that the query is using an
PHP:
$title = \XF::phrase('asp_fb_title');
$desc = \XF::phrase('asp_fb_desc');
$extra = \XF::phrase('asp_fb_extra');
.
.
.
.
Upon inspecting the queries being run behind the scenes (via
?_debug=1
), I realized that it was making 3 queries - one each for \XF::phrase()
line
SQL:
SELECT title, phrase_text
FROM xf_phrase_compiled
WHERE language_id = ? AND title IN ('asp_fb_title')
SELECT title, phrase_text
FROM xf_phrase_compiled
WHERE language_id = ? AND title IN ('asp_fb_desc')
SELECT title, phrase_text
FROM xf_phrase_compiled
WHERE language_id = ? AND title IN ('asp_fb_extra')
So I was wondering if, given that the query is using an
IN
operator, there is a way to pull multiple phrases from a single query so that I cut down the number of queries made to show the intended page (from 3 to 1 in this case). Something like the below:
SQL:
SELECT title, phrase_text
FROM xf_phrase_compiled
WHERE language_id = ? AND title IN ('asp_fb_title', 'asp_fb_desc', 'asp_fb_extra')