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