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 » Bug #1629

Reverse MySQL XML Schema Doesn't Work

Details

Submitted2004-06-13 23:30 UTC
Fromtzajonc at ksg dot harvard dot edu
Assignedlsmith
StatusClosed
PackageMDB2
PHP Version4.3.7
OSRH 7.2
Roadmaps(Not assigned)

Comments

[2004-06-13 23:30 UTC] tzajonc at ksg dot harvard dot edu

Description:
------------
Running reverse_engineer_xml_schema.php breaks if you add and index to a field in mysql.

Without indexes things seem to work fine. Running mysql 3.23.

Expected result:
----------------
Nice pretty xml schema

Actual result:
--------------
Here is the output I get when I put an Index on the UserID field.

Class name String[10] (pear_error)
Parent class Boolean (FALSE)
Class vars Array(7)

+ error_message_prefix String[0] ()
| mode Long (1)
| level Long (1024)
| code Long (-1)
| message String[0] ()
| userinfo String[0] ()
+ backtrace Null (Null)

Class methods Array(11)

+ 0 String[10] (pear_error)
| 1 String[7] (getmode)
| 2 String[11] (getcallback)
| 3 String[10] (getmessage)
| 4 String[7] (getcode)
| 5 String[7] (gettype)
| 6 String[11] (getuserinfo)
| 7 String[12] (getdebuginfo)
| 8 String[12] (getbacktrace)
| 9 String[11] (adduserinfo)
+ 10 String[8] (tostring)

Object vars Array(8)

+ error_message_prefix String[0] ()
| mode Long (1)
| level Long (1024)
| code Long (-1)
| message String[25] (MDB2 Error: unknown error)
| userinfo String[87] ([Error message: getTableIndexDefinition: it was not specified an existing table index])
| backtrace Array(6)
|
| + 0 Array(6)
| |
| | + file String[24] (/usr/share/pear/PEAR.php)
| | | line Long (538)
| | | function String[10] (pear_error)
| | | class String[10] (pear_error)
| | | type String[2] (->)
| | + args Array(5)
| | |
| | | + 0 String[25] (MDB2 Error: unknown error)
| | | | 1 Long (-1)
| | | | 2 Long (1)
| | | | 3 Long (1024)
| | | + 4 String[87] ([Error message: getTableIndexDefinition: it was not specified an existing table index])
| | |
| |
| | 1 Array(6)
| |
| | + file String[24] (/usr/share/pear/MDB2.php)
| | | line Long (1080)
| | | function String[10] (raiseerror)
| | | class String[4] (pear)
| | | type String[2] (::)
| | + args Array(5)
| | |
| | | + 0 String[25] (MDB2 Error: unknown error)
| | | | 1 Long (-1)
| | | | 2 Null (Null)
| | | | 3 Null (Null)
| | | + 4 String[87] ([Error message: getTableIndexDefinition: it was not specified an existing table index])
| | |
| |
| | 2 Array(6)
| |
| | + file String[45] (/usr/share/pear/MDB2/Driver/Reverse/mysql.php)
| | | line Long (320)
| | | function String[10] (raiseerror)
| | | class String[17] (mdb2_driver_mysql)
| | | type String[2] (->)
| | + args Array(4)
| | |
| | | + 0 Long (-1)
| | | | 1 Null (Null)
| | | | 2 Null (Null)
| | | + 3 String[69] (getTableIndexDefinition: it was not specified an existing table index)
| | |
| |
| | 3 Array(6)
| |
| | + file String[38] (/usr/share/pear/MDB2/Tools/Manager.php)
| | | line Long (1674)
| | | function String[23] (gettableindexdefinition)
| | | class String[25] (mdb2_driver_reverse_mysql)
| | | type String[2] (->)
| | + args Array(2)
| | |
| | | + 0 String[4] (test)
| | | + 1 String[6] (UserID)
| | |
| |
| | 4 Array(6)
| |
| | + file String[38] (/usr/share/pear/MDB2/Tools/Manager.php)
| | | line Long (1783)
| | | function String[25] (getdefinitionfromdatabase)
| | | class String[18] (mdb2_tools_manager)
| | | type String[2] (->)
| | + args Empty array ()
| |
| + 5 Array(6)
| |
| | + file String[56] (/www/fuzzymerge.com/html/reverse_engineer_xml_schema.php)
| | | line Long (101)
| | | function String[12] (dumpdatabase)
| | | class String[18] (mdb2_tools_manager)
| | | type String[2] (->)
| | + args Array(2)
| | |
| | | + 0 Array(2)
| | | |
| | | | + output_mode String[4] (file)
| | | | + output String[14] (/tmp/test3.xml)
| | | |
| | | + 1 Long (1)
| | |
| |
|
+ callback Null (Null)

Debug messages
query(1): SHOW TABLES
query(1): SHOW COLUMNS FROM test
query(1): SHOW COLUMNS FROM test
query(1): SHOW COLUMNS FROM test
query(1): SHOW COLUMNS FROM test
query(1): SHOW INDEX FROM test
query(1): SHOW INDEX FROM test

Database structure

name String[10] (fuzzymerge)
create Long (1)
tables Array(1)

+ test Array(2)
|
| + fields Array(3)
| |
| | + UserID Array(4)
| | |
| | | + type String[7] (integer)
| | | | notnull Boolean (TRUE)
| | | | default String[1] (0)
| | | + length String[1] (9)
| | |
| | | FirstName Array(3)
| | |
| | | + type String[4] (text)
| | | | notnull Boolean (TRUE)
| | | + length String[2] (50)
| | |
| | + Birthday Array(3)
| | |
| | | + type String[9] (timestamp)
| | | | notnull Boolean (TRUE)
| | | + default String[19] (0000-00-00 00:00:00)
| | |
| |
| + indexes Empty array ()
|

[2004-06-14 08:38 UTC] smith at backendmedia dot com

are you using the latest version of MDB2? There were some fixes for this stuff in 2.0.0beta2.

[2004-06-14 12:47 UTC] tzajonc at ksg dot harvard dot edu

Yes I'm running 2.0.0Beta2, mysql 3.32.58, php 4.3.6.

Here is the table that breaks:

CREATE TABLE test (
UserID mediumint(9) NOT NULL default '0',
FirstName varchar(50) NOT NULL default '',
Birthday datetime NOT NULL default '0000-00-00 00:00:00',
KEY UserID (UserID)
) TYPE=MyISAM;

Without the Key UserID things seem to work fine. There appears to be an issue with the getTableIndexDefinition method.

[2004-06-14 13:01 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.