1DBD::SQLite::VirtualTabUlsee:r:FCiolnetCroinbtuetnetdD(B3PD)e:r:lSQDLoictuem:e:nVtiarttiuoanlTable::FileContent(3)
2
3
4

NAME

6       DBD::SQLite::VirtualTable::FileContent -- virtual table for viewing
7       file contents
8

SYNOPSIS

10       Within Perl :
11
12         $dbh->sqlite_create_module(fcontent => "DBD::SQLite::VirtualTable::FileContent");
13
14       Then, within SQL :
15
16         CREATE VIRTUAL TABLE tbl USING fcontent(
17            source      = src_table,
18            content_col = content,
19            path_col    = path,
20            expose      = "path, col1, col2, col3", -- or "*"
21            root        = "/foo/bar"
22            get_content = Foo::Bar::read_from_file
23           );
24
25         SELECT col1, path, content FROM tbl WHERE ...;
26

DESCRIPTION

28       A "FileContent" virtual table is bound to some underlying source table,
29       which has a column containing paths to files.  The virtual table
30       behaves like a database view on the source table, with an added column
31       which exposes the content from those files.
32
33       This is especially useful as an "external content" to some fulltext
34       table (see DBD::SQLite::Fulltext_search) : the index table stores some
35       metadata about files, and then the fulltext engine can index both the
36       metadata and the file contents.
37

PARAMETERS

39       Parameters for creating a "FileContent" virtual table are specified
40       within the "CREATE VIRTUAL TABLE" statement, just like regular column
41       declarations, but with an '=' sign.  Authorized parameters are :
42
43       "source"
44           The name of the source table.  This parameter is mandatory. All
45           other parameters are optional.
46
47       "content_col"
48           The name of the virtual column exposing file contents.  The default
49           is "content".
50
51       "path_col"
52           The name of the column in "source" that contains paths to files.
53           The default is "path".
54
55       "expose"
56           A comma-separated list (within double quotes) of source column
57           names to be exposed by the virtual table. The default is "*", which
58           means all source columns.
59
60       "root"
61           An optional root directory that will be prepended to the path
62           column when opening files.
63
64       "get_content"
65           Fully qualified name of a Perl function for reading file contents.
66           The default implementation just slurps the entire file into a
67           string; but this hook can point to more sophisticated
68           implementations, like for example a function that would remove html
69           tags. The hooked function is called like this :
70
71             $file_content = $get_content->($path, $root);
72

AUTHOR

74       Laurent Dami <dami@cpan.org>
75
77       Copyright Laurent Dami, 2014.
78
79       This library is free software; you can redistribute it and/or modify it
80       under the same terms as Perl itself.
81
82
83
84perl v5.30.1                      2020D-B0D2:-:0S4QLite::VirtualTable::FileContent(3)
Impressum