Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Bug #6416 dumpDatabase() and CURRENT_TIMESTAMP
Submitted: 2006-01-05 11:27 UTC
From: tvvcox at ossim dot net Assigned: lsmith
Status: Closed Package: MDB2_Schema
PHP Version: 5.0.4 OS:
Roadmaps: (Not assigned)    
Subscription  


 [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

Comments

 [2006-01-05 12:15 UTC] lsmith
This one is tricky. Fixing the schema parser is one necessary step. Another one is handling function calls in the relevant places in the code (default, initialization). This particular function is also hard to detect generically since it does not require parenthesis.
 [2006-03-21 09:43 UTC] lsmith (Lukas Smith)
I have made some additions to MDB2_Schema and MDB2 though I need to test them some more.
 [2006-03-23 13:25 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Note however that mysql will not support creating columns with default values like CURRENT_* since MDB2 uses datetime and not timestamp.