always show dbs for superuser. add without oids in create table
authorchriskl <chriskl>
Mon, 4 Aug 2003 08:27:27 +0000 (08:27 +0000)
committerchriskl <chriskl>
Mon, 4 Aug 2003 08:27:27 +0000 (08:27 +0000)
BUGS
HISTORY
TODO
classes/database/Postgres.php
classes/database/Postgres71.php
classes/database/Postgres72.php
classes/database/Postgres73.php
tables.php

diff --git a/BUGS b/BUGS
index ac40252ed02d406b59a733c61de84d504402878f..9f460a7163c33149173c181531299c5b080fa3a3 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -6,5 +6,4 @@
 * Add owner everywhere
 * Cancel/<Action> buttons everywhere
 * pg_dump feature!!!
-
-
+* Add default_db_encoding support to lang files and create database
diff --git a/HISTORY b/HISTORY
index a21dbe311a9a39433d949287ed42aeedd5555bda..dc6b3879bd1d9e6bc4f16dfc4499baba595da3c8 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -19,6 +19,7 @@ Version 3.1
 * Default database encoding for languages
 * Lots of NULL value in table dump fixes (XML format changed slightly)
 * Convert our images to PNG format
+* Allow creating tables WITHOUT OIDS
 
 Version 3.0
 -----------
diff --git a/TODO b/TODO
index 3e49d45c62df5f0d8d4b86681aaf11ecbb25106e..0aafbfee000cfe191bd4a9a7fb788a01f6fd2215 100644 (file)
--- a/TODO
+++ b/TODO
@@ -117,9 +117,9 @@ Miscellaneous
 Exotic
 ------
 
-* Support contrib/tsearch for easy full text indexes
+* Support contrib/tsearch2 for easy full text indexes
 * -Search for object feature (chriskl, half done)
-* Pivot reports
+* Pivot reports (ADODB has a feature for this)
 
 Principles
 ----------
index 67cd8078acef648359e891d1c39ddefaec3bc8e0..b10f1aea5241a687eb688a1e6d32c1cc7a2051fc 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.130 2003/07/31 08:28:03 chriskl Exp $
+ * $Id: Postgres.php,v 1.131 2003/08/04 08:27:27 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -200,7 +200,7 @@ class Postgres extends BaseDB {
        function &getDatabases() {
                global $conf;
 
-               if (isset($conf['owned_only']) && $conf['owned_only']) {
+               if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser($_SESSION['webdbUsername'])) {
                        $username = $_SESSION['webdbUsername'];
                        $this->clean($username);
                        $clause = " AND pu.usename='{$username}'";
@@ -595,13 +595,14 @@ class Postgres extends BaseDB {
         * @param $length An array of field lengths
         * @param $notnull An array of not null
         * @param $default An array of default values
+        * @param $withoutoids True if WITHOUT OIDS, false otherwise
         * @return 0 success
         * @return -1 no fields supplied
         */
-       function createTable($name, $fields, $field, $type, $length, $notnull, $default) {
+       function createTable($name, $fields, $field, $type, $length, $notnull, $default, $withoutoids) {
                // @@ NOTE: $default field not being cleaned - how on earth DO we clean it??
                $this->fieldClean($name);
-       
+
                $found = false;
                $sql = "CREATE TABLE \"{$name}\" (";
                
@@ -646,6 +647,10 @@ class Postgres extends BaseDB {
                
                $sql .= ")";
                
+               // WITHOUT OIDS
+               if ($this->hasWithoutOIDs() && $withoutoids)
+                       $sql .= ' WITHOUT OIDS';
+               
                return $this->execute($sql);
        }       
        
@@ -2084,7 +2089,7 @@ class Postgres extends BaseDB {
                                                CAST('public' AS TEXT) AS schemaname,
                                                CAST(NULL AS TEXT) AS relname,
                                                relname AS name,
-                                               relacl
+                                               NULL AS relacl
                                        FROM
                                                pg_class
                                        WHERE
@@ -2098,7 +2103,7 @@ class Postgres extends BaseDB {
                if (!is_object($acls)) return array();
                
                // RETURN FORMAT:
-               // ARRAY(type, schemaname, relname, name, ARRAY(privs), ARRAY(grantoptions))
+               // ARRAY(type, schemaname, relname, name, ARRAY(privs), grantor, ARRAY(grantoptions))
                
                // Loop over the results and check to see if any of the ACLs apply to the user
                $temp = array();
@@ -2106,25 +2111,27 @@ class Postgres extends BaseDB {
                        // If they own the table, then do an 'all privileges simulation'
                        if ($acls->f['relacl'] == null) {
                                $temp[] = array($acls->f['type'], $acls->f['schemaname'], $acls->f['relname'], $acls->f['name'],
-                                                                               array(), array());
+                                                                               array(), $username, array());
                        }
                        else {
                                $privs = $this->_parseACL($acls->f['relacl']);
+                               
                                // Loop over all privs to see if we're in there
                                foreach ($privs as $v) {
                                        // Skip non-user ACEs
                                        if ($v[0] != 'user') continue;
                                        // Skip entities that aren't us
-                                       if ($v[1] != $usernmae) continue;
+                                       if ($v[1] != $username) continue;
+                                       echo "<pre>", var_dump($v), "</pre>";
                                        // OK, so it's for us...
                                        $temp[] = array($acls->f['type'], $acls->f['schemaname'], $acls->f['relname'], $acls->f['name'],
-                                                                                       $v[2], $v[4]);
+                                                                                       $v[2], $v[3], $v[4]);
                                }
                        }
                        
                        $acls->moveNext();
                }
-
+echo "<pre>", var_dump($temp), "</pre>";
                return $temp;           
        }       
        
index 1d677f1cba04a9738000103f7838622070b09a48..f8e070c3854128842b6ebe210caaca8749eb274c 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres71.php,v 1.35 2003/05/20 05:43:46 chriskl Exp $
+ * $Id: Postgres71.php,v 1.36 2003/08/04 08:27:27 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -78,7 +78,7 @@ class Postgres71 extends Postgres {
        function &getDatabases() {
                global $conf;
 
-               if (isset($conf['owned_only']) && $conf['owned_only']) {
+               if (isset($conf['owned_only']) && $conf['owned_only'] && !$this->isSuperUser($_SESSION['webdbUsername'])) {
                        $username = $_SESSION['webdbUsername'];
                        $this->clean($username);
                        $clause = " AND pu.usename='{$username}'";
index 2880a52394c20e2a0ba93f55957b8a8c63c082bd..a91ec7e233faa5b4b8741dc0851ab453a9699c50 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres
  * Note: This class uses ADODB and returns RecordSets.
  *
- * $Id: Postgres72.php,v 1.46 2003/06/01 11:53:47 chriskl Exp $
+ * $Id: Postgres72.php,v 1.47 2003/08/04 08:27:27 chriskl Exp $
  */
 
 
@@ -276,6 +276,10 @@ class Postgres72 extends Postgres71 {
 
                return $this->execute($sql);
        }
+
+       // Capabilities
+       function hasWithoutOIDs() { return true; }
+
 }
 
 ?>
index 3b23a2813369e2fd20679f0e3dfb6946c4b052db..b94ba4ca27b2803f41dc34e4210a5743a2bad9a6 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.55 2003/08/04 05:20:02 chriskl Exp $
+ * $Id: Postgres73.php,v 1.56 2003/08/04 08:27:27 chriskl Exp $
  */
 
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???
@@ -1028,7 +1028,6 @@ class Postgres73 extends Postgres72 {
        function hasDropColumn() { return true; }
        function hasDomains() { return true; }
        function hasAlterTrigger() { return true; }
-       function hasWithoutOIDs() { return true; }
 
 }
 
index bff23d37d347fd4df6fbf8786d972452007d22f1..624efe08293e87cfe5ad32155f3fa7f2daa14e04 100644 (file)
@@ -3,7 +3,7 @@
        /**
         * List tables in a database
         *
-        * $Id: tables.php,v 1.27 2003/07/25 08:39:25 chriskl Exp $
+        * $Id: tables.php,v 1.28 2003/08/04 08:27:27 chriskl Exp $
         */
 
        // Include application functions
                                $misc->printMsg($msg);
                                
                                echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
-                               echo "<table width=\"100%\">\n";
+                               echo "<table>\n";
                                echo "<tr><th class=\"data\">{$lang['strname']}</th></tr>\n";
                                echo "<tr><td class=\"data1\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", 
                                        htmlspecialchars($_REQUEST['name']), "\" /></td></tr>\n";
                                echo "<tr><th class=\"data\">{$lang['strnumfields']}</th></tr>\n";
                                echo "<tr><td class=\"data1\"><input name=\"fields\" size=\"5\" maxlength=\"{$data->_maxNameLen}\" value=\"", 
                                        htmlspecialchars($_REQUEST['fields']), "\" /></td></tr>\n";
+                               if ($data->hasWithoutOIDs()) {
+                                       echo "<tr><th class=\"data\">{$lang['stroptions']}</th></tr>\n";
+                                       echo "<tr><td class=\"data1\"><input type=\"checkbox\" name=\"withoutoids\"", 
+                                               (isset($_REQUEST['withoutoids']) ? ' checked="checked"' : ''), ">WITHOUT OIDS\n";
+                                       echo "</td></tr>\n";
+                               }
                                echo "</table>\n";
-                               echo "<input type=\"hidden\" name=\"action\" value=\"create\" />\n";
+                               echo "<p><input type=\"hidden\" name=\"action\" value=\"create\" />\n";
                                echo "<input type=\"hidden\" name=\"stage\" value=\"2\" />\n";
                                echo $misc->form;
                                echo "<input type=\"submit\" value=\"{$lang['strnext']}\" />\n";
-                               echo "<input type=\"reset\" value=\"{$lang['strreset']}\" />\n";
+                               echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n";
                                echo "</form>\n";
                                break;
                        case 2:
                                echo $misc->form;
                                echo "<input type=\"hidden\" name=\"name\" value=\"", htmlspecialchars($_REQUEST['name']), "\" />\n";
                                echo "<input type=\"hidden\" name=\"fields\" value=\"", htmlspecialchars($_REQUEST['fields']), "\" />\n";
+                               if (isset($_REQUEST['withoutoids'])) {
+                                       echo "<input type=\"hidden\" name=\"withoutoids\" value=\"on\" />\n";
+                               }
                                echo "<input type=\"submit\" value=\"{$lang['strcreate']}\" />\n";
                                echo "<input type=\"reset\" value=\"{$lang['strreset']}\" /></p>\n";
                                echo "</form>\n";
                                }
                                
                                $status = $localData->createTable($_REQUEST['name'], $_REQUEST['fields'], $_REQUEST['field'],
-                                                               $_REQUEST['type'], $_REQUEST['length'], $_REQUEST['notnull'], $_REQUEST['default']);
+                                                               $_REQUEST['type'], $_REQUEST['length'], $_REQUEST['notnull'], $_REQUEST['default'],
+                                                               isset($_REQUEST['withoutoids']));
                                if ($status == 0) {
                                        $_reload_browser = true;
                                        doDefault($lang['strtablecreated']);