r94042 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94041‎ | r94042 | r94043 >
Date:12:36, 7 August 2011
Author:kipcool
Status:deferred
Tags:
Comment:
LEFT JOIN is not so bad after all
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/languages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/languages.php
@@ -100,10 +100,10 @@
101101 /* Fall back on English in cases where a language name is not present in the
102102 user's preferred language. */
103103 else
104 - return 'SELECT language_id AS row_id, language_name' .
105 - ' FROM language_names' .
106 - ' WHERE name_language_id = ' . $lang_id .
107 - ' OR ( name_language_id = 85 ' .
108 - ' AND language_id NOT IN ( SELECT language_id FROM language_names WHERE name_language_id = ' . $lang_id .
109 - ' ) ) ' ;
 104+ return 'SELECT language.language_id AS row_id, COALESCE(ln1.language_name,ln2.language_name) AS language_name' .
 105+ ' FROM language' .
 106+ ' LEFT JOIN language_names AS ln1 ON language.language_id = ln1.language_id' .
 107+ ' AND ln1.name_language_id = ' . $lang_id .
 108+ ' JOIN language_names AS ln2 ON language.language_id = ln2.language_id AND ln2.name_language_id = 85 ' ;
 109+
110110 }

Status & tagging log