line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alzabo::Index; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
64
|
use strict; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
446
|
|
4
|
11
|
|
|
11
|
|
58
|
use vars qw($VERSION); |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
550
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
55
|
use Alzabo; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
219
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
65
|
use Tie::IxHash; |
|
11
|
|
|
|
|
37
|
|
|
11
|
|
|
|
|
5785
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = 2.0; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
1; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub columns |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my @c; |
19
|
0
|
|
|
|
|
|
foreach my $c ($self->{columns}->Keys) |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
|
|
|
push @c, ($self->{columns}->FETCH($c))->{column}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return @c; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub prefix |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $c = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
Alzabo::Exception::Params->throw( error => "Column " . $c->name . " is not part of index." ) |
33
|
|
|
|
|
|
|
unless $self->{columns}->EXISTS( $c->name ); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return ($self->{columns}->FETCH( $c->name ))->{prefix}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
1
|
|
sub unique { $_[0]->{unique} } |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
|
sub fulltext { $_[0]->{fulltext} } |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub function { $_[0]->{function} } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub id |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $function; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
if ( defined $self->function ) |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
|
|
|
($function) = $self->function =~ /^(\w+)/; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
0
|
|
|
|
return join '___', ( $self->{table}->name, |
56
|
|
|
|
|
|
|
# making this change would break schemas when the user tries to |
57
|
|
|
|
|
|
|
# delete/drop the index. save for later, maybe? |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# ( $self->unique ? 'U' : () ), |
60
|
|
|
|
|
|
|
# ( $self->fulltext ? 'F' : () ), |
61
|
|
|
|
|
|
|
( $function ? $function : () ), |
62
|
0
|
0
|
|
|
|
|
( map { $_->name, $self->prefix($_) || () } |
63
|
|
|
|
|
|
|
$self->columns ), |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub table |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $self->{table}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |