PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » MDB2_Schema » Bug #6416

dumpDatabase() and CURRENT_TIMESTAMP

Details

Submitted2006-01-05 11:27 UTC
Fromtvvcox at ossim dot net
Assignedlsmith
StatusClosed
PackageMDB2_Schema
PHP Version5.0.4
Roadmaps(Not assigned)

Comments

[2006-01-05 11:27 UTC] tvvcox at ossim dot net

Description:
------------
Dump and load fails on columns with DEFAULT CURRENT_TIMESTAMP (note. this is a need for timestamp columns in MySQL
http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html)

Test script:
---------------
<?php
/*
CREATE TABLE foo (
mytime timestamp DEFAULT CURRENT_TIMESTAMP
);
*/
ini_set('include_path', dirname(__FILE__) . '/include');
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());
?>

Actual result:
--------------
Parser error: "CURRENT_TIMESTAMP" is not of type "timestamp" - No error - Byte: 246; Line: 18; Col: 9