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

Yes, that is correct. I'm going to try SQL::Parser instead of the manual decoding and see how that goes

  • Comment on Re^4: help figuring out what a section of script does

Replies are listed 'Best First'.
Re^5: help figuring out what a section of script does
by poj (Abbot) on Mar 21, 2017 at 14:18 UTC

    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