Oryx::DBI::Attribute - DBI implementation of attributes


Oryx documentation Contained in the Oryx distribution.

Index


Code Index:

NAME

Top

Oryx::DBI::Attribute - DBI implementation of attributes

SYNOPSIS

Top

See Oryx::Attribute.

DESCRIPTION

Top

This class provides the implementation of attributes for Oryx classes stored via an Oryx::DBI connection.

GUTS

Top

This is just a quick run-down of implementation details as of this writing to help introduce users to the database internals. These details may change with future releases and might have changed since this documentation was written.

Each attribute is stored in a field with the name given. The types used will be the type determined by the type2sql() method of the appropriate Oryx::DBI::Util implementation for the current connection.

The work of serializing and unserializing data is handled by Oryx::Value implementations while this class handles the work of making sure the data is actually stored and loaded when requested.

SEE ALSO

Top

Oryx, Oryx::DBI, Oryx::Attribute, Oryx::Value

AUTHOR

Top

Richard Hundt <richard NO SPAM AT protea-systems.com>

COPYRIGHT AND LICENSE

Top


Oryx documentation Contained in the Oryx distribution.

package Oryx::DBI::Attribute;

use Oryx::Value;

use base qw(Oryx::Attribute);

sub create {
    my ($self, $query, $param) = @_;
    my $attr_name = $self->name;
    $param->{$attr_name} = $self->deflate($param->{$attr_name});
}

sub retrieve {
    my ($self, $query, $values) = @_;
    push @{$query->{fields}}, $self->name;
}

sub update {
    my ($self, $query, $object) = @_;
    my $attr_name = $self->name;
    my $value = $object->$attr_name;
    $query->{fieldvals}->{$attr_name} = $self->deflate($value);
}

sub search {
    my ($self, $query) = @_;
    push @{$query->{fields}}, $self->name;
}

1;
__END__