| Alzabo documentation | Contained in the Alzabo distribution. |
Alzabo::Runtime::Column - Column objects
use Alzabo::Runtime::Column;
Alzabo::Column
Takes the following parameters:
This method returns an object that can be used in calls to the table
and schema select() methods in order to change the name given to
the column if next_as_hash() is called on the
Alzabo::DriverStatement|Alzabo::Driver/Alzabo::DriverStatment
returned by the aforementioned select() method.
Dave Rolsky, <autarch@urth.org>
| Alzabo documentation | Contained in the Alzabo distribution. |
package Alzabo::Runtime::Column; use strict; use vars qw($VERSION); use Alzabo::Runtime; use Params::Validate qw( :all ); Params::Validate::validation_options( on_fail => sub { Alzabo::Exception::Params->throw( error => join '', @_ ) } ); use base qw(Alzabo::Column); $VERSION = 2.0; sub alias_clone { my $self = shift; my %p = validate( @_, { table => { isa => 'Alzabo::Runtime::Table' }, } ); my $clone; %$clone = %$self; $clone->{table} = $p{table}; bless $clone, ref $self; return $clone; } sub alias { my $self = shift; my %p = validate( @_, { as => { type => SCALAR } } ); my $clone; %$clone = %$self; bless $clone, ref $self; $clone->{alias_name} = $p{as}; $clone->{real_column} = $self; return $clone; } sub alias_name { return $_[0]->{alias_name} || $_[0]->{name}; } 1; __END__