From 5f95db7595147b41f22c19a4ed4d5c9491e542a4 Mon Sep 17 00:00:00 2001 From: Carsten Wolff <wolffc@alumni.egroupware.org> Date: Fri, 7 Nov 2003 17:32:32 +0000 Subject: [PATCH] do create_database the usual way and don't read the data of a whole table to get just the layout --- phpgwapi/inc/class.db_pgsql.inc.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/phpgwapi/inc/class.db_pgsql.inc.php b/phpgwapi/inc/class.db_pgsql.inc.php index 67397e53d8..a631ca217e 100644 --- a/phpgwapi/inc/class.db_pgsql.inc.php +++ b/phpgwapi/inc/class.db_pgsql.inc.php @@ -354,7 +354,7 @@ $res = array(); $this->connect(); - $id = pg_exec($this->Link_ID, "select * from $table"); + $id = pg_exec($this->Link_ID, "select * from $table where false"); if ($id < 0) { $this->Error = pg_ErrorMessage($id); @@ -515,18 +515,13 @@ { $this->User = $adminname; $this->Password = $adminpasswd; + $this->Database = "template1"; } + $this->disconnect(); + $outval = $this->query("CREATE DATABASE $currentDatabase;"); + $this->disconnect(); - if (! $this->Host) - { - system('createdb ' . $currentDatabase, $outval); - } - else - { - system('createdb -h ' . $this->Host . ' ' . $currentDatabase, $outval); - } - - if($outval != 0) + if(!$outval) { /* either the rights r not available or the postmaster is not running .... */ echo 'database creation failure <BR>'; @@ -537,7 +532,6 @@ $this->Password = $currentPassword; $this->Database = $currentDatabase; $this->connect(); - //return $return; } }