From 14a6d6ce3b6f45691430832e7dd8f0ff19f88a76 Mon Sep 17 00:00:00 2001 From: chriskl Date: Wed, 10 Aug 2005 05:50:52 +0000 Subject: [PATCH] Fix opclass queries for 7.0-7.2 --- classes/database/Postgres.php | 4 ++-- classes/database/Postgres72.php | 34 ++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index a2a63f3f..0484b525 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -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 diff --git a/classes/database/Postgres72.php b/classes/database/Postgres72.php index dcf351cc..bd8b31a6 100644 --- a/classes/database/Postgres72.php +++ b/classes/database/Postgres72.php @@ -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 /** -- 2.39.5