* A class that implements the DB interface for Postgres\r
* Note: This class uses ADODB and returns RecordSets.\r
*\r
- * $Id: Postgres.php,v 1.12 2002/09/26 19:25:16 xzilla Exp $\r
+ * $Id: Postgres.php,v 1.13 2002/09/26 22:04:18 xzilla Exp $\r
*/\r
\r
// @@@ THOUGHT: What about inherits? ie. use of ONLY???\r
var $tbFields = array('tbname' => 'tablename', 'tbowner' => 'tableowner');\r
var $vwFields = array('vwname' => 'viewname', 'vwowner' => 'viewowner', 'vwdef' => 'definition');\r
var $uFields = array('uname' => 'usename', 'usuper' => 'usesuper', 'ucreatedb' => 'usecreatedb', 'uexpires' => 'valuntil');\r
- var $sqFields = array('seqname' => 'relname');\r
+ var $sqFields = array('seqname' => 'relname', 'seqowner' => 'usename', 'lastvalue' => 'last_value', 'incrementby' => 'increment_by', 'maxvalue' => 'max_value', 'minvalue'=> 'min_value' );\r
\r
// Last oid assigned to a system object\r
var $_lastSystemOID = 18539;\r
function &getSequences() {\r
if (!$this->_showSystem) $where = " AND relname NOT LIKE 'pg_%'";\r
else $where = '';\r
- $sql = "SELECT relname FROM pg_class WHERE relkind = 'S'{$where} ORDER BY relname";\r
+ $sql = "SELECT c.relname, u.usename FROM pg_class c, pg_user u WHERE c.relowner=u.usesysid AND c.relkind = 'S'{$where} ORDER BY relname";\r
return $this->selectSet( $sql );\r
}\r
\r
+\r
+ function &getSequence($sequence) {\r
+ if (!$this->_showSystem) $where = " AND relname NOT LIKE 'pg_%'";\r
+ else $where = '';\r
+ $sql = "SELECT sequence_name as relname,* FROM $sequence"; \r
+ return $this->selectSet( $sql );\r
+ }\r
+\r
+/*\r
+ function setSequence()\r
+ function delSequence()\r
+*/\r
+\r
/**\r
* Adds a check constraint to a table\r
* @param $table The table to which to add the check\r
function setIndex()\r
function delIndex()\r
\r
- function &getSequences()\r
- function &getSequence()\r
- function setSequence()\r
- function delSequence()\r
\r
// DML Functions\r
\r
* Language template file for WebDB. Use this to base language
* files.
*
- * $Id: english.php,v 1.6 2002/09/23 06:11:39 chriskl Exp $
+ * $Id: english.php,v 1.7 2002/09/26 22:04:17 xzilla Exp $
*/
$appLang = 'english';
// Sequences
$strNoSequences = 'No sequences found.';
+ $strSequenceName = 'sequence_name';
+ $strLastValue = 'last_value';
+ $strIncrementBy = 'increment_by';
+ $strMaxValue = 'max_value';
+ $strMinValue = 'min_value';
+ $strCacheValue = 'cache_value';
+ $strLogCount = 'log_cnt';
+ $strIsCycled = 'is_cycled';
+ $strIsCalled = 'is_called';
// Tables
$strField = 'Field';
* FILENAME: sequence.php
* AUTHOR: Ray Hunter <rhunter@venticon.com>
*
- * $Id: sequences.php,v 1.3 2002/09/25 22:10:21 xzilla Exp $
+ * $Id: sequences.php,v 1.4 2002/09/26 22:04:18 xzilla Exp $
*/
include_once( '../conf/config.inc.php' );
if( $sequences->recordCount() > 0 )
{
echo "<table>\n";
- echo "<tr><th class=\"data\">{$strSequences}</th><th class=\"data\">{$strOwner}</th><th colspan=\"4\" class=\"data\">{$strActions}</th>\n";
+ echo "<tr><th class=\"data\">{$strSequences}</th><th class=\"data\">{$strOwner}</th><th colspan=\"3\" class=\"data\">{$strActions}</th>\n";
$i = 0;
while( !$sequences->EOF )
{
$id = ( ($i % 2 ) == 0 ? '1' : '2' );
- echo "<tr><td class=\"data{$id}\">", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "</td><td>Owner</td><td>Actions</td></tr>\n";
+ echo "<tr><td class=\"data{$id}\">", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "</td>";
+ echo "<td class=\"data{$id}\">", htmlspecialchars( $sequences->f[$data->sqFields['seqowner']]), "</td>";
+ echo "<td class=\"data{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=properties&database=", htmlspecialchars($_REQUEST['database']), "&sequence=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "\">Properties</a></td>\n";
+ echo "<td class=\"data{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=drop&database=", htmlspecialchars($_REQUEST['database']), "&sequence=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "\">Drop</td>\n";
+ echo "<td class=\"data{$id}\">";
+ echo "<a href=\"$PHP_SELF?action=priviledges&database=", htmlspecialchars($_REQUEST['database']), "&sequence=", htmlspecialchars( $sequences->f[$data->sqFields['seqname']]), "\">Privileges</td></tr>\n";
$sequences->movenext();
$i++;
}
-
echo "</table>\n";
}
else
}
// }}}
+ function doProperties($msg = '')
+ {
+ global $data, $localData, $misc, $PHP_SELF;
+ global $strSequences, $strSequenceName, $strLastValue, $strIncrementBy, $strMaxValue, $strMinValue, $strCacheValue, $strLogCount, $strIsCycled, $strIsCalled;
+
+ echo "<h2>", htmlspecialchars($_REQUEST['database']), ": $strSequences : ", htmlspecialchars($_REQUEST['sequence']), ": Properties</h2>\n";
+ $misc->printMsg($msg);
+
+ $sequence = &$localData->getSequence($_REQUEST['sequence']);
+
+
+ if ($sequence->recordCount() > 0) {
+
+ echo"<table border=0>";
+ echo "<tr><th class=\"data\">$strSequenceName</th><th class=\"data\">$strLastValue</th><th class=\"data\">$strIncrementBy</th><th class=\"data\">$strMaxValue</th><th class=\"data\">$strMinValue</th><th class=\"data\">$strCacheValue</th><th class=\"data\">$strLogCount</th><th class=\"data\">$strIsCycled</th><th class=\"data\">$strIsCalled</th></tr>";
+ echo "<tr>";
+ echo "<td class=\"data1\">", $sequence->f[$data->sqFields['seqname']], "</td>";
+ echo "<td class=\"data1\">", $sequence->f[$data->sqFields['lastvalue']], "</td>";
+ echo "<td class=\"data1\">", $sequence->f[$data->sqFields['incrementby']], "</td>";
+ echo "<td class=\"data1\"> 2147483647 </td>";
+ echo "<td class=\"data1\"> 1 </td>";
+ echo "<td class=\"data1\"> 1 </td>";
+ echo "<td class=\"data1\"> 0 </td>";
+ echo "<td class=\"data1\"> No </td>";
+ echo "<td class=\"data1\"> Yes </td>";
+ echo "</tr>";
+ echo "</table>";
+
+ }
+ else echo "<p>No data.</p>\n";
+ }
+
+
+ function doPrivileges()
+ {
+
+ }
+
+ function doDrop()
+ {
+
+ }
echo "<html>\n";
echo "<body>\n";
case 'create':
echo "<p>Creating sequence</p>";
break;
+ case 'properties':
+ doProperties();
+ break;
+ case 'drop':
+ doDrop();
+ break;
+ case 'privileges':
+ doPrivileges();
+ break;
default:
doDefault();
break;