| 1 | package Alzabo::Column; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 11 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 11 | ▶ | use Alzabo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 11 | ▶ | use Tie::IxHash; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 11 | ▶ | use Params::Validate qw( :all ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 0 | ▶ | Params::Validate::validation_options( on_fail => sub { Alzabo::Exception::Params->throw( error => join '', @_ ) } ); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 12 | |||||||||||
| 13 | 11 | $VERSION = 2.0; | |||||||||
| 14 | |||||||||||
| 15 | 11 | 1; | |||||||||
| 16 | |||||||||||
| 17 | sub table | ||||||||||
| 18 | 0 | ▶ | { | ||||||||
|
Subroutine
table: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 19 | 0 | $_[0]->{table}; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | sub name | ||||||||||
| 23 | 0 | ▶ | { | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | $_[0]->{name}; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | sub nullable | ||||||||||
| 28 | 0 | ▶ | { | ||||||||
|
Subroutine
nullable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | $_[0]->{nullable}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | sub attributes | ||||||||||
| 33 | 0 | ▶ | { | ||||||||
|
Subroutine
attributes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | 0 | return keys %{ $_[0]->{attributes} }; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | sub has_attribute | ||||||||||
| 38 | 0 | ▶ | { | ||||||||
|
Subroutine
has_attribute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 39 | 0 | my $self = shift; | |||||||||
| 40 | 0 | my %p = validate( @_, { attribute => { type => SCALAR }, | |||||||||
| 41 | case_sensitive => { type => SCALAR, | ||||||||||
| 42 | default => 0 } } ); | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | if ( $p{case_sensitive} ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | { | ||||||||||
| 46 | 0 | return exists $self->{attributes}{ $p{attribute} }; | |||||||||
| 47 | } | ||||||||||
| 48 | else | ||||||||||
| 49 | { | ||||||||||
| 50 | 0 | ▶ | return 1 if grep { lc $p{attribute} eq lc $_ } keys %{ $self->{attributes} }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | } | ||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | sub type | ||||||||||
| 55 | 0 | ▶ | { | ||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 56 | 0 | $_[0]->definition->type; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | sub sequenced | ||||||||||
| 60 | 0 | ▶ | { | ||||||||
|
Subroutine
sequenced: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 61 | 0 | $_[0]->{sequenced}; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | sub default | ||||||||||
| 65 | 0 | ▶ | { | ||||||||
|
Subroutine
default: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 66 | 0 | $_[0]->{default}; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub default_is_raw | ||||||||||
| 70 | 0 | ▶ | { | ||||||||
|
Subroutine
default_is_raw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 71 | 0 | $_[0]->{default_is_raw}; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | sub length | ||||||||||
| 75 | 0 | ▶ | { | ||||||||
|
Subroutine
length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 76 | 0 | $_[0]->definition->length; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | sub precision | ||||||||||
| 80 | 0 | ▶ | { | ||||||||
|
Subroutine
precision: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 81 | 0 | $_[0]->definition->precision; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | sub definition | ||||||||||
| 85 | 0 | ▶ | { | ||||||||
|
Subroutine
definition: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 86 | 0 | $_[0]->{definition}; | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | sub is_primary_key | ||||||||||
| 90 | 0 | ▶ | { | ||||||||
|
Subroutine
is_primary_key: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 91 | 0 | $_[0]->table->column_is_primary_key($_[0]); | |||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | sub is_numeric | ||||||||||
| 95 | 0 | ▶ | { | ||||||||
|
Subroutine
is_numeric: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 96 | 0 | $_[0]->table->schema->rules->type_is_numeric($_[0]); | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | sub is_integer | ||||||||||
| 100 | 0 | ▶ | { | ||||||||
|
Subroutine
is_integer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 101 | 0 | $_[0]->table->schema->rules->type_is_integer($_[0]); | |||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | sub is_floating_point | ||||||||||
| 105 | 0 | ▶ | { | ||||||||
|
Subroutine
is_floating_point: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 106 | 0 | $_[0]->table->schema->rules->type_is_floating_point($_[0]); | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | sub is_character | ||||||||||
| 110 | 0 | ▶ | { | ||||||||
|
Subroutine
is_character: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 111 | 0 | $_[0]->table->schema->rules->type_is_char($_[0]); | |||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | sub is_date | ||||||||||
| 115 | 0 | ▶ | { | ||||||||
|
Subroutine
is_date: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 116 | 0 | $_[0]->table->schema->rules->type_is_date($_[0]); | |||||||||
| 117 | } | ||||||||||
| 118 | |||||||||||
| 119 | sub is_datetime | ||||||||||
| 120 | 0 | ▶ | { | ||||||||
|
Subroutine
is_datetime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 121 | 0 | $_[0]->table->schema->rules->type_is_datetime($_[0]); | |||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | sub is_time | ||||||||||
| 125 | 0 | ▶ | { | ||||||||
|
Subroutine
is_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 126 | 0 | $_[0]->table->schema->rules->type_is_time($_[0]); | |||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | sub is_time_interval | ||||||||||
| 130 | 0 | ▶ | { | ||||||||
|
Subroutine
is_time_interval: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 131 | 0 | $_[0]->table->schema->rules->type_is_time_interval($_[0]); | |||||||||
| 132 | } | ||||||||||
| 133 | |||||||||||
| 134 | sub is_blob | ||||||||||
| 135 | 0 | ▶ | { | ||||||||
|
Subroutine
is_blob: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 136 | 0 | $_[0]->table->schema->rules->type_is_blob($_[0]); | |||||||||
| 137 | } | ||||||||||
| 138 | |||||||||||
| 139 | sub generic_type | ||||||||||
| 140 | 0 | ▶ | { | ||||||||
|
Subroutine
generic_type: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 141 | 0 | my $self = shift; | |||||||||
| 142 | |||||||||||
| 143 | 0 | foreach my $type ( qw( integer floating_point character date datetime time blob ) ) | |||||||||
| 144 | { | ||||||||||
| 145 | 0 | my $method = "is_$type"; | |||||||||
| 146 | 0 | ▶ | return $type if $self->$method(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 147 | } | ||||||||||
| 148 | |||||||||||
| 149 | 0 | return 'unknown'; | |||||||||
| 150 | } | ||||||||||
| 151 | |||||||||||
| 152 | 0 | ▶ | sub comment { $_[0]->{comment} } | ||||||||
|
Subroutine
comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 153 | |||||||||||
| 154 | __END__ | ||||||||||