Export Data to XML compatibile with PHPUnit DataSet - maybe a future request?

[expired user #7804]'s profile image [expired user #7804] posted 10 years ago in General Permalink
Is there any possibility to export table data grid to xml which would be compatibile with PHPUnit DataSet format?

Such functionality would be very usefull for me, now I have to modify that XML to form:

<?xml version="1.0" ?>
<dataset>
<table name="guestbook">
<column>id</column>
<column>content</column>
<column>user</column>
<column>created</column>
<row>
<value>1</value>
<value>Hello buddy!</value>
<value>joe</value>
<value>2010-04-24 17:15:23</value>
</row>
<row>
<value>2</value>
<value>I like it!</value>
<null />
<value>2010-04-26 12:14:20</value>
</row>
</table>
</dataset>
ansgar's profile image ansgar posted 10 years ago Permalink
Have you tried out the right-click menu "Export grid data" ? There is a XML option in there which does it similar to how mysqldump does it with its xml option. I'm not sure if that matches PHPUnit format, but I think Heidi cannot support such specific DTDs if they're not widely spread and popular enough.
[expired user #7804]'s profile image [expired user #7804] posted 10 years ago Permalink
Fair enough,

but I have one suggestion: that xml from "Export grid data" could be more compatibile with MySQLDump:

- currently there is no root node with declaration of namespace "xsi", which is used to mark "null" fields,
- there is no "database" node, which is generated by mysqldump,
- there is no "table_structure" node, which is also generated by mysqldump.

The two last suggestions could be optional, and we can discuss if there is such need at all, but without proper declaration of namespace, current XML format is simply invalid.

And last but not least: ability to export data from more than one table to such XML file would be a cherry on the cake :)

Are there any chances to add above functionalities to my favorite MySQL tool smile

PS: sample mysqldump file, for one table
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="test">
<table_structure name="categories">
<field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" Comment="" />
<field Field="id_rand" Type="int(11)" Null="NO" Key="PRI" Extra="" Comment="" />
...
<key Table="categories" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="16" Null="" Index_type="BTREE" Comment="" Index_comment="" />
<key Table="categories" Non_unique="0" Key_name="PRIMARY" Seq_in_index="2" Column_name="id_rand" Collation="A" Cardinality="16" Null="" Index_type="BTREE" Comment="" Index_comment="" />
...
<options Name="categories" Engine="InnoDB" Version="10" Row_format="Compact" Rows="16" Avg_row_length="1024" Data_length="16384" Max_data_length="0" Index_length="65536" Data_free="0" Auto_increment="17" Create_time="2014-02-21 11:42:49" Collation="utf8_polish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="categories">
<row>
<field name="id">1</field>
<field name="last_change">2014-02-08 23:03:49</field>
...
</row>
<row>
...
</row>	
</table_data>
</database>
</mysqldump>
ansgar's profile image ansgar posted 10 years ago Permalink
Multiple table exports are done in a different dialog, the SQL export dialog, which has no XML option at all (otherwise it would not be named "SQL export"). But I guess I should at least make the grid XML export valid and - if possible - include table structure. Would that in any way help your needs or is that just a thing for being more complete?
[expired user #7804]'s profile image [expired user #7804] posted 10 years ago Permalink
It would be very helpful for me. I could then use this XML for my tests without any additional processing.

Could you make it MysqlDump compatibile? (the name of the root node etc.)
I suppose it could be helpful for many people. There are many tools which can work on MysqlDumps result files.

Please login to leave a reply, or register at first.