Mysql - Select To XML I'm using a trigger to capture an audit trail. I want to convert the inserted / updated / deleted value to XML and store it in another table.

My trigger look like this:

DELIMITER $$

CREATE
    TRIGGER `MyDB`.`TriggerAudit` AFTER INSERT
    ON `MyDB`.`settings`
    FOR EACH ROW BEGIN
    INSERT INTO insert_audit_trail (user_uid, table_name, inserted_value) 
    VALUES ('the Username', 'the table name', 'Select to XML In Here')
    END$$

DELIMITER ;


In MS SQL Server I can use the FOR XML clause, but I don't know to do this in MySQL. Is there any solution for this?
It appears this has already been answered here.

The answer references this article.

From the answer:


  From the article:

use strict;
use DBI;
use XML::Generator::DBI;
use XML::Handler::YAWriter;

my $dbh = DBI-&gt;connect ("DBI:mysql:test",
                       "testuser", "testpass",
                       { RaiseError =&gt; 1, PrintError =&gt; 0});
my $out = XML::Handler::YAWriter-&gt;new (AsFile =&gt; "-");
my $gen = XML::Generator::DBI-&gt;new (
                               Handler =&gt; $out,
                               dbh =&gt; $dbh
                           );
$gen-&gt;execute ("SELECT name, category FROM animal");
$dbh-&gt;disconnect ();