XML::EasySQL 1.2 review
Download
|
|
XML::EasySQL is a two-way SQL/XML base class for Perl.
SYNOPSIS
...
# fetch a database row as hash ref
my $data = $db->selectrow_hashref('select * from users where id = 2');
# init the new EasySQL data object
my $data_object = EasySqlChildClass->new({data=>$data});
# get the root XML element
my $xml = $data_object->getXML();
# make changes to the XML document
$xml->username->setString('curtisleefulton');
$xml->bio->setAttr('age', 22);
$xml->bio->city->setString('Portland');
$xml->history->access->setAttr('last', time());
# output entire XML doc as string to STDOUT
print $xml->getDomObj->toString();
# update the database
my $sql = $data_object->getSQL();
my $q = "update users set ".$sql->{users}." where id = 2";
$db->do($q);
Here are some key features of "XML EasySQL":
Two-way transforms between XML and SQL data
smart SQL updates: only altered tables are updated
unlimited tree depth
multiple SQL tables can merge intone XML tree, then back again
precise control over how data is translated
offers either an easy XML interface or plain DOM
database independent
Requirements:
Perl
XML::EasySQL 1.2 keywords