line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Converter::SQLite::Index; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
36
|
use utf8; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
32
|
|
4
|
5
|
|
|
5
|
|
217
|
use 5.016; |
|
5
|
|
|
|
|
17
|
|
5
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
100
|
|
6
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
342
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$Geoffrey::Converter::SQLite::Index::VERSION = '0.000205'; |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
47
|
use parent 'Geoffrey::Role::ConverterType'; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
33
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub add { |
13
|
8
|
|
|
8
|
1
|
19
|
my ( $self, $params ) = @_; |
14
|
8
|
100
|
|
|
|
19
|
if ( !$params ) { |
15
|
1
|
|
|
|
|
476
|
require Geoffrey::Exception::General; |
16
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::General::throw_no_params(); |
17
|
|
|
|
|
|
|
} |
18
|
7
|
100
|
|
|
|
19
|
if ( !$params->{table} ) { |
19
|
1
|
|
|
|
|
502
|
require Geoffrey::Exception::RequiredValue; |
20
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_table_name(); |
21
|
|
|
|
|
|
|
} |
22
|
6
|
100
|
|
|
|
18
|
if ( !$params->{column} ) { |
23
|
1
|
|
|
|
|
4
|
require Geoffrey::Exception::RequiredValue; |
24
|
1
|
|
|
|
|
4
|
Geoffrey::Exception::RequiredValue::throw_refcolumn_missing(); |
25
|
|
|
|
|
|
|
} |
26
|
5
|
|
|
|
|
524
|
require Ref::Util; |
27
|
5
|
|
|
|
|
2239
|
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
|
|
|
|
|
12
|
? @{ $params->{column} } |
40
|
|
|
|
|
|
|
: ( $params->{column} ) |
41
|
5
|
100
|
|
|
|
31
|
) |
42
|
|
|
|
|
|
|
] |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub drop { |
47
|
5
|
|
|
5
|
1
|
16
|
my ( $self, $name ) = @_; |
48
|
5
|
100
|
|
|
|
18
|
if ( !$name ) { |
49
|
1
|
|
|
|
|
656
|
require Geoffrey::Exception::RequiredValue; |
50
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_index_name(); |
51
|
|
|
|
|
|
|
} |
52
|
4
|
|
|
|
|
21
|
return qq~DROP INDEX $name~; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub list { |
56
|
4
|
|
|
4
|
1
|
12
|
my ( $self, $schema ) = @_; |
57
|
4
|
|
|
|
|
27
|
require Geoffrey::Utils; |
58
|
|
|
|
|
|
|
return |
59
|
4
|
|
|
|
|
16
|
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__ |