Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by michaelsingleton (Novice)
on Mar 21, 2017 at 13:08 UTC ( [id://1185350]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1185350]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2026-03-07 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.