NAME

Table::Denormalized::Manager - base class for creating and maintaining dynamic tables

SYNOPSIS

This package provides a convenience constructor for creating or altering a denormalized table. The arguments are discussed below.

  package My::Index;
  use base 'Table::Denormalized::Manager';

  # ... time passes

  package main;

  my $idx = My::Index->new({
      dsn => 'dbi:SQLite:dbname=:memory:',
      table => 'my_table',
      verbose => 1,
      create_if_needed => 1,
  });

ACCESSORS

table

Gets and sets the Table::Denormalized instance.

verbose

Gets and sets the output of progress information. A true value will make the manager output information.

METHODS

new ARGS

Creates a new manager instance. The following arguments are recognized:

create

Creates the table. Wipes all data from the table should it already exist.

create_if_needed

Creates the table if needed.

table

The name of the table where the index gets stored in. Default is fileindex.

dsn

The DBI DSN to use. Default is dbi:SQLite:dbname=$0.sqlite.

If you want an alternate database to be used, you can change that here, or with the dbh parameter, if you already have a database handle.

dbh

If you want to provide an alternate database other than SQLite, you can supply the $dbh you get from a DBI connect call.

row_class

The class into which returned rows are blessed into. This allows you to specify a Class::DBI or DBIx::Class subclass. The default is Table::Denormalized::Row.

verbose

Outputs actions to the screen.

managed_class

The class to instantiate. The default is Table::Denormalized but this allows you to specify a different class. The package will be loaded using UNIVERSAL::require.

columnset

The column set(s) that the table should contain. If this is a reference to an unblessed array it's interpreted as a list of column sets, otherwise it's interpreted as a single column set.

query PARAMS

Pass through to Table::Denormalized

all

Shorthand for $query->query({}). It returns all items in the table.

query_ex PARAMS

Pass through to Table::Denormalized

$mgr->table_exists [NAME]

Returns true if the table NAME exists in the database.

If NAME is not given, the default table name is assumed.

columns

Returns the columns of the resultset.

sql

Returns the SQL::Abstract::Clauses object of the table.

dbh

Returns the database handle of the table.

retrieve ITEMS

Retrieves rows as given by their primary keys.

AUTHOR

Max Maischein, <corion@cpan.org>

SEE ALSO

Table::Denormalized