Fix opclass queries for 7.0-7.2
authorchriskl <chriskl>
Wed, 10 Aug 2005 05:50:52 +0000 (05:50 +0000)
committerchriskl <chriskl>
Wed, 10 Aug 2005 05:50:52 +0000 (05:50 +0000)
classes/database/Postgres.php
classes/database/Postgres72.php

index a2a63f3f5293aa5d652fe197e8600b7919517276..0484b525c1060a8f4ad2d871f40fa3ecea027984 100755 (executable)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres.php,v 1.269 2005/08/03 06:34:01 chriskl Exp $
+ * $Id: Postgres.php,v 1.270 2005/08/10 05:50:52 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -3681,7 +3681,7 @@ class Postgres extends ADODB_base {
                        SELECT DISTINCT
                                pa.amname, 
                                po.opcname, 
-                               (SELECT typname FROM pg_type t WHERE t.oid=opcintype) AS opcintype,
+                               (SELECT typname FROM pg_type t WHERE t.oid=opcdeftype) AS opcintype,
                                TRUE AS opcdefault,
                                NULL::text AS opccomment
                        FROM
index dcf351cc81744f6209a6ff7c39d8945a850a5f20..bd8b31a609c7009449c5e4bb0a9a50e575a03e35 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres72.php,v 1.81 2005/08/01 05:31:32 chriskl Exp $
+ * $Id: Postgres72.php,v 1.82 2005/08/10 05:50:52 chriskl Exp $
  */
 
 
@@ -442,6 +442,38 @@ class Postgres72 extends Postgres71 {
                return $this->selectSet($sql);
        }
 
+       // Opclass functions
+
+       /**
+        * Gets all opclasses
+        * @return A recordset
+        */
+       function getOpClasses() {
+               global $conf;
+               
+               if ($conf['show_system'])
+                       $where = '';
+               else
+                       $where = "AND po.oid > '{$this->_lastSystemOID}'::oid";
+
+               $sql = "
+                       SELECT DISTINCT
+                               pa.amname, 
+                               po.opcname, 
+                               format_type(po.opcintype, NULL) AS opcintype,
+                               TRUE AS opcdefault,
+                               NULL::text AS opccomment
+                       FROM
+                               pg_opclass po, pg_am pa
+                       WHERE
+                               po.opcamid=pa.oid
+                               {$where}
+                       ORDER BY 1,2
+               ";
+
+               return $this->selectSet($sql);
+       }
+       
        // Administration functions
 
        /**