update locks page to handle virtual transactions in 8.3. Patch from ioguix.
authorxzilla <xzilla>
Tue, 18 Sep 2007 05:03:29 +0000 (05:03 +0000)
committerxzilla <xzilla>
Tue, 18 Sep 2007 05:03:29 +0000 (05:03 +0000)
classes/database/Postgres.php
classes/database/Postgres83.php
database.php
lang/english.php
lang/recoded/english.php

index e02244d3c741112a192c004cad16df2d265df8f7..3b8660c0a3c0783e3b23851168972c802eceb4f5 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.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;}
 }
 
 ?>
index 034e437c4f6b00fde15348e15bac4775dc21321e..5be05103a0c61b4394d51bd2ae877149285aa0c1 100644 (file)
@@ -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;}
 }
 ?>
index 9d372008126e8d641005b8ab64d54cf0f3d8af5a..2fe05c5211f18d4001f1f201e3474fc578aa27b5 100755 (executable)
@@ -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
                                'title' => $lang['strtablename'],
                                'field' => field('tablename'),
                        ),
+                       'vxid' => array(
+                               'title' => $lang['strvirtualtransaction'],
+                               'field' => field('virtualtransaction'),
+                       ),
                        'transactionid' => array(
                                'title' => $lang['strtransaction'],
                                'field' => field('transaction'),
                        ),
                );
 
+               if (!$data->hasVirtualTransactionId()) unset($columns['vxid']);
+
                $actions = array();
 
                $misc->printTable($variables, $columns, $actions, $lang['strnodata']);
index a9e8920ba5637a2a654c779608d76e4cf6a83131..f9aaed30c5defe932960250ba989a5f8d11a9ba1 100755 (executable)
@@ -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
        // 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?';
        $lang['strftsmappingaddedbad'] = 'FTS mapping add failed.';
        
        
-?>
\ No newline at end of file
+?>
index 6597553732ce36309a09aa513a8fba4ce5cd0d67..82d6bcb081345324e2709a925da9fb8a5fbc45e2 100644 (file)
@@ -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
        // 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?';