line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Converter::SQLite::Index; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
39
|
use utf8; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
35
|
|
4
|
5
|
|
|
5
|
|
246
|
use 5.016; |
|
5
|
|
|
|
|
21
|
|
5
|
5
|
|
|
5
|
|
27
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
102
|
|
6
|
5
|
|
|
5
|
|
30
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
294
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$Geoffrey::Converter::SQLite::Index::VERSION = '0.000204'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
32
|
use parent 'Geoffrey::Role::ConverterType'; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
30
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub add { |
13
|
8
|
|
|
8
|
1
|
20
|
my ( $self, $params ) = @_; |
14
|
8
|
100
|
|
|
|
22
|
if ( !$params ) { |
15
|
1
|
|
|
|
|
485
|
require Geoffrey::Exception::General; |
16
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::General::throw_no_params(); |
17
|
|
|
|
|
|
|
} |
18
|
7
|
100
|
|
|
|
21
|
if ( !$params->{table} ) { |
19
|
1
|
|
|
|
|
544
|
require Geoffrey::Exception::RequiredValue; |
20
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_table_name(); |
21
|
|
|
|
|
|
|
} |
22
|
6
|
100
|
|
|
|
16
|
if ( !$params->{column} ) { |
23
|
1
|
|
|
|
|
5
|
require Geoffrey::Exception::RequiredValue; |
24
|
1
|
|
|
|
|
3
|
Geoffrey::Exception::RequiredValue::throw_refcolumn_missing(); |
25
|
|
|
|
|
|
|
} |
26
|
5
|
|
|
|
|
525
|
require Ref::Util; |
27
|
5
|
|
|
|
|
2273
|
require Geoffrey::Utils; |
28
|
|
|
|
|
|
|
return Geoffrey::Utils::replace_spare( |
29
|
|
|
|
|
|
|
q~CREATE INDEX {0} ON {1} ({2})~, |
30
|
|
|
|
|
|
|
[ Geoffrey::Utils::add_name( |
31
|
|
|
|
|
|
|
{ prefix => 'ix', |
32
|
|
|
|
|
|
|
name => $params->{name}, |
33
|
|
|
|
|
|
|
context => $params->{table} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
), |
36
|
|
|
|
|
|
|
$params->{table}, |
37
|
|
|
|
|
|
|
( join ', ', |
38
|
|
|
|
|
|
|
Ref::Util::is_arrayref( $params->{column} ) |
39
|
2
|
|
|
|
|
15
|
? @{ $params->{column} } |
40
|
|
|
|
|
|
|
: ( $params->{column} ) |
41
|
5
|
100
|
|
|
|
33
|
) |
42
|
|
|
|
|
|
|
] |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub drop { |
47
|
5
|
|
|
5
|
1
|
18
|
my ( $self, $name ) = @_; |
48
|
5
|
100
|
|
|
|
33
|
if ( !$name ) { |
49
|
1
|
|
|
|
|
770
|
require Geoffrey::Exception::RequiredValue; |
50
|
1
|
|
|
|
|
6
|
Geoffrey::Exception::RequiredValue::throw_index_name(); |
51
|
|
|
|
|
|
|
} |
52
|
4
|
|
|
|
|
26
|
return qq~DROP INDEX $name~; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub list { |
56
|
4
|
|
|
4
|
1
|
13
|
my ( $self, $schema ) = @_; |
57
|
4
|
|
|
|
|
23
|
require Geoffrey::Utils; |
58
|
|
|
|
|
|
|
return |
59
|
4
|
|
|
|
|
19
|
q~SELECT * FROM ~ |
60
|
|
|
|
|
|
|
. Geoffrey::Utils::add_schema($schema) |
61
|
|
|
|
|
|
|
. q~sqlite_master WHERE type='index'~; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; # End of Geoffrey::Converter::SQLite::Index |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |