Added tables.php to act as an example of how to implement. Needed to create a localD...
authorchriskl <chriskl>
Tue, 12 Feb 2002 08:50:26 +0000 (08:50 +0000)
committerchriskl <chriskl>
Tue, 12 Feb 2002 08:50:26 +0000 (08:50 +0000)
classes/database/Postgres71.php
conf/config.inc.php
lang/template.php
public_html/tables.php [new file with mode: 0644]

index 86bf0330acaa4a0d90a3808dfce4caea52362db4..a0f80728af4855f2be2509e0891f84296e915e0c 100644 (file)
@@ -4,7 +4,7 @@
  * A class that implements the DB interface for Postgres\r
  * Note: This class uses ADODB and returns RecordSets.\r
  *\r
- * $Id: Postgres71.php,v 1.2 2002/02/12 06:55:03 chriskl Exp $\r
+ * $Id: Postgres71.php,v 1.3 2002/02/12 08:50:26 chriskl Exp $\r
  */\r
 \r
 // @@@ THOUGHT: What about inherits? ie. use of ONLY???\r
@@ -14,6 +14,7 @@ include_once('../classes/database/BaseDB.php');
 class Postgres71 extends BaseDB {\r
 \r
        var $dbFields = array('dbname' => 'datname', 'dbcomment' => 'description');\r
+       var $tbFields = array('tbname' => 'relname', 'tbowner' => 'relowner');\r
 \r
        function Postgres71($host, $port, $database, $user, $password) {\r
                $this->BaseDB('postgres7');\r
@@ -63,7 +64,7 @@ class Postgres71 extends BaseDB {
         * @return All tables, sorted alphabetically \r
         */\r
        function &getTables() {\r
-               $sql = "SELECT * FROM pg_class ORDER BY relname";\r
+               $sql = "SELECT relname, relowner FROM pg_class ORDER BY relname";\r
                return $this->selectSet($sql);\r
        }\r
 \r
index 7a4ce9f9d8b8f5f88198b51a5a8a3685570efb8a..b1a3734d3e0fd0d4c67ba7bd783827a449972c59 100644 (file)
@@ -3,7 +3,7 @@
        /**\r
         * Central WebDB configuration\r
         *\r
-        * $Id: config.inc.php,v 1.2 2002/02/12 06:57:33 chriskl Exp $\r
+        * $Id: config.inc.php,v 1.3 2002/02/12 08:50:26 chriskl Exp $\r
         */\r
 \r
        // Set error reporting level\r
@@ -13,7 +13,7 @@
        $appName = 'WebDB';\r
        $appIntro = 'Welcome to WebDB.';\r
        $appBase = '../public_html';\r
-       $appVersion = '1-dev';\r
+       $appVersion = '0.1-dev';\r
        \r
        // GUI settings\r
        $guiLeftFrameWidth = 150;\r
                                                                        $webdbPassword);\r
        }\r
 \r
+       // Create local (database-specific) data accessor object, if valid\r
+       if (isset($webdbServerID) && isset($confServers[$webdbServerID]) && isset($database)) {\r
+               $_type = $confServers[$webdbServerID]['type'];\r
+               include_once('../classes/database/' . $_type . '.php');\r
+               $localData = new $_type(        $confServers[$webdbServerID]['host'],\r
+                                                                                       $confServers[$webdbServerID]['port'],\r
+                                                                                       $database,\r
+                                                                                       $webdbUsername,\r
+                                                                                       $webdbPassword);\r
+       }\r
 \r
        \r
 \r
index a819a5f81a72fe56c19ad2b8728d42f86958c73f..893928324d1fc99fd7fdb44396babb01463288c6 100644 (file)
@@ -4,13 +4,14 @@
         * Language template file for WebDB.  Use this to base language\r
         * files.\r
         *\r
-        * $Id: template.php,v 1.1 2002/02/11 09:32:49 chriskl Exp $\r
+        * $Id: template.php,v 1.2 2002/02/12 08:50:26 chriskl Exp $\r
         */\r
 \r
        $appLang = 'english';\r
 \r
        $strNoFrames = 'You need a frames-enabled browser to use this application.';\r
        $strLogin = 'Login';\r
+       $strNoTables = 'No tables found.';\r
        \r
        \r
 ?>
\ No newline at end of file
diff --git a/public_html/tables.php b/public_html/tables.php
new file mode 100644 (file)
index 0000000..cddf22b
--- /dev/null
@@ -0,0 +1,35 @@
+<?php\r
+\r
+       /**\r
+        * List tables in a database\r
+        *\r
+        * $Id: tables.php,v 1.1 2002/02/12 08:51:08 chriskl Exp $\r
+        */\r
+\r
+       // Include application functions\r
+       include_once('../conf/config.inc.php');\r
+\r
+       $tables = &$localData->getTables();\r
+?>\r
+\r
+<html>\r
+<body>\r
+\r
+<h1><?= $appName ?></h1>\r
+<?php\r
+\r
+       if ($tables->recordCount() > 0) {\r
+               echo "<table>\n";\r
+               while (!$tables->EOF) {\r
+                       echo "<tr><td>", htmlspecialchars($tables->f[$data->tbFields['tbname']]), "</td></tr>\n";\r
+                       $tables->moveNext();\r
+               }\r
+       }\r
+       else {\r
+               echo "<p>{$strNoTables}</p>\n";\r
+       }\r
+       \r
+       \r
+?>\r
+</body>\r
+</html>
\ No newline at end of file