Problem creating tables from XML with MDB
| From: | Merritt, Dave | Date: | Fri, 11 Apr 2003 18:47:51 +0000 |
| Subject: | Problem creating tables from XML with MDB | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4806@lists.php.net to get a copy of this message | ||
All,
I'm getting the following error when I try to run code to create new tables
from an XML file using MDB:
Fatal error: Undefined class name 'mdb' in c:\pear\MDB\manager.php on line
269
The OOP stuff is new to me so I may be doing something wrong in my code, but
I copied the examples in the documentation. Any help would be appreciated.
Dave Merritt
dave.merritt@arvinmeritor.com
Here is the code I'm running:
<?php
require_once('MDB/manager.php');
$schema_file='test.xml';
$variables=array();
$manager=new MDB_manager;
$dbinfo = array
(
"phptype"=>'mysql',
"username"=>'myuser',
"password"=>'mypassword',
"hostspec"=>'localhost'
);
$manager->connect($dbinfo);
$success = $manager->updateDatabase($schema_file, $schema_file.".before");
if (MDB::isError($success))
{
die ($success->getMessage());
}
else
{
echo 'Good connection<br>';
}
if(count($manager->warnings)>0)
echo "WARNING:\n",implode($manager->getWarnings(),"!\n"),"\n";
?>
And, FWIW, here's the XML file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>pdmweb</name>
<create>1</create>
<table>
<name>users</name>
<declaration>
<field> <name>user_id</name> <type>integer</type>
<default>0</default> <notnull>1</notnull> </field>
<field> <name>user_name</name> <type>text</type>
</field>
<field> <name>password</name> <type>text</type>
</field>
<field> <name>reminder</name> <type>text</type>
</field>
<field> <name>name</name> <type>text</type> </field>
<field> <name>email</name> <type>text</type>
</field>
<index>
<name>users_id_index</name>
<unique>1</unique>
<field> <name>user_id</name> </field>
</index>
</declaration>
</table>
<sequence>
<name>user_id</name>
<start>1</start>
<on> <table>users</table> <field>user_id</field> </on>
</sequence>
<table>
<name>groups</name>
<declaration>
<field> <name>name</name> <type>text</type> </field>
<field> <name>owner_id</name> <type>text</type>
</field>
<field> <name>description</name> <type>text</type>
</field>
</declaration>
</table>
<table>
<name>group_users</name>
<declaration>
<field> <name>group_id</name> <type>text</type>
</field>
<field> <name>user_id</name> <type>text</type>
</field>
</declaration>
</table>
</database>