Index: trunk/extensions/Wikidata/WiktionaryZ/SpecialDatasearch.php |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | "FROM uw_expression_ns, uw_syntrans ". |
36 | 36 | "WHERE uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_syntrans.identical_meaning=1 " . |
37 | 37 | " AND " . getLatestTransactionRestriction('uw_syntrans'). |
| 38 | + " AND " . getLatestTransactionRestriction('uw_expression_ns'). |
38 | 39 | " AND spelling LIKE " . $dbr->addQuotes("%$text%") . |
39 | 40 | " ORDER BY position ASC, uw_expression_ns.spelling ASC limit 100"; |
40 | 41 | |
Index: trunk/extensions/Wikidata/WiktionaryZ/Search.php |
— | — | @@ -27,7 +27,8 @@ |
28 | 28 | $sql = "SELECT INSTR(LCASE(uw_expression_ns.spelling), LCASE(". $dbr->addQuotes("$text") .")) as position, uw_syntrans.defined_meaning_id AS defined_meaning_id, uw_expression_ns.spelling AS spelling, uw_expression_ns.language_id AS language_id ". |
29 | 29 | "FROM uw_expression_ns, uw_syntrans ". |
30 | 30 | "WHERE uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_syntrans.identical_meaning=1 " . |
31 | | - " AND " . getLatestTransactionRestriction('uw_syntrans'). |
| 31 | + " AND " . getLatestTransactionRestriction('uw_syntrans') . |
| 32 | + " AND " . getLatestTransactionRestriction('uw_expression_ns') . |
32 | 33 | " AND spelling LIKE " . $dbr->addQuotes("%$text%") . |
33 | 34 | " ORDER BY position ASC, uw_expression_ns.spelling ASC limit 100"; |
34 | 35 | |
Index: trunk/extensions/Wikidata/WiktionaryZ/type.php |
— | — | @@ -72,8 +72,17 @@ |
73 | 73 | |
74 | 74 | function definedMeaningExpressionForLanguage($definedMeaningId, $languageId) { |
75 | 75 | $dbr =& wfGetDB(DB_SLAVE); |
76 | | - $queryResult = $dbr->query("SELECT spelling FROM uw_syntrans, uw_expression_ns " . |
77 | | - "WHERE defined_meaning_id=$definedMeaningId AND uw_expression_ns.expression_id=uw_syntrans.expression_id AND uw_expression_ns.language_id=$languageId AND uw_syntrans.identical_meaning=1 LIMIT 1"); |
| 76 | + $queryResult = $dbr->query( |
| 77 | + "SELECT spelling" . |
| 78 | + " FROM uw_syntrans, uw_expression_ns " . |
| 79 | + " WHERE defined_meaning_id=$definedMeaningId" . |
| 80 | + " AND uw_expression_ns.expression_id=uw_syntrans.expression_id" . |
| 81 | + " AND uw_expression_ns.language_id=$languageId" . |
| 82 | + " AND uw_syntrans.identical_meaning=1" . |
| 83 | + " AND " . getLatestTransactionRestriction('uw_syntrans') . |
| 84 | + " AND " . getLatestTransactionRestriction('uw_expression_ns') . |
| 85 | + " LIMIT 1" |
| 86 | + ); |
78 | 87 | |
79 | 88 | if ($expression = $dbr->fetchObject($queryResult)) |
80 | 89 | return $expression->spelling; |
— | — | @@ -83,7 +92,15 @@ |
84 | 93 | |
85 | 94 | function definedMeaningExpressionForAnyLanguage($definedMeaningId) { |
86 | 95 | $dbr =& wfGetDB(DB_SLAVE); |
87 | | - $queryResult = $dbr->query("SELECT spelling from uw_syntrans, uw_expression_ns where defined_meaning_id=$definedMeaningId and uw_expression_ns.expression_id=uw_syntrans.expression_id and uw_syntrans.identical_meaning=1 limit 1"); |
| 96 | + $queryResult = $dbr->query( |
| 97 | + "SELECT spelling " . |
| 98 | + " FROM uw_syntrans, uw_expression_ns" . |
| 99 | + " WHERE defined_meaning_id=$definedMeaningId" . |
| 100 | + " AND uw_expression_ns.expression_id=uw_syntrans.expression_id" . |
| 101 | + " AND uw_syntrans.identical_meaning=1" . |
| 102 | + " AND " . getLatestTransactionRestriction('uw_syntrans') . |
| 103 | + " AND " . getLatestTransactionRestriction('uw_expression_ns') . |
| 104 | + " LIMIT 1"); |
88 | 105 | |
89 | 106 | if ($expression = $dbr->fetchObject($queryResult)) |
90 | 107 | return $expression->spelling; |
Index: trunk/extensions/Wikidata/WiktionaryZ/SpecialSuggest.php |
— | — | @@ -59,7 +59,8 @@ |
60 | 60 | $sql = "SELECT syntrans.defined_meaning_id AS defined_meaning_id, expression.spelling AS spelling, expression.language_id AS language_id ".
|
61 | 61 | "FROM uw_expression_ns expression, uw_syntrans syntrans ".
|
62 | 62 | "WHERE expression.expression_id=syntrans.expression_id AND syntrans.identical_meaning=1 " .
|
63 | | - " AND " . getLatestTransactionRestriction('syntrans');
|
| 63 | + " AND " . getLatestTransactionRestriction('syntrans').
|
| 64 | + " AND " . getLatestTransactionRestriction('expression');
|
64 | 65 | break;
|
65 | 66 | case 'collection':
|
66 | 67 | $sql = "SELECT collection_id, spelling ".
|
— | — | @@ -67,6 +68,7 @@ |
68 | 69 | "WHERE expression.expression_id=syntrans.expression_id AND syntrans.defined_meaning_id=collection.collection_mid ".
|
69 | 70 | "AND syntrans.identical_meaning=1" .
|
70 | 71 | " AND " . getLatestTransactionRestriction('syntrans') .
|
| 72 | + " AND " . getLatestTransactionRestriction('expression') .
|
71 | 73 | " AND " . getLatestTransactionRestriction('collection');
|
72 | 74 | break;
|
73 | 75 | case 'transaction':
|
— | — | @@ -134,6 +136,7 @@ |
135 | 137 | "AND syntrans.defined_meaning_id=uw_collection_contents.member_mid " .
|
136 | 138 | "AND expression.expression_id=syntrans.expression_id AND syntrans.identical_meaning=1 ".
|
137 | 139 | "AND " . getLatestTransactionRestriction('syntrans') .
|
| 140 | + "AND " . getLatestTransactionRestriction('expression') .
|
138 | 141 | "AND " . getLatestTransactionRestriction('uw_collection_contents');
|
139 | 142 | }
|
140 | 143 |
|