SYNOPSIS

  _\|_PACKAGE_\|_->load_components(qw/InflateColumn::FS Core/);
  _\|_PACKAGE_\|_->add_columns(
      id => {
          data_type         => 'INT',
          is_auto_increment => 1,
      },
      file => {
          data_type => 'TEXT',
          is_fs_column => 1,
          fs_column_path => '/var/lib/myapp/myfiles',
      },
      file_2 => {
          data_type => 'TEXT',
          is_fs_column => 1,
          fs_column_path => '/var/lib/myapp/myfiles',
          fs_new_on_update => 1
      },
  );
  _\|_PACKAGE_\|_->set_primary_key('id');

  # in application code
  $rs->create({ file => $file_handle });

  $row = $rs->find({ id => $id });
  my $fh = $row->file->open('r');

DESCRIPTION

Provides inflation to a Path::Class::File object allowing file system storage of \s-1BLOBS\s0.

The storage path is specified with \*(C`fs_column_path\*(C'. Each file receives a unique name, so the storage for all \s-1FS\s0 columns can share the same path.

Within the path specified by \*(C`fs_column_path\*(C', files are stored in sub-directories based on the first 2 characters of the unique file names. Up to 256 sub-directories will be created, as needed. Override \*(C`_fs_column_dirs\*(C' in a derived class to change this behavior.

\*(C`fs_new_on_update\*(C' will create a new file name if the file has been updated.

METHODS

inflate_result

register_column

fs_file_name

Provides the file naming algorithm. Override this method to change it.

This method is called with two parameters: The name of the column and the \*(C`column_info\*(C' object.

_fs_column_dirs

Returns the sub-directory components for a given file name. Override it to provide a deeper directory tree or change the algorithm.

copy

Copies a row object, duplicating the files backing fs columns.

delete

Deletes the associated file system storage when a row is deleted.

set_column

Deletes file storage when an fs_column is set to undef.

set_inflated_column

Re-inflates after setting an fs_column.

_inflate_fs_column

Inflates a file column to a Path::Class::File object.

_deflate_fs_column

Deflates a file column to its storage path name, relative to \*(C`fs_column_path\*(C'. In the database, a file column is just a place holder for inflation/deflation. The actual file lives in the file system.

table

Overridden to provide a hook for specifying the resultset_class. If you provide your own resultset_class, inherit from InflateColumn::FS::ResultSet.

SUPPORT

Community support can be found via:

Mailing list: http://lists.scsys.co.uk/mailman/listinfo/dbix-class/

IRC: irc.perl.org#dbix-class

The author is \*(C`semifor\*(C' on \s-1IRC\s0 and a member of the mailing list.

AUTHOR

semifor: Marc Mims <[email protected]>

CONTRIBUTORS

mst: Matt S. Trout <[email protected]>

mo: Moritz Onken <[email protected]>

norbi: Norbert Buchmuller <[email protected]>

LICENSE

You may distribute this code under the same terms as Perl itself.