in reply to Re^4: help figuring out what a section of script does
in thread help figuring out what a section of script does

Do you have a copy of the database or just a dump file ?

If you have the database try this

#!perl use strict; use DBI; my $database = 'MapTiles.sqlitedb'; my $tablename = 'images'; # open db my $dbh = open_db($database); my $imgfolder = 'maptiles-output'; if (! -d $imgfolder){ mkdir($imgfolder, 0755) or die "$!"; } # select data my $sql = 'SELECT * from '.$tablename; my $sth = $dbh->prepare($sql); $sth->execute(); # recreate files while (my ($zoom, $x, $y, $flags, $length, $data) = $sth->fetchrow_arr +ay){ my $filename = "$imgfolder/$x,$y\@$zoom.png"; print "creating $filename\n"; open OUT,'>:raw',$filename or die "$filename : $!"; print OUT $data; close OUT; } # open db sub open_db { my $dbfile = shift; my $dbh = DBI->connect( "dbi:SQLite:dbname=$dbfile", "", "", { RaiseError => 1 } ) or die $DBI::errstr; return $dbh; }
Update : dbname = $dbfile corrected
poj