line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package DBIx::Migration::Directories::Database::SQLite2; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
114
|
|
6
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
255
|
|
7
|
2
|
|
|
2
|
|
15
|
use DBIx::Migration::Directories::Database; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
144
|
|
8
|
2
|
|
|
2
|
|
12
|
use base q(DBIx::Migration::Directories::Database); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
320
|
|
9
|
2
|
|
|
2
|
|
3602
|
use POSIX qw(strftime); |
|
2
|
|
|
|
|
20882
|
|
|
2
|
|
|
|
|
17
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return 1; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
1
|
4
|
sub driver { return "SQLite2"; } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub sql_table_exists { |
16
|
42
|
|
|
42
|
1
|
93
|
my($self, $table) = @_; |
17
|
42
|
|
|
|
|
359
|
return sprintf( |
18
|
|
|
|
|
|
|
q{SELECT 1 FROM sqlite_master WHERE type ='table' AND name = %s}, |
19
|
|
|
|
|
|
|
$self->{dbh}->quote($table) |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub sql_insert_migration_schema_log { |
24
|
30
|
|
|
30
|
1
|
65
|
my($self, $myschema, $from, $to) = @_; |
25
|
30
|
|
|
|
|
3415
|
my $now = strftime("%Y%m%dZ%H%M%S", gmtime); |
26
|
30
|
|
|
|
|
257
|
return sprintf( |
27
|
|
|
|
|
|
|
q{ |
28
|
|
|
|
|
|
|
INSERT INTO migration_schema_log |
29
|
|
|
|
|
|
|
(schema_name, event_time, old_version, new_version) |
30
|
|
|
|
|
|
|
VALUES (%s, %s, %f, %f) |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
$self->{dbh}->quote($myschema), $self->{dbh}->quote($now), $from, $to |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
DBIx::Migration::Directories::Database::SQLite2 - Handle quirks with DBD::SQLite2 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $dbh = DBIx::Transaction->connect('DBI:SQLite2:my_database'); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $migration = DBIx::Migration::Directories->new( |
47
|
|
|
|
|
|
|
dbh => $dbh, |
48
|
|
|
|
|
|
|
schema => 'MySchema', |
49
|
|
|
|
|
|
|
... |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The following methods had to be written differently |
55
|
|
|
|
|
|
|
so that they behave properly under SQLite2: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item sql_table_exists($table) |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See L. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
SQLite2 does not support the SQL standard "C". |
64
|
|
|
|
|
|
|
This C method instead uses SQLite2's custom |
65
|
|
|
|
|
|
|
"C" meta-table to verify the existance of a table. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item sql_insert_migration_schema_log() |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
See L. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
SQLite2 does not supply a now() function to retrieve the current time, |
72
|
|
|
|
|
|
|
so this query has been modified to compensate. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Tyler "Crackerjack" MacDonald |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Copyright 2009 Tyler "Crackerjack" MacDonald |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is free software; You may distribute it under the same terms as perl |
85
|
|
|
|
|
|
|
itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SEE ALSO |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L, L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |