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

Bug #17037 'on update' not mentioned in tableInfo()
Submitted: 2010-01-27 03:23 UTC
From: attila Assigned: quipo
Status: Closed Package: MDB2_Driver_mysqli (version 1.4.1)
PHP Version: 5.2.1 OS: Kubuntu 9.10
Roadmaps: (Not assigned)    
Subscription  


 [2010-01-27 03:23 UTC] attila (Attila Houtkooper)
Description: ------------ Not all information on a table is returned when callin tableInfo($tableName) or getTableFieldDefinition($tableName, $fieldName) The following field definition in SQL: `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP Results in the following output for either tableInfo or getTableFieldDefinition: array(7) { ["notnull"]=> bool(true) ["nativetype"]=> string(9) "timestamp" ["default"]=> string(17) "CURRENT_TIMESTAMP" ["type"]=> string(9) "timestamp" ["mdb2type"]=> string(9) "timestamp" ["table"]=> string(4) "stip" ["flags"]=> string(35) " not_null default_CURRENT_TIMESTAMP" } which doesn't mention the on update at all! After some digging, it turns out that the blame lies in http://pear.php.net/package/MDB2_Driver_mysqli/docs/1.4.1/__filesource/fsource_MDB2__MDB2_Driver_mysqli-1.4.1MDB2DriverReversemysqli.php.html#a137 $query = "SHOW COLUMNS FROM $table LIKE ".$db->quote($field_name); The relevant info is gotten by querying the information_schema table: $query = "SELECT * FROM `information_schema` WHERE `table_name`= $table" AND `table_schema`=$db->database_name; Can somebody fix this please? This is really annoying, because I was using this method myself, but need to translate the native datatypes to mdb2 datatypes using $db->datatype->mapNativeDatatype which shouldn't be necessary.

Comments

 [2010-02-01 02:48 UTC] quipo (Lorenzo Alberton)
-Status: Open +Status: Closed -Assigned To: +Assigned To: quipo
This bug has been fixed in SVN. 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. MDB2 retrieves Foreign key definitions from the SHOW CREATE TABLE statement, but there's a bug [1] in MySQL that strips the ON UPDATE info from the CREATE TABLE statement. [1] http://bugs.mysql.com/bug.php?id=27009 The INFORMATION_SCHEMA information isn't good either, because it always reports "RESTRICT" for the ON UPDATE clauses...
 [2010-02-01 02:52 UTC] quipo (Lorenzo Alberton)
Er... ignore the comment above. The bug has been fixed, the 'on update' info is returned in the 'extra' return value, when appropriate.