bash script to create xml from mysql query - out of memory

OggyMorowse

New Member
i need to generate an xml file from database records, and i get the error out of memory...here's the script i am using, it's found on google, and it's not suitable for me...and it's also killing the server allocated memory... (but it's a beginning) #!/usr/bin/perl\[code\]use warnings;use strict;use XML::Simple;use DBI;my $dbh = DBI->connect('DBI:mysql:db_name;host=host_address','db_user','db_pass') or die DBI->errstr;# Get an array of hashesmy $recs = $dbh->selectall_arrayref('SELECT * FROM my_table',{ Columns => {} });# Convert to XML where each hash element becomes an XML elementmy $xml = XMLout( {record => $recs}, NoAttr => 1 );print $xml;$dbh->disconnect;\[/code\]this script only print the records, because i tested with an where clause for a single row id...first of all i couldn't manage to make it to save the output to a file.xml (i have no idea how to do it)second, i need somehow to split the "job" in multiple jobs and then put together the xml file all in one piece. (i have no idea, and couldn't find any info on google)thanks for all your answers in advance!PS: i don't have access to change server settings :(
 
Back
Top