1 |
dpavlin |
14 |
#!/usr/bin/perl -w |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use blib; |
5 |
|
|
use Fuse::DBI; |
6 |
|
|
|
7 |
|
|
my $sql_filenames = q{ |
8 |
|
|
select |
9 |
|
|
concat(templateid,name) as id, |
10 |
|
|
concat(namespace,'/',name,'.html') as filename, |
11 |
|
|
length(template) as size, |
12 |
|
|
iseditable as writable |
13 |
|
|
from template ; |
14 |
|
|
}; |
15 |
|
|
|
16 |
|
|
my $sql_read = q{ |
17 |
|
|
select template |
18 |
|
|
from template |
19 |
|
|
where concat(templateid,name) = ?; |
20 |
|
|
}; |
21 |
|
|
|
22 |
|
|
my $sql_update = q{ |
23 |
|
|
update template |
24 |
|
|
set template = ? |
25 |
|
|
where concat(templateid,name) = ?; |
26 |
|
|
}; |
27 |
|
|
|
28 |
|
|
my $mount = shift || '/mnt2'; |
29 |
|
|
|
30 |
|
|
my $mnt = Fuse::DBI->mount({ |
31 |
|
|
filenames => $sql_filenames, |
32 |
|
|
read => $sql_read, |
33 |
|
|
update => $sql_update, |
34 |
|
|
dsn => 'DBI:mysql:dbname=webgui_knjiznice_ffzg_hr', |
35 |
|
|
user => 'webgui', |
36 |
|
|
password => 'webgui', |
37 |
|
|
mount => $mount, |
38 |
|
|
}); |
39 |
|
|
|
40 |
|
|
print "Press enter to exit..."; |
41 |
|
|
my $foo = <STDIN>; |
42 |
|
|
|
43 |
|
|
$mnt->umount; |