Fey::Hash::ColumnsKey - A hash where the keys are sets of Fey::Column objects


Fey-ORM documentation Contained in the Fey-ORM distribution.

Index


Code Index:

NAME

Top

Fey::Hash::ColumnsKey - A hash where the keys are sets of Fey::Column objects

VERSION

Top

version 0.43

SYNOPSIS

Top

  my $hash = Fey::Hash::ColumnsKey->new();

  $hash->store( [ $col1, $col2 ] => $sql );

DESCRIPTION

Top

This class is a helper for Fey::Meta::Class::Table. It is used to cache SQL statements with a set of columns as the key. You should never need to use it directly.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


Fey-ORM documentation Contained in the Fey-ORM distribution.

package Fey::Hash::ColumnsKey;
BEGIN {
  $Fey::Hash::ColumnsKey::VERSION = '0.43';
}

use strict;
use warnings;

sub new {
    my $class = shift;

    return bless {}, $class;
}

sub get {
    my $self     = shift;
    my $key_cols = shift;

    my $key = join "\0", map { $_->name() } @{$key_cols};

    return $self->{$key};
}

sub store {
    my $self     = shift;
    my $key_cols = shift;
    my $sql      = shift;

    my $key = join "\0", map { $_->name() } @{$key_cols};

    return $self->{$key} = $sql;
}

1;

# ABSTRACT: A hash where the keys are sets of Fey::Column objects




__END__