From 378956d652058d4796293b5aaded6dfcebcea625 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Thu, 9 Sep 2004 07:12:11 +0000 Subject: [PATCH] add indexUnique() --- includes/DatabasePostgreSQL.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 75c7fe4808..736822fb73 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -171,6 +171,18 @@ class DatabasePgsql extends Database { return false; } + function indexUnique ($table, $index, $fname = 'Database::indexUnique' ) { + $sql = "SELECT indexname FROM pg_indexes WHERE tablename='{$table}'". + " AND indexdef LIKE 'CREATE UNIQUE%({$index})'"; + $res = $this->query( $sql, $fname ); + if ( !$res ) + return NULL; + while ($row = $this->fetchObject( $res )) + return true; + return false; + + } + function fieldInfo( $table, $field ) { wfDebugDieBacktrace( 'Database::fieldInfo() error : mysql_fetch_field() not implemented for postgre' ); /* -- 2.20.1