Hi everybody,
I have a sqlite database compressed with bzip2. I need to do some query into database without unzip into a file but using only a memory buffer. I tried with this code but didn't work and I didn't understand why.use DBD::mysql; use Time::Local; use strict ; use warnings ; use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ; use IO::File ; my $input = shift; my $buffer ; bunzip2 $input => \$buffer, BinModeOut => 1 or die "bunzip2 failed: $B +unzip2Error\n"; opendb(\$buffer); exit; sub opendb { my $file = shift; my $dbsql = DBI->connect("dbi:SQLite:${file}", "", "", {RaiseEr +ror => 1, AutoCommit => 1}); my $sq_1; my $sh_1; $sq_1 = "select * from tbl_xxx"; $sh_1 = $dbsql->prepare($sq_1); $sh_1->execute(); while( my $field = $sh_1->fetchrow_hashref()) { print "$field->{'pos'},"; } print "\n"; }
Someone could help me.
Thanks you in advance.
pwp71In reply to How to do some query with sqlite.bz2 file by pwp71
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |