From e50524c3ec905e06143d463332066cee1f3b51f2 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Wed, 25 Feb 2004 05:26:46 +0000 Subject: [PATCH] Add real createdatabase() function for mssql - partial fix for 885687 --- phpgwapi/inc/class.db_mssql.inc.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/phpgwapi/inc/class.db_mssql.inc.php b/phpgwapi/inc/class.db_mssql.inc.php index c2fdd59818..8b98bf4581 100644 --- a/phpgwapi/inc/class.db_mssql.inc.php +++ b/phpgwapi/inc/class.db_mssql.inc.php @@ -371,5 +371,32 @@ { return False; } + function CreateDatabase($adminname='', $adminpasswd='') + { + $currentUser = $this->User; + $currentPassword = $this->Password; + $currentDatabase = $this->Database; + + if($adminname != '') + { + $this->User = $adminname; + $this->Password = $adminpasswd; + $this->Database = 'master'; + } + $this->disconnect(); + $outval = $this->query("CREATE DATABASE $currentDatabase"); + $this->disconnect(); + + if(!$outval) + { + echo 'Database creation failure
'; + echo 'please setup the MSSQL database manually
'; + } + + $this->User = $currentUser; + $this->Password = $currentPassword; + $this->Database = $currentDatabase; + $this->connect(); + } } ?>