* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres74.php,v 1.3 2003/02/09 10:22:39 chriskl Exp $
+ * $Id: Postgres74.php,v 1.4 2003/03/16 10:56:02 chriskl Exp $
*/
include_once('classes/database/Postgres73.php');
$this->Postgres73($host, $port, $database, $user, $password);
}
+ // Trigger functions
+
+ /**
+ * Grabs a list of triggers on a table
+ * @param $table The name of a table whose triggers to retrieve
+ * @return A recordset
+ */
+ function &getTriggers($table = '') {
+ $this->clean($table);
+
+ $sql = "SELECT t.tgname, pg_catalog.pg_get_triggerdef(t.oid) AS tgdef
+ FROM pg_catalog.pg_trigger t
+ WHERE t.tgrelid = (SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}'
+ AND relnamespace=(SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$this->_schema}'))
+ AND (NOT tgisconstraint OR NOT EXISTS
+ (SELECT 1 FROM pg_catalog.pg_depend d JOIN pg_catalog.pg_constraint c
+ ON (d.refclassid = c.tableoid AND d.refobjid = c.oid)
+ WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))";
+
+ return $this->selectSet($sql);
+ }
+
// Constraint functions
/**