<?php
try
{
include_once("connection.inc.php");
include_once("mysql_database.inc.php");
$db = DBFactory::CreateDatabaseObject("MySqlDatabase");
$db->Connect($server, $database, $username, $password);
$db->Begin();
$db->Execute("
CREATE TABLE `person` (
`id` int(10) unsigned NOT NULL auto_increment,
`last_name` varchar(20) NOT NULL default '',
`first_name` varchar(20) NOT NULL default '',
`street_address` varchar(64) NOT NULL default '',
`city` varchar(20) NOT NULL default '',
`country` varchar(20) NOT NULL default '',
`zip` varchar(5) NOT NULL default '',
PRIMARY KEY(`id`),
UNIQUE KEY `unique_name` (`last_name`,`first_name`)
) ENGINE=InnoDB");
$db->Commit();
echo "Table test.person created.";
}
catch (Exception $ex)
{
$db->Rollback();
echo "Exception Caught: " . $ex->getMessage() .
"<p>Trace: " . $ex->getTraceAsString() . "</p>";
}
?>
|