* 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
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
* @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
/**\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
$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
* 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
--- /dev/null
+<?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