# perldoc > DBD::SQLite::VirtualTable::FileContent

---
type: CommandReference
command: DBD::SQLite::VirtualTable::FileContent
mode: perldoc
section: 
source: perldoc
---

## Quick Reference
- `CREATE VIRTUAL TABLE tbl USING fcontent(source=src_table, content_col=content, path_col=path, expose="*", root="/dir", get_content="My::func")` — create a virtual table that exposes file contents alongside source columns
- `SELECT path, content FROM tbl WHERE ...` — query the virtual table to get file paths and their contents
- `$dbh->sqlite_create_module(fcontent => "DBD::SQLite::VirtualTable::FileContent")` — register the module in Perl

## Name
DBD::SQLite::VirtualTable::FileContent — virtual table for viewing file contents

## Synopsis
perl
$dbh->sqlite_create_module(fcontent => "DBD::SQLite::VirtualTable::FileContent");
sql
CREATE VIRTUAL TABLE tbl USING fcontent(
   source      = src_table,
   content_col = content,
   path_col    = path,
   expose      = "path, col1, col2, col3",  -- or "*"
   root        = "/foo/bar",
   get_content = Foo::Bar::read_from_file
);

SELECT col1, path, content FROM tbl WHERE ...;
## Description
A "FileContent" virtual table is bound to an underlying *source table* that has a column containing paths to files. The virtual table behaves like a database view on the source table, with an added column exposing the content from those files. This is especially useful as an "external content" for a fulltext table (see [DBD::SQLite::Fulltext_search](DBD::SQLite::Fulltext_search)).

## Options (Parameters)
Parameters are specified within the `CREATE VIRTUAL TABLE` statement using `=` syntax.

- `source` — (mandatory) Name of the source table.
- `content_col` — Name of the virtual column exposing file contents. Default: `"content"`.
- `path_col` — Name of the column in the source table that contains file paths. Default: `"path"`.
- `expose` — Comma-separated list of source column names to expose. Default: `"*"` (all columns).
- `root` — Optional root directory prepended to the `path` column when opening files.
- `get_content` — Fully qualified name of a Perl function for reading file contents. Default: slurps entire file. The function is called as: `$file_content = $get_content->($path, $root)`.

## Examples
See the Synopsis for a complete example of creating and querying the virtual table.

## See Also
- [DBD::SQLite::Fulltext_search](DBD::SQLite::Fulltext_search) — fulltext search with external content
- [DBD::SQLite](DBD::SQLite) — base module