NAME

Table::Denormalized::Tags - a tag manager

ABSTRACT

Manage tags through the dynamic table. Any tag will be a boolean column. This is wasteful for sparse tags but provides a clean way to manually query rows with tags.

There is no way to create a logical and query, all tags are always processed as logical or.

You can group tags together by using arrayrefs. If you have more than one tag group, all groups need to be in arrayrefs. Different tag groups will always be joined with a logical and, not a logical or.

This module is intended to be used with a point-n-click user interface. If your user can input a query string, you might fare better with other methods of constructing a query.

->new({ ARGS })

Constructs a tagset manager. The arguments are the same as for Table::Denormalized::Manager except for the additional tags parameter which takes a Table::Denormalized::ColumnSet or an arrayref of columnsets or an arrayref of column names to be used as the tags columnset.

The conversion is done through the ->mk_tagset method of the class.

$m->query QUERY

Executes a query on the data. The query is modified according to tags to create "sensible" inclusive and exclusive listings.

QUERY is thought to be a hashref of the columns to query. The values are either the scalars to be found or references to arrays of the allowed column values, much like the param method of CGI returns.

This method destroys the passed-in PARAMS hash.

$m->mk_tagset NAME, TAGS

Shorthand to create a tagset. This is basically

    my $r = Table::Denormalized::ColumnSet->new( _name => $NAME );
    for (@TAGS) {
        $r->add_column( $_ => 'BOOLEAN' );
    }
    return $r

$m->add_tag TAG

Shorthand to add a tag and update the table structure. This adds the tag to the first tagset. If you want anything different, modify $m->tags yourself and also modify the appropriate columnset.

All tags will be created with the BOOLEAN column type.

Changing the table structure might imply a restart of Apache or have other interesting consequences for your program. Use this shorthand with caution.

TODO