From: xzilla Date: Tue, 18 Sep 2007 05:03:29 +0000 (+0000) Subject: update locks page to handle virtual transactions in 8.3. Patch from ioguix. X-Git-Tag: REL_4-2-BETA-1~67 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=e545daa606280ded15e88aabcb0b36bec79591d0;p=phppgadmin.git update locks page to handle virtual transactions in 8.3. Patch from ioguix. --- diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index e02244d3..3b8660c0 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.303 2007/09/13 14:53:41 ioguix Exp $ + * $Id: Postgres.php,v 1.304 2007/09/18 05:03:29 xzilla Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -4735,7 +4735,8 @@ class Postgres extends ADODB_base { function hasCreateTableLike() {return false;} function hasCreateTableLikeWithConstraints() {return false;} function hasCreateTableLikeWithIndexes() {return false;} - function hasFTS() {return false;} + function hasFTS() {return false;} + function hasVirtualTransactionId() {return false;} } ?> diff --git a/classes/database/Postgres83.php b/classes/database/Postgres83.php index 034e437c..5be05103 100644 --- a/classes/database/Postgres83.php +++ b/classes/database/Postgres83.php @@ -3,7 +3,7 @@ /** * PostgreSQL 8.3 support * - * $Id: Postgres83.php,v 1.5 2007/09/14 21:38:06 ioguix Exp $ + * $Id: Postgres83.php,v 1.6 2007/09/18 05:03:29 xzilla Exp $ */ include_once('./classes/database/Postgres82.php'); @@ -30,6 +30,39 @@ class Postgres83 extends Postgres82 { return $this->help_page; } + // Schemas functions + /** + * Returns table locks information in the current database + * @return A recordset + */ + + function getLocks() { + global $conf; + + if (!$conf['show_system']) + $where = "AND pn.nspname NOT LIKE 'pg\\\\_%'"; + else + $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; + + $sql = "SELECT + pn.nspname, pc.relname AS tablename, pl.pid, pl.mode, pl.granted, pl.virtualtransaction, + (select transactionid from pg_catalog.pg_locks l2 where l2.locktype='transactionid' + and l2.mode='ExclusiveLock' and l2.virtualtransaction=pl.virtualtransaction) as transaction + FROM + pg_catalog.pg_locks pl, + pg_catalog.pg_class pc, + pg_catalog.pg_namespace pn + WHERE + pl.relation = pc.oid + AND + pc.relnamespace=pn.oid + {$where} + ORDER BY + pid,nspname,tablename"; + + return $this->selectSet($sql); + } + // Views functions /** @@ -129,7 +162,8 @@ class Postgres83 extends Postgres82 { return $this->selectSet($sql); } - // FTS functions + // FTS functions + /** * Creates a new FTS configuration. * @param string $cfgname The name of the FTS configuration to create @@ -569,5 +603,6 @@ class Postgres83 extends Postgres82 { // Capabilities function hasCreateTableLikeWithIndexes() {return true;} + function hasVirtualTransactionId() {return true;} } ?> diff --git a/database.php b/database.php index 9d372008..2fe05c52 100755 --- a/database.php +++ b/database.php @@ -3,7 +3,7 @@ /** * Manage schemas within a database * - * $Id: database.php,v 1.101 2007/08/31 18:30:10 ioguix Exp $ + * $Id: database.php,v 1.102 2007/09/18 05:03:29 xzilla Exp $ */ // Include application functions @@ -510,6 +510,10 @@ 'title' => $lang['strtablename'], 'field' => field('tablename'), ), + 'vxid' => array( + 'title' => $lang['strvirtualtransaction'], + 'field' => field('virtualtransaction'), + ), 'transactionid' => array( 'title' => $lang['strtransaction'], 'field' => field('transaction'), @@ -529,6 +533,8 @@ ), ); + if (!$data->hasVirtualTransactionId()) unset($columns['vxid']); + $actions = array(); $misc->printTable($variables, $columns, $actions, $lang['strnodata']); diff --git a/lang/english.php b/lang/english.php index a9e8920b..f9aaed30 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.217 2007/09/13 14:53:41 ioguix Exp $ + * $Id: english.php,v 1.218 2007/09/18 05:03:29 xzilla Exp $ */ // Language and character set @@ -890,6 +890,7 @@ // Table-level Locks $lang['strlocks'] = 'Locks'; $lang['strtransaction'] = 'Transaction ID'; + $lang['strvirtualtransaction'] = 'Virtual Transaction ID'; $lang['strprocessid'] = 'Process ID'; $lang['strmode'] = 'Lock mode'; $lang['strislockheld'] = 'Is lock held?'; @@ -951,4 +952,4 @@ $lang['strftsmappingaddedbad'] = 'FTS mapping add failed.'; -?> \ No newline at end of file +?> diff --git a/lang/recoded/english.php b/lang/recoded/english.php index 65975537..82d6bcb0 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.169 2007/09/13 14:53:41 ioguix Exp $ + * $Id: english.php,v 1.170 2007/09/18 05:03:29 xzilla Exp $ */ // Language and character set @@ -890,6 +890,7 @@ // Table-level Locks $lang['strlocks'] = 'Locks'; $lang['strtransaction'] = 'Transaction ID'; + $lang['strvirtualtransaction'] = 'Virtual Transaction ID'; $lang['strprocessid'] = 'Process ID'; $lang['strmode'] = 'Lock mode'; $lang['strislockheld'] = 'Is lock held?';