PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2_Schema » Bug #6401

dumpDatabase() and primary keys

Details

Submitted2006-01-03 08:36 UTC
Fromtvvcox at ossim dot net
Assignedlsmith
StatusClosed
PackageMDB2_Schema
PHP Version5.0.4
OSLinux
Roadmaps(Not assigned)

Comments

[2006-01-03 08:36 UTC] tvvcox at ossim dot net

Description:
------------
Dump and load fails on primary keys

Test script:
---------------
<?php
/*
CREATE TABLE foo (
id int NOT NULL auto_increment,
PRIMARY KEY (id)
);
*/
require_once 'MDB2/Schema.php';
$dsn = 'mysql://root@localhost/test';
$tmp_file = './test.xml';

$schema =& MDB2_Schema::factory($dsn);
$conf = array('output_mode' => 'file', 'output' => $tmp_file);
// write the xml schema
$schema->dumpDatabase($conf, MDB2_SCHEMA_DUMP_STRUCTURE);
// try to load the schema
$ret = $schema->parseDatabaseDefinitionFile($tmp_file);
if (PEAR::isError($ret)) die($ret->getUserInfo());
?>

Expected result:
----------------
Load the schema it has generated

Actual result:
--------------
Parser error: an index needs a name - No error - Byte: 410; Line: 28; Col: 9

The index dump:

<index>
<name>0</name>
<primary>true</primary>
<field>
<name>id</name>
<sorting>ascending</sorting>
</field>
</index>