do create_database the usual way and don't read the data of a whole table to get just the layout

This commit is contained in:
Carsten Wolff 2003-11-07 17:32:32 +00:00
parent 369b9ede5e
commit 5f95db7595

View File

@ -354,7 +354,7 @@
$res = array(); $res = array();
$this->connect(); $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) if ($id < 0)
{ {
$this->Error = pg_ErrorMessage($id); $this->Error = pg_ErrorMessage($id);
@ -515,18 +515,13 @@
{ {
$this->User = $adminname; $this->User = $adminname;
$this->Password = $adminpasswd; $this->Password = $adminpasswd;
$this->Database = "template1";
} }
$this->disconnect();
$outval = $this->query("CREATE DATABASE $currentDatabase;");
$this->disconnect();
if (! $this->Host) if(!$outval)
{
system('createdb ' . $currentDatabase, $outval);
}
else
{
system('createdb -h ' . $this->Host . ' ' . $currentDatabase, $outval);
}
if($outval != 0)
{ {
/* either the rights r not available or the postmaster is not running .... */ /* either the rights r not available or the postmaster is not running .... */
echo 'database creation failure <BR>'; echo 'database creation failure <BR>';
@ -537,7 +532,6 @@
$this->Password = $currentPassword; $this->Password = $currentPassword;
$this->Database = $currentDatabase; $this->Database = $currentDatabase;
$this->connect(); $this->connect();
//return $return;
} }
} }