line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Changeset::Loader; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
101488
|
use warnings; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
148
|
|
4
|
5
|
|
|
5
|
|
26
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
165
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
27
|
use base qw/Class::Factory DBIx::Changeset/; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
4591
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2320
|
use vars qw{$VERSION}; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
208
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
5
|
|
|
5
|
|
1045
|
$VERSION = '1.11'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
DBIx::Changeset::Collection - Factory Interface to objects to load changesets into the database |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Factory Interface to objects to load changesets into the database |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Perhaps a little code snippet. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use DBIx::Changeset::Loader; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $foo = DBIx::Changeset::Loader->new('type', $opts); |
26
|
|
|
|
|
|
|
... |
27
|
|
|
|
|
|
|
$foo->apply_changeset(); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 INTERFACE |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 start_transaction |
32
|
|
|
|
|
|
|
This is the start_transaction interface to implement in your own class |
33
|
|
|
|
|
|
|
=cut |
34
|
1
|
|
|
1
|
1
|
48
|
sub start_transaction { |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 commit_transaction |
38
|
|
|
|
|
|
|
This is the commit_transaction interface to implement in your own class |
39
|
|
|
|
|
|
|
=cut |
40
|
1
|
|
|
1
|
1
|
499
|
sub commit_transaction { |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 rollback_transaction |
44
|
|
|
|
|
|
|
This is the rollback_transaction interface to implement in your own class |
45
|
|
|
|
|
|
|
=cut |
46
|
1
|
|
|
1
|
1
|
503
|
sub rollback_transaction { |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 apply_changeset |
50
|
|
|
|
|
|
|
This is the apply_changeset interface to implement in your own class |
51
|
|
|
|
|
|
|
=cut |
52
|
0
|
|
|
0
|
1
|
0
|
sub apply_changeset { |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 TYPES |
56
|
|
|
|
|
|
|
Default types included |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 mysql |
59
|
|
|
|
|
|
|
use mysql to load changeset records into the db |
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( mysql => 'DBIx::Changeset::Loader::Mysql' ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 pg |
64
|
|
|
|
|
|
|
use psql to load changeset records into the db |
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
__PACKAGE__->register_factory_type( pg => 'DBIx::Changeset::Loader::Pg' ); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 ACCESSORS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 db_pass |
72
|
|
|
|
|
|
|
database password |
73
|
|
|
|
|
|
|
args: |
74
|
|
|
|
|
|
|
string |
75
|
|
|
|
|
|
|
returns: |
76
|
|
|
|
|
|
|
string |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 db_name |
79
|
|
|
|
|
|
|
the database name |
80
|
|
|
|
|
|
|
args: |
81
|
|
|
|
|
|
|
string |
82
|
|
|
|
|
|
|
returns: |
83
|
|
|
|
|
|
|
string |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 db_user |
86
|
|
|
|
|
|
|
the database user |
87
|
|
|
|
|
|
|
args: |
88
|
|
|
|
|
|
|
string |
89
|
|
|
|
|
|
|
returns: |
90
|
|
|
|
|
|
|
string |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 db_host |
93
|
|
|
|
|
|
|
the database host |
94
|
|
|
|
|
|
|
args: |
95
|
|
|
|
|
|
|
string |
96
|
|
|
|
|
|
|
returns: |
97
|
|
|
|
|
|
|
string |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my @ACCESSORS = qw/db_pass db_name db_user db_host/; |
102
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@ACCESSORS); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 init |
105
|
|
|
|
|
|
|
Called automatically to intialise the factory objects takes params passed to new and assigns them to |
106
|
|
|
|
|
|
|
accessors if they exist |
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub init { |
110
|
3
|
|
|
3
|
1
|
5897
|
my ( $self, $params ) = @_; |
111
|
|
|
|
|
|
|
|
112
|
3
|
|
|
|
|
8
|
foreach my $field ( keys %{$params} ) { |
|
3
|
|
|
|
|
14
|
|
113
|
0
|
0
|
|
|
|
0
|
$self->{ $field } = $params->{ $field } if ( $self->can($field) ); |
114
|
|
|
|
|
|
|
} |
115
|
3
|
|
|
|
|
15
|
return $self; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright 2004-2008 Grox Pty Ltd. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
123
|
|
|
|
|
|
|
under the same terms as Perl itself. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; # End of DBIx::Changeset |