]> git.mjollnir.org Git - moodle.git/commitdiff
Reverted to revision 1.8 (left join) to continue working in bug 985.
authorstronk7 <stronk7>
Fri, 14 May 2004 17:23:42 +0000 (17:23 +0000)
committerstronk7 <stronk7>
Fri, 14 May 2004 17:23:42 +0000 (17:23 +0000)
mod/glossary/sql.php

index 5321d769dc3cdac7acd9008ffcc30d4034d3e723..4e766355288eea84a149d1f23c81545a3bfe0210 100644 (file)
@@ -9,8 +9,6 @@
 
 /// Creating the SQL statements
 
-    $calculatedrows = array();
-
 /// Pivot is the field that set the break by groups (category, initial, author name, etc)
 
 /// fullpivot indicate if the whole pivot should be compared agasint the db or just the first letter
         break;
         
         case 'term': 
-            //Here we are going to use two selects to do the work and then mix the results
-            //due to differences about the left join implementation in some versions of MySQL
-            //When MySQL 4.1 become the minimum to Moodle, we must change this again
-            //to use the UNION operator!!
-
-            $concepts = get_records_sql("$sqlselect
-                         FROM {$CFG->prefix}glossary_entries ge
-                         WHERE (ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) AND
-                               (ge.approved != 0 $userid) AND
-                               (ge.concept = '$hook')");
-
-            if (empty($concepts)) {
-                $concepts = get_records_sql("$sqlselect
-                         FROM {$CFG->prefix}glossary_entries ge,
-                              {$CFG->prefix}glossary_alias al
-                         WHERE (ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) AND
-                               (ge.approved != 0 $userid) AND
-                               (ge.id = al.entryid) AND
-                               (al.alias = '$hook')");
-            }
-
-            if (!empty($concepts)) {
-                foreach ($concepts as $concept) {
-                    $calculatedrows[] = $concept;
-                    break;
-                }
-            }
-
             $printpivot = 0;
-
-            //Here I leave previous code left join. Someday code above will be deleted and code below
-            //wil be changed to a standard UNION statement. No it's only executed if $calculatedrows is empty
-            if (empty($calculatedrows)) {
-                $sqlfrom .= " left join {$CFG->prefix}glossary_alias ga on ge.id = ga.entryid ";
-                $where = "AND (ge.concept = '$hook' OR ga.alias = '$hook' )
-                        ";
-            }
+            $sqlfrom .= " left join {$CFG->prefix}glossary_alias ga on ge.id = ga.entryid ";
+            $where = "AND (ge.concept = '$hook' OR ga.alias = '$hook' )
+                     ";
         break;
 
         case 'entry': 
         break;
         }
     break;
-    }
-    //If there are calculatedrows, use them
-    if (!empty ($calculatedrows)) {
-        $count = count($calculatedrows);
-    } else { //Execute the query
-        $count = count_records_sql("select count(*) $sqlfrom $sqlwhere");
-    }
+    } 
+    $count = count_records_sql("select count(*) $sqlfrom $sqlwhere");
 
     $sqllimit = '';
     
         }    
     }
 
-    //If there are calculatedrows, use them
-    if (!empty ($calculatedrows)) {
-        $allentries = $calculatedrows;
-    } else { //Execute the query
-        $allentries = get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby $sqllimit");
-    }
+    $allentries = get_records_sql("$sqlselect $sqlfrom $sqlwhere $sqlorderby $sqllimit");
 ?>