+ sudo umount /mnt2 || exit 0
./fuse_dbi.pl /mnt2
sudo umount /mnt2
./fuse_dbi.pl /mnt2
sudo umount /mnt2
+
+test:
+ psql -q -t -A -c "select template from template where oid=3035699" webgui > foo
my $sql_filenames = q{
select
my $sql_filenames = q{
select
- templateid as id,
- namespace||'/'||name||' ['||templateid||']' as filename,
+ oid as id,
+ namespace||'/'||name||' ['||oid||']' as filename,
length(template) as size,
iseditable as writable
from template ;
length(template) as size,
iseditable as writable
from template ;
my $sql_content = q{
select template
from template
my $sql_content = q{
select template
from template
sub e_open {
# VFS sanity check; it keeps all the necessary state, not much to do here.
my ($file) = filename_fixup(shift);
sub e_open {
# VFS sanity check; it keeps all the necessary state, not much to do here.
my ($file) = filename_fixup(shift);
- print("open called\n");
return -ENOENT() unless exists($files{$file});
return -EISDIR() unless exists($files{$file}{id});
if (!exists($files{$file}{cont})) {
$sth_content->execute($files{$file}{id});
return -ENOENT() unless exists($files{$file});
return -EISDIR() unless exists($files{$file}{id});
if (!exists($files{$file}{cont})) {
$sth_content->execute($files{$file}{id});
- ($files{$file}{cont}) = $sth_content->fetchrow_array;
+ $files{$file}{cont} = $sth_content->fetchrow_array;
+ print "open '$file' ",length($files{$file}{cont})," bytes\n";
- # return an error numeric, or binary/text string. (note: 0 means EOF, "0" will
- # give a byte (ascii "0") to the reading program)
+ # return an error numeric, or binary/text string.
+ # (note: 0 means EOF, "0" will give a byte (ascii "0")
+ # to the reading program)
my ($file) = filename_fixup(shift);
my ($buf,$off) = @_;
my ($file) = filename_fixup(shift);
my ($buf,$off) = @_;
return -ENOENT() unless exists($files{$file});
return -ENOENT() unless exists($files{$file});
- return -EINVAL() if $off > length($files{$file}{cont});
- return 0 if $off == length($files{$file}{cont});
+
+ my $len = length($files{$file}{cont});
+
+ print "read '$file' [$len bytes] offset $off length $buf\n";
+
+ return -EINVAL() if ($off > $len);
+ return 0 if ($off == $len);
+
+ $buf = $len-$off if ($off+$buf > $len);
+
return substr($files{$file}{cont},$off,$buf);
}
return substr($files{$file}{cont},$off,$buf);
}