Apply patch from Javier Carlos for listing prepared transactions with minor cleanup...
authorxzilla <xzilla>
Tue, 20 Jun 2006 14:06:08 +0000 (14:06 +0000)
committerxzilla <xzilla>
Tue, 20 Jun 2006 14:06:08 +0000 (14:06 +0000)
classes/database/Postgres.php
classes/database/Postgres81.php
database.php
lang/english.php
lang/recoded/english.php

index 4fdee082740eb58359f2fbfa4d7bd1bf8413d4d7..fc6db6135c650977c8913e932acb617b1228ebb8 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.285 2006/05/24 04:53:40 chriskl Exp $
+ * $Id: Postgres.php,v 1.286 2006/06/20 14:06:09 xzilla Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -4561,6 +4561,7 @@ class Postgres extends ADODB_base {
        function hasAutovacuum() { return false; }
        function hasAlterSequence() { return false; }
        function hasLocksView() { return false; }
+       function hasPreparedXacts() { return false; }
 
 }
 
index d7d6931d073cdfc0c040e25374e4c100c557ca0c..00c0b3b97f11565567ecdb69ee3a64765be5800f 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * PostgreSQL 8.1 support
  *
- * $Id: Postgres81.php,v 1.6 2006/04/21 03:31:26 chriskl Exp $
+ * $Id: Postgres81.php,v 1.7 2006/06/20 14:06:09 xzilla Exp $
  */
 
 include_once('./classes/database/Postgres80.php');
@@ -110,6 +110,23 @@ class Postgres81 extends Postgres80 {
                return $this->selectSet($sql);
        }
 
+       /**
+        * Returns prepared transactions information
+        * @param $database (optional) Find only prepared trasactions executed in a specific database
+        * @return A recordset
+        */
+       function getPreparedXacts($database = null) {
+               if ($database === null)
+                       $sql = "SELECT * FROM pg_prepared_xacts";
+               else {
+                       $this->clean($database);
+                       $sql = "SELECT transaction, gid, prepared, owner FROM pg_prepared_xacts WHERE database='{$database}' 
+                                  ORDER BY owner";
+               }
+               
+               return $this->selectSet($sql);
+       }
+
        // Roles
        
        /**
@@ -254,6 +271,7 @@ class Postgres81 extends Postgres80 {
        function hasServerAdminFuncs() { return true; }
        function hasRoles() { return true; }
        function hasAutovacuum() { return true; }
+       function hasPreparedXacts() { return true; }
 }
 
 ?>
index 193eba43b99e57456f0744a363de535b57ae082e..d50f9b4a8c1b1e44bb3d20dfd6115271482600c0 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.85 2006/06/18 00:11:37 xzilla Exp $
+        * $Id: database.php,v 1.86 2006/06/20 14:06:08 xzilla Exp $
         */
 
        // Include application functions
                global $PHP_SELF, $data, $misc;
                global $lang;
 
-               // Fetch the processes from the database
-               $processes = $data->getProcesses($_REQUEST['database']);
-               
                $misc->printTrail('database');
                $misc->printTabs('database','processes');
                $misc->printMsg($msg);
+
+               // Display prepared transactions
+               if($data->hasPreparedXacts()) {
+                       echo "<h3>{$lang['strpreparedxacts']}</h3>\n";
+                       $prep_xacts = $data->getPreparedXacts($_REQUEST['database']);
                
+                       $columns = array(
+                               'transaction' => array(
+                                       'title' => $lang['strxactid'],
+                                       'field' => 'transaction',
+                               ),
+                               'gid' => array(
+                                       'title' => $lang['strgid'],
+                                       'field' => 'gid',
+                               ),
+                               'prepared' => array(
+                                       'title' => $lang['strstarttime'],
+                                       'field' => 'prepared',
+                               ),
+                               'owner' => array(
+                                       'title' => $lang['strowner'],
+                                       'field' => 'owner',
+                               ),
+                       );
+
+                       $actions = array();
+
+                       $misc->printTable($prep_xacts, $columns, $actions, $lang['strnodata']);
+               }
+
+               // Fetch the processes from the database
+               echo "<br /><h3>{$lang['strprocesses']}</h3>\n";
+               $processes = $data->getProcesses($_REQUEST['database']);
+                               
                $columns = array(
                        'user' => array(
                                'title' => $lang['strusername'],
                
                // Remove query start time for <7.4
                if (!isset($processes->f['query_start'])) unset($columns['start_time']);
-               
+
                $misc->printTable($processes, $columns, $actions, $lang['strnodata']);
        }
 
index b109a4914b3dbb26807d2cd9d6d119f28d7778c6..5c9eaf2b600ad47f6b6aa3d071d6d5bd472ad21d 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.188 2006/05/24 04:53:40 chriskl Exp $
+        * $Id: english.php,v 1.189 2006/06/20 14:06:09 xzilla Exp $
         */
 
        // Language and character set
        $lang['strmode'] = 'Lock mode';
        $lang['strislockheld'] = 'Is lock held?';
 
+       // Prepared transactions
+       $lang['strpreparedxacts'] = 'Prepared transactions';
+       $lang['strxactid'] = 'Transaction ID';
+       $lang['strgid'] = 'Global ID';
 ?>
index 2583c3682096e973c511590e6a1bc564a9814a2c..ca70a0532601684942e4bcf1da0f0661cab9a4f8 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.141 2006/05/24 04:53:40 chriskl Exp $
+        * $Id: english.php,v 1.142 2006/06/20 14:06:09 xzilla Exp $
         */
 
        // Language and character set
        $lang['strmode'] = 'Lock mode';
        $lang['strislockheld'] = 'Is lock held?';
 
+       // Prepared transactions
+       $lang['strpreparedxacts'] = 'Prepared transactions';
+       $lang['strxactid'] = 'Transaction ID';
+       $lang['strgid'] = 'Global ID';
 ?>