Problem with PEAR::MDB
| From: | Xavier Sosnowska | Date: | Sun, 15 Jun 2003 20:43:23 +0000 |
| Subject: | Problem with PEAR::MDB | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5971@lists.php.net to get a copy of this message | ||
Hello there,
I have a problem using the MDB_Manager to create a database schema from an
XML file. The XML file is well-formed according to xmllint but I could not
check for its validty as no schema is provided with the package.
The error message I get is:Error 1: MDB Error: MDB_manager schema parse
error, which leads me to thinking that there is an error in my schema.
The schema is:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>kobzar_webpim</name>
<create>1</create>
<table>
<name>glo_session</name>
<description>Table containing session information.</description>
<declaration>
<field>
<name>ses_id</name>
<type>text</type>
<length>32</length>
<default>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</default>
<notnull>1</notnull>
</field>
<field>
<name>ses_expire</name>
<type>integer</type>
<length>11</length>
<default>00000000000</default>
<notnull>1</notnull>
</field>
<field>
<name>ses_value</name>
<type>text</type>
<default>xxxxxxx</default>
<notnull>1</notnull>
</field>
<index>
<name>ses_ses_id_idx</name>
<unique>1</unique>
<field>
<name>ses_id</name>
</field>
</index>
<index>
<name>ses_ses_exp_idx</name>
<unique>0</unique>
<field>
<name>ses_expire</name>
</field>
</index>
</declaration>
</table>
</database>
The PHP file is:
<?php
ini_set('include_path', '/home/kobzar/phpext/PEAR/');
require_once('MDB.php');
MDB::loadFile("Manager");
$manager=new MDB_manager;
$schema_file = 'volyadb.xml';
$dsn = 'mysql://whatever:justkidding@localhost';
$manager->connect($dsn);
$success = $manager->updateDatabase($schema_file, $schema_file.".before");
if(MDB::isError($success)) {
echo "Error 1: ".$success->getMessage()."\n";
}
if(count($manager->warnings)>0) {
echo
"WARNING:\n",implode($manager->getWarnings(),"!\n"),"\n";
}
?>
Thanks in advance for any help you could provide.
Xavier