Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- Dealing with incompatibilities related to posgresql.

  • Loading branch information...
commit c9128b637b7902721db55d5510eeddf9ef105767 1 parent a5e48d9
authored February 21, 2004
12  mod/glossary/dynalink.php
@@ -11,6 +11,14 @@ function glossary_dynamic_link($courseid, $text) {
@@ -33,8 +41,8 @@ function glossary_dynamic_link($courseid, $text) {
21  mod/glossary/sql.php
@@ -13,6 +13,15 @@
13 13
 
14 14
 /// fullpivot indicate if the whole pivot should be compared agasint the db or just the first letter
15 15
 /// printpivot indicate if the pivot should be printed or not
  16
+    switch ($CFG->dbtype) {
  17
+    case 'postgres7':
  18
+ 		$as = 'as';
  19
+    break;
  20
+    case 'mysql':
  21
+ 		$as = '';
  22
+    break;
  23
+    }    
  24
+
16 25
     switch ( $sortkey ) {    
17 26
     case "CREATION": 
18 27
         $sqlsortkey = "timecreated";
@@ -34,7 +43,7 @@
34 43
     case GLOSSARY_CATEGORY_VIEW:
35 44
         if ($hook == GLOSSARY_SHOW_ALL_CATEGORIES  ) { 
36 45
 
37  
-            $sqlselect = "SELECT gec.id, gc.name pivot, ge.*";
  46
+            $sqlselect = "SELECT gec.id, gc.name $as pivot, ge.*";
38 47
             $sqlfrom   = "FROM {$CFG->prefix}glossary_entries ge,
39 48
                          {$CFG->prefix}glossary_entries_categories gec,
40 49
                          {$CFG->prefix}glossary_categories gc";
@@ -51,7 +60,7 @@
51 60
         } elseif ($hook == GLOSSARY_SHOW_NOT_CATEGORISED ) { 
52 61
 
53 62
             $printpivot = 0;
54  
-            $sqlselect = "SELECT concept pivot, ge.*";
  63
+            $sqlselect = "SELECT concept $as pivot, ge.*";
55 64
             $sqlfrom   = "FROM {$CFG->prefix}glossary_entries ge";
56 65
             $sqlwhere  = "WHERE (glossaryid = '$glossary->id' OR sourceglossaryid = '$glossary->id') AND
57 66
                           (ge.approved != 0 $userid)";
@@ -62,7 +71,7 @@
62 71
         } else {
63 72
 
64 73
             $printpivot = 0;
65  
-            $sqlselect  = "SELECT ce.id, c.name pivot, ge.*";
  74
+            $sqlselect  = "SELECT ce.id, c.name $as pivot, ge.*";
66 75
             $sqlfrom    = "FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories ce, {$CFG->prefix}glossary_categories c";
67 76
             $sqlwhere   = "WHERE ge.id = ce.entryid AND ce.categoryid = $hook AND
68 77
                                  ce.categoryid = c.id AND ge.approved != 0 AND
@@ -99,7 +108,7 @@
99 108
             $where = '';
100 109
         }
101 110
 
102  
-        $sqlselect  = "SELECT ge.id, $usernamefield pivot, u.id uid, ge.*";
  111
+        $sqlselect  = "SELECT ge.id, $usernamefield $as pivot, u.id uid, ge.*";
103 112
         $sqlfrom    = "FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}user u";
104 113
         $sqlwhere   = "WHERE ge.userid = u.id  AND
105 114
                              (ge.approved != 0 $userid)
@@ -123,7 +132,7 @@
123 132
             }
124 133
         }
125 134
 
126  
-        $sqlselect  = "SELECT ge.concept pivot, ge.*";
  135
+        $sqlselect  = "SELECT ge.concept $as pivot, ge.*";
127 136
         $sqlfrom    = "FROM {$CFG->prefix}glossary_entries ge";
128 137
         $sqlwhere   = "WHERE (ge.glossaryid = $glossary->id OR ge.sourceglossaryid = $glossary->id) AND
129 138
                              ge.approved = 0 $where";
@@ -137,7 +146,7 @@
137 146
     case GLOSSARY_DATE_VIEW:
138 147
     case GLOSSARY_STANDARD_VIEW:
139 148
     default:
140  
-        $sqlselect  = "SELECT ge.concept pivot, ge.*";
  149
+        $sqlselect  = "SELECT ge.concept $as pivot, ge.*";
141 150
         $sqlfrom    = "FROM {$CFG->prefix}glossary_entries ge";
142 151
 
143 152
         $where = '';

0 notes on commit c9128b6

Please sign in to comment.
Something went wrong with that request. Please try again.