Apply both of Guillaume's patches. Apply Ian's autovacuum fix.
authorchriskl <chriskl>
Fri, 19 May 2006 07:17:29 +0000 (07:17 +0000)
committerchriskl <chriskl>
Fri, 19 May 2006 07:17:29 +0000 (07:17 +0000)
CREDITS
HISTORY
classes/database/Postgres.php
classes/database/Postgres73.php
classes/database/Postgres74.php
classes/database/Postgres80.php
database.php
lang/english.php
lang/recoded/english.php
sequences.php
tables.php

diff --git a/CREDITS b/CREDITS
index 8f044e27d89caab5f74950e8138f744d78e38ce7..751c8851561a2184f2752f47ba42eb3c68d9a863 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -53,6 +53,8 @@ Contributors
 - Dan Boren (Object comments)
 - Adrian Nida (Fix time outs)
 - Russell Smith
+- Guillaume Lelarge
+- Ian Barwick
 
 Third Party Libraries
 
@@ -61,4 +63,4 @@ Third Party Libraries
 
 Corporate Sponsors
 
-- SpikeSource (www.spikesource.com) - Slony support
\ No newline at end of file
+- SpikeSource (www.spikesource.com) - Slony support
diff --git a/HISTORY b/HISTORY
index fe9d63d2c934895333cedcdb94e39223bdce697f..aed8195741df9fc3638e8b56ec111b759cb91030 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -8,6 +8,10 @@ Features
 * New icons by Niko <ennixo@free.fr>, from the graphics repository on pgFoundry.
 * Added icons to bread crumb trail and tabs.
 * Send encrypted passwords over the wire wherever possible.
+* Alter sequence, nextval and setval (Guillaume)
+* Auto-select 'WITHOUT OIDS' if 'default_with_oids' setting is false (Guillaume)
+* Autovacuum configuration support (Robert Treat)
+* Basic ROLE support (Chris Kings-Lynne)
 
 Version 4.0
 -----------
index 624d11cf0a5b52d16c37f31fa807009ac0e12c02..fd03603f38c51b330de9128f1172722d67ec49e7 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.283 2006/04/21 03:31:25 chriskl Exp $
+ * $Id: Postgres.php,v 1.284 2006/05/19 07:17:30 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -691,6 +691,16 @@ class Postgres extends ADODB_base {
                return true;
        }
 
+       /**
+        * Returns the current default_with_oids setting
+        * @return default_with_oids setting
+        */
+       function getDefaultWithOid() {
+               // 8.0 is the first release to have this setting
+               // Prior releases don't have this setting... oids always activated
+               return 'on';
+       }
+       
        /**
         * Creates a new table in the database
         * @param $name The name of the table
@@ -1884,6 +1894,40 @@ class Postgres extends ADODB_base {
                return $this->execute($sql);
        }
 
+       /** 
+        * Execute nextval on a given sequence
+        * @param $sequence Sequence name
+        * @return 0 success
+        * @return -1 sequence not found
+        */
+       function nextvalSequence($sequence) {
+               /* This double-cleaning is deliberate */
+               $this->fieldClean($sequence);
+               $this->clean($sequence);
+
+               $sql = "SELECT NEXTVAL('\"{$sequence}\"')";
+               
+               return $this->execute($sql);
+       }
+
+       /** 
+        * Execute setval on a given sequence
+        * @param $sequence Sequence name
+        * @param $nextvalue The next value
+        * @return 0 success
+        * @return -1 sequence not found
+        */
+       function setvalSequence($sequence, $nextvalue) {
+               /* This double-cleaning is deliberate */
+               $this->fieldClean($sequence);
+               $this->clean($sequence);
+               $this->clean($nextvalue);
+
+               $sql = "SELECT SETVAL('\"{$sequence}\"', '{$nextvalue}')";
+               
+               return $this->execute($sql);
+       }
+
        /**
         * Creates a new sequence
         * @param $sequence Sequence name
@@ -4515,6 +4559,7 @@ class Postgres extends ADODB_base {
        function hasServerAdminFuncs() { return false; }
        function hasRoles() { return false; }
        function hasAutovacuum() { return false; }
+       function hasAlterSequence() { return false; }
 
 }
 
index ae55f9348d708c5845ca8a00c78c7c84ada535bb..f92dfcd683298aa5443cca7a5520e0a5d11f0483 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres73.php,v 1.155 2006/04/10 21:25:06 xzilla Exp $
+ * $Id: Postgres73.php,v 1.156 2006/05/19 07:17:30 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -627,6 +627,61 @@ class Postgres73 extends Postgres72 {
 
        // Sequence functions
 
+       /** 
+        * Resets a given sequence to min value of sequence
+        * @param $sequence Sequence name
+        * @return 0 success
+        * @return -1 sequence not found
+        */
+       function resetSequence($sequence) {
+               // Get the minimum value of the sequence
+               $seq = $this->getSequence($sequence);
+               if ($seq->recordCount() != 1) return -1;
+               $minvalue = $seq->f['min_value'];
+
+               /* This double-cleaning is deliberate */
+               $this->fieldClean($sequence);
+               $this->clean($sequence);
+               
+               $sql = "SELECT pg_catalog.SETVAL('\"{$sequence}\"', {$minvalue})";
+               
+               return $this->execute($sql);
+       }
+
+       /** 
+        * Execute nextval on a given sequence
+        * @param $sequence Sequence name
+        * @return 0 success
+        * @return -1 sequence not found
+        */
+       function nextvalSequence($sequence) {
+               /* This double-cleaning is deliberate */
+               $this->fieldClean($sequence);
+               $this->clean($sequence);
+
+               $sql = "SELECT pg_catalog.NEXTVAL('\"{$sequence}\"')";
+               
+               return $this->execute($sql);
+       }
+
+       /** 
+        * Execute setval on a given sequence
+        * @param $sequence Sequence name
+        * @param $nextvalue The next value
+        * @return 0 success
+        * @return -1 sequence not found
+        */
+       function setvalSequence($sequence, $nextvalue) {
+               /* This double-cleaning is deliberate */
+               $this->fieldClean($sequence);
+               $this->clean($sequence);
+               $this->clean($nextvalue);
+
+               $sql = "SELECT pg_catalog.SETVAL('\"{$sequence}\"', '{$nextvalue}')";
+               
+               return $this->execute($sql);
+       }
+
        /**
         * Returns all sequences in the current database
         * @return A recordset
index 915e221e6f70ee87acd442eadd321a1d51f1e1ae..8024fcdc2c971dc3090b1ee4e7a01c9d2ecf96ee 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres74.php,v 1.50 2005/09/07 08:09:21 chriskl Exp $
+ * $Id: Postgres74.php,v 1.51 2006/05/19 07:17:30 chriskl Exp $
  */
 
 include_once('./classes/database/Postgres73.php');
@@ -544,6 +544,46 @@ class Postgres74 extends Postgres73 {
                
                return $this->endTransaction();
        }
+
+       // Sequences
+       
+       /**
+        * Alters a sequence
+        * @param $sequence Sequence name
+        * @param $increment The increment
+        * @param $minvalue The min value
+        * @param $maxvalue The max value
+        * @param $startvalue The starting value
+        * @param $cachevalue The cache value
+        * @param $cycledvalue True if cycled, false otherwise
+        * @return 0 success
+        * @return -1 get sequence error
+        */
+       function alterSequence($sequence, $increment, $minvalue, $maxvalue,
+                               $startvalue, $cachevalue, $cycledvalue) {
+               $data = $this->getSequence($sequence);
+               if ($data->recordCount() != 1) {
+                       return -1;
+               }
+
+               $this->fieldClean($sequence);
+               $this->clean($increment);
+               $this->clean($minvalue);
+               $this->clean($maxvalue);
+               $this->clean($startvalue);
+               $this->clean($cachevalue);
+               $this->clean($cycledvalue);
+
+               $sql = "ALTER SEQUENCE \"{$sequence}\"";
+               if ($increment != '' && $increment != $data->f['increment_by']) $sql .= " INCREMENT {$increment}";
+               if ($minvalue != '' && $minvalue != $data->f['min_value']) $sql .= " MINVALUE {$minvalue}";
+               if ($maxvalue != '' && $maxvalue != $data->f['max_value']) $sql .= " MAXVALUE {$maxvalue}";
+               if ($startvalue != '' && $startvalue != $data->f['last_value']) $sql .= " START {$startvalue}";
+               if ($cachevalue != '' && $cachevalue != $data->f['cache_value']) $sql .= " CACHE {$cachevalue}";
+               if ($cycledvalue && $cycledvalue != $data->f['is_cycled']) $sql .= " CYCLE";
+               
+               return $this->execute($sql);
+       }       
        
        // Capabilities
        function hasAlterDatabaseRename() { return true; }
@@ -552,6 +592,7 @@ class Postgres74 extends Postgres73 {
        function hasUserRename() { return true; }
        function hasRecluster() { return true; }
        function hasReadOnlyQueries() { return true; }  
+       function hasAlterSequence() { return true; }
 }
 
 ?>
index b2385ef3936836febe928033ecbb9e3c5dd81e1e..752842d525fff50bcab909a537c68a9b34cb692b 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * PostgreSQL 8.0 support
  *
- * $Id: Postgres80.php,v 1.18 2005/09/07 08:09:21 chriskl Exp $
+ * $Id: Postgres80.php,v 1.19 2006/05/19 07:17:30 chriskl Exp $
  */
 
 include_once('./classes/database/Postgres74.php');
@@ -136,6 +136,22 @@ class Postgres80 extends Postgres74 {
                return $this->execute($sql);
        }
 
+       /**
+        * Returns the current default_with_oids setting
+        * @return default_with_oids setting
+        */
+       function getDefaultWithOid() {
+               // Try to avoid a query if at all possible (5)
+               if (function_exists('pg_parameter_status')) {
+                       $default = pg_parameter_status($this->conn->_connectionID, 'default_with_oids');
+                       if ($default !== false) return $default;
+               }
+               
+               $sql = "SHOW default_with_oids";
+               
+               return $this->selectField($sql, 'default_with_oids');
+       }
+       
        // Table functions
        
        /**
index 8f6911964275e7d19bc03cdf34588886a86fe41e..d5da3a2ead954d98a1adcdd9bc8d3a636ef6f76e 100755 (executable)
@@ -3,7 +3,7 @@
        /**
         * Manage schemas within a database
         *
-        * $Id: database.php,v 1.81 2006/03/17 21:14:30 xzilla Exp $
+        * $Id: database.php,v 1.82 2006/05/19 07:17:29 chriskl Exp $
         */
 
        // Include application functions
 
                                echo "<br />";
                                echo "<br />";
-                               echo "<h3>{$lang['strautovacuum']}</h3>";
-                               // Autovacuum
-                               // Fetch the processes from the database
-                               $autovac = $data->getAutovacuum();
+
+                               if($data->hasAutovacuum()) {
+                                       echo "<h3>{$lang['strautovacuum']}</h3>";
+                                       // Autovacuum
+                                       // Fetch the processes from the database
+                                       $autovac = $data->getAutovacuum();
                
-                               $columns = array(
-                                       'namespace' => array(
-                                               'title' => $lang['strschema'],
-                                               'field' => 'nspname',
-                                       ),
-                                       'relname' => array(
-                                               'title' => $lang['strtable'],
-                                               'field' => 'relname',
-                                       ),
-                                       'enabled' => array(
-                                               'title' => $lang['strenabled'],
-                                               'field' => 'enabled',
-                                       ),
-                                       'vac_base_thresh' => array(
-                                               'title' => $lang['strvacuumbasethreshold'],
-                                               'field' => 'vac_base_thresh',
-                                       ),
-                                       'vac_scale_factor' => array(
-                                               'title' => $lang['strvacuumscalefactor'],
-                                               'field' => 'vac_scale_factor',
-                                       ),
-                                       'anl_base_thresh' => array(
-                                               'title' => $lang['stranalybasethreshold'],
-                                               'field' => 'anl_base_thresh',
-                                       ),
-                                       'anl_scale_factor' => array(
-                                               'title' => $lang['stranalyzescalefactor'],
-                                               'field' => 'anl_scale_factor',
-                                       ),
-                                       'vac_cost_delay' => array(
-                                               'title' => $lang['strvacuumcostdelay'],
-                                               'field' => 'vac_cost_delay',
-                                       ),
-                                       'vac_cost_limit' => array(
-                                               'title' => $lang['strvacuumcostlimit'],
-                                               'field' => 'vac_cost_limit',
-                                       ),
-                               );
-
-
-                               // Maybe we need to check permissions here?
-                               $columns['actions'] = array('title' => $lang['stractions']);
+                                       $columns = array(
+                                               'namespace' => array(
+                                                       'title' => $lang['strschema'],
+                                                       'field' => 'nspname',
+                                               ),      
+                                               'relname' => array(
+                                                       'title' => $lang['strtable'],
+                                                       'field' => 'relname',
+                                               ),
+                                               'enabled' => array(
+                                                       'title' => $lang['strenabled'],
+                                                       'field' => 'enabled',
+                                               ),
+                                               'vac_base_thresh' => array(
+                                                       'title' => $lang['strvacuumbasethreshold'],
+                                                       'field' => 'vac_base_thresh',
+                                               ),
+                                               'vac_scale_factor' => array(
+                                                       'title' => $lang['strvacuumscalefactor'],
+                                                       'field' => 'vac_scale_factor',
+                                               ),
+                                               'anl_base_thresh' => array(
+                                                       'title' => $lang['stranalybasethreshold'],
+                                                       'field' => 'anl_base_thresh',
+                                               ),
+                                               'anl_scale_factor' => array(
+                                                       'title' => $lang['stranalyzescalefactor'],
+                                                       'field' => 'anl_scale_factor',
+                                               ),
+                                               'vac_cost_delay' => array(
+                                                       'title' => $lang['strvacuumcostdelay'],
+                                                       'field' => 'vac_cost_delay',
+                                               ),
+                                               'vac_cost_limit' => array(
+                                                       'title' => $lang['strvacuumcostlimit'],
+                                                       'field' => 'vac_cost_limit',
+                                               ),
+                                       );
+
+                                       // Maybe we need to check permissions here?
+                                       $columns['actions'] = array('title' => $lang['stractions']);
                        
-                               $actions = array(
-                                       'edit' => array(
-                                       'title' => $lang['stredit'],
-                                       'url'   => "{$PHP_SELF}?action=autovacuum&amp;{$misc->href}&amp;",
-                                       'vars'  => array('vacrelid' => 'vacrelid')
-                                       )
-                               );
-               
-                               $misc->printTable($autovac, $columns, $actions, $lang['strnodata']);
+                                       $actions = array(
+                                               'edit' => array(
+                                               'title' => $lang['stredit'],
+                                               'url'   => "{$PHP_SELF}?action=autovacuum&amp;{$misc->href}&amp;",
+                                               'vars'  => array('vacrelid' => 'vacrelid')
+                                               )
+                                       );
+
+                                       $misc->printTable($autovac, $columns, $actions, $lang['strnodata']);
+                               }
                                        
                                break;
                }
index 4da8cf2d075d708c14d7bfd48920eefb46662c39..247dd4a3fd1c98c6138e69a76ef6a549c3cae2f9 100755 (executable)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.186 2006/04/21 03:31:26 chriskl Exp $
+        * $Id: english.php,v 1.187 2006/05/19 07:17:30 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsequencedroppedbad'] = 'Sequence drop failed.';
        $lang['strsequencereset'] = 'Sequence reset.';
        $lang['strsequenceresetbad'] = 'Sequence reset failed.'; 
+       $lang['straltersequence'] = 'Alter sequence';
+       $lang['strsequencealtered'] = 'Sequence altered.';
+       $lang['strsequencealteredbad'] = 'Sequence alteration failed.';
+       $lang['strsetval'] = 'Set Value';
+       $lang['strsequencesetval'] = 'Sequence value set.';
+       $lang['strsequencesetvalbad'] = 'Sequence value set failed.';
+       $lang['strnextval'] = 'Increment Value';
+       $lang['strsequencenextval'] = 'Sequence incremented.';
+       $lang['strsequencenextvalbad'] = 'Sequence increment failed.';
 
        // Indexes
        $lang['strindex'] = 'Index';
index c89da23f58bf8cd788ae68d22e87f06d96402844..7e8a06847fcd93f36369bdcad8d9d0e7374cda70 100644 (file)
@@ -4,7 +4,7 @@
         * English language file for phpPgAdmin.  Use this as a basis
         * for new translations.
         *
-        * $Id: english.php,v 1.139 2006/04/21 03:31:26 chriskl Exp $
+        * $Id: english.php,v 1.140 2006/05/19 07:17:30 chriskl Exp $
         */
 
        // Language and character set
        $lang['strsequencedroppedbad'] = 'Sequence drop failed.';
        $lang['strsequencereset'] = 'Sequence reset.';
        $lang['strsequenceresetbad'] = 'Sequence reset failed.'; 
+       $lang['straltersequence'] = 'Alter sequence';
+       $lang['strsequencealtered'] = 'Sequence altered.';
+       $lang['strsequencealteredbad'] = 'Sequence alteration failed.';
+       $lang['strsetval'] = 'Set Value';
+       $lang['strsequencesetval'] = 'Sequence value set.';
+       $lang['strsequencesetvalbad'] = 'Sequence value set failed.';
+       $lang['strnextval'] = 'Increment Value';
+       $lang['strsequencenextval'] = 'Sequence incremented.';
+       $lang['strsequencenextvalbad'] = 'Sequence increment failed.';
 
        // Indexes
        $lang['strindex'] = 'Index';
index 8967d1ca1daf1b4c44107b1da803de489fdb217b..a37959fb8df894329564589ba3e3cac890060375 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * Manage sequences in a database
         *
-        * $Id: sequences.php,v 1.31 2005/11/25 08:49:08 jollytoad Exp $
+        * $Id: sequences.php,v 1.32 2006/05/19 07:17:29 chriskl Exp $
         */
        
        // Include application functions
                        echo "</tr>";
                        echo "</table>";
                        
-                       echo "<p><a class=\"navlink\" href=\"{$PHP_SELF}?action=reset&amp;{$misc->href}&amp;sequence=", urlencode($sequence->f['seqname']), "\">{$lang['strreset']}</a> |\n";
+                       if ($data->hasAlterSequence()) {
+                               echo "<p><a class=\"navlink\" href=\"{$PHP_SELF}?action=confirm_alter&amp;{$misc->href}&amp;sequence=", urlencode($sequence->f['seqname']), "\">{$lang['straltersequence']}</a> |\n";
+                       }
+                       echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=confirm_setval&amp;{$misc->href}&amp;sequence=", urlencode($sequence->f['seqname']), "\">{$lang['strsetval']}</a> |\n";
+                       echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=nextval&amp;{$misc->href}&amp;sequence=", urlencode($sequence->f['seqname']), "\">{$lang['strnextval']}</a> |\n";
+                       echo "<a class=\"navlink\" href=\"{$PHP_SELF}?action=reset&amp;{$misc->href}&amp;sequence=", urlencode($sequence->f['seqname']), "\">{$lang['strreset']}</a> |\n";
                        echo "<a class=\"navlink\" href=\"{$PHP_SELF}?{$misc->href}\">{$lang['strshowallsequences']}</a></p>\n";
                }
                else echo "<p>{$lang['strnodata']}</p>\n";
                        doProperties($lang['strsequenceresetbad']);
        }
        
+       /**
+        * Set Nextval of a sequence
+        */
+       function doNextval() {
+               global $data;
+               global $PHP_SELF, $lang;
+               
+               $status = $data->nextvalSequence($_REQUEST['sequence']);
+               if ($status == 0)
+                       doProperties($lang['strsequencenextval']);
+               else    
+                       doProperties($lang['strsequencenextvalbad']);
+       }
+       
+       /** 
+        * Function to save after 'setval'ing a sequence
+        */
+       function doSaveSetval() {
+               global $data, $lang, $_reload_browser;
+
+               $status = $data->setvalSequence($_POST['sequence'], $_POST['nextvalue']);
+               if ($status == 0)
+                       doProperties($lang['strsequencesetval']);
+               else    
+                       doProperties($lang['strsequencesetvalbad']);
+       }
+
+       /**
+        * Function to allow 'setval'ing of a sequence
+        */
+       function doSetval($msg = '') {
+               global $data, $misc;
+               global $PHP_SELF, $lang;
+               
+               $misc->printTrail('sequence');
+               $misc->printTitle($lang['strsetval'], 'pg.sequence');
+               $misc->printMsg($msg);
+
+               // Fetch the sequence information
+               $sequence = $data->getSequence($_REQUEST['sequence']);          
+               
+               if (is_object($sequence) && $sequence->recordCount() > 0) {
+                       echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+                       echo "<table border=\"0\">";
+                       echo "<tr><th class=\"data left required\">{$lang['strlastvalue']}</th>\n";
+                       echo "<td class=\"data1\">";
+                       echo "<input name=\"nextvalue\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", 
+                               $misc->printVal($sequence->f['last_value']), "\" /></td></tr>\n";
+                       echo "</table>\n";
+                       echo "<p><input type=\"hidden\" name=\"action\" value=\"setval\" />\n";
+                       echo "<input type=\"hidden\" name=\"sequence\" value=\"", htmlspecialchars($_REQUEST['sequence']), "\" />\n";
+                       echo $misc->form;
+                       echo "<input type=\"submit\" name=\"setval\" value=\"{$lang['strsetval']}\" />\n";
+                       echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
+                       echo "</form>\n";
+               }
+               else echo "<p>{$lang['strnodata']}</p>\n";
+       }
+       
+       /** 
+        * Function to save after altering a sequence
+        */
+       function doSaveAlter() {
+               global $data, $lang, $_reload_browser;
+
+               $status = $data->alterSequence($_POST['sequence'], $_POST['formIncrement'], $_POST['formMinValue'], $_POST['formMaxValue'], $_POST['formStartValue'], $_POST['formCacheValue'], $_POST['formCycledValue']);
+               if ($status == 0) {
+                       doProperties($lang['strsequencealtered']);
+               }
+               else
+                       doProperties($lang['strsequencealteredbad']);
+       }
+
+       /**
+        * Function to allow altering of a sequence
+        */
+       function doAlter($msg = '') {
+               global $data, $misc;
+               global $PHP_SELF, $lang;
+               
+               $misc->printTrail('sequence');
+               $misc->printTitle($lang['stralter'], 'pg.sequence.alter');
+               $misc->printMsg($msg);
+               
+               // Fetch the sequence information
+               $sequence = $data->getSequence($_REQUEST['sequence']);
+               
+               if (is_object($sequence) && $sequence->recordCount() > 0) {
+                       echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+                       echo "<table>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['strincrementby']}</th>\n";
+                       echo "<td class=\"data1\"><input name=\"formIncrement\" size=\"5\" value=\"",
+                               htmlspecialchars($sequence->f['increment_by']), "\" /> </td></tr>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['strminvalue']}</th>\n";
+                       echo "<td class=\"data1\"><input name=\"formMinValue\" size=\"5\" value=\"",
+                               htmlspecialchars($sequence->f['min_value']), "\" /></td></tr>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['strmaxvalue']}</th>\n";
+                       echo "<td class=\"data1\"><input name=\"formMaxValue\" size=\"5\" value=\"",
+                               htmlspecialchars($sequence->f['max_value']), "\" /></td></tr>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['strstartvalue']}</th>\n";
+                       echo "<td class=\"data1\"><input name=\"formStartValue\" size=\"5\" value=\"",
+                               htmlspecialchars($sequence->f['last_value']), "\" /></td></tr>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['strcachevalue']}</th>\n";
+                       echo "<td class=\"data1\"><input name=\"formCacheValue\" size=\"5\" value=\"",
+                               htmlspecialchars($sequence->f['cache_value']), "\" /></td></tr>\n";
+                       
+                       echo "<tr><th class=\"data left\">{$lang['striscycled']}</th>\n";
+                       echo "<td class=\"data1\"><input type=\"checkbox\" name=\"formCycledValue\" value=\"",
+                               ($sequence->f['is_cycled'] ? ' checked="checked"' : ''), "\" /></td></tr>\n";
+       
+                       echo "</table>\n";
+                       echo "<p><input type=\"hidden\" name=\"action\" value=\"alter\" />\n";
+                       echo $misc->form;
+                       echo "<input type=\"hidden\" name=\"sequence\" value=\"", htmlspecialchars($_REQUEST['sequence']), "\" />\n";
+                       echo "<input type=\"submit\" name=\"alter\" value=\"{$lang['stralter']}\" />\n";
+                       echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n";
+                       echo "</form>\n";
+               }
+               else echo "<p>{$lang['strnodata']}</p>\n";
+       }
+
        if ($action == 'tree') doTree();
        
        // Print header
                case 'reset':
                        doReset();
                        break;
+               case 'nextval':
+                       doNextval();
+                       break;
+               case 'setval':
+                       if (isset($_POST['setval'])) doSaveSetval();
+                       else doDefault();
+                       break;
+               case 'confirm_setval':
+                       doSetval();
+                       break;
+               case 'alter':
+                       if (isset($_POST['alter'])) doSaveAlter();
+                       else doDefault();
+                       break;
+               case 'confirm_alter':
+                       doAlter();
+                       break;
                default:
                        doDefault();
                        break;
index 767801845d56c73a5d1c3d7f6b4ef70d3b4b02c8..2f6d6661e79499b4d64a2c28f66cfe0efe61f1a4 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.75 2005/11/25 08:49:08 jollytoad Exp $
+        * $Id: tables.php,v 1.76 2006/05/19 07:17:30 chriskl Exp $
         */
 
        // Include application functions
                global $data, $misc;
                global $PHP_SELF, $lang;
 
-               if (!isset($_REQUEST['stage'])) $_REQUEST['stage'] = 1;
+               if (!isset($_REQUEST['stage'])) {
+                       $_REQUEST['stage'] = 1;
+                       $default_with_oids = $data->getDefaultWithOid();
+                       if ($default_with_oids == 'off') $_REQUEST['withoutoids'] = 'on';
+               }
+                       
                if (!isset($_REQUEST['name'])) $_REQUEST['name'] = '';
                if (!isset($_REQUEST['fields'])) $_REQUEST['fields'] = '';
                if (!isset($_REQUEST['tblcomment'])) $_REQUEST['tblcomment'] = '';
@@ -44,8 +49,7 @@
                                        htmlspecialchars($_REQUEST['fields']), "\" /></td>\n\t</tr>\n";
                                if ($data->hasWithoutOIDs()) {
                                        echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['stroptions']}</th>\n";
-                                       echo "\t\t<td class=\"data\"><input type=\"checkbox\" name=\"withoutoids\"", 
-                                               (isset($_REQUEST['withoutoids']) ? ' checked="checked"' : ''), " />WITHOUT OIDS</td>\n\t</tr>\n";
+                                       echo "\t\t<td class=\"data\"><label><input type=\"checkbox\" name=\"withoutoids\"", isset($_REQUEST['withoutoids']) ? ' checked="checked"' : '', " />WITHOUT OIDS</label></td>\n\t</tr>\n";
                                }
                                
                                // Tablespace (if there are any)