| 1 | package DBIx::Changeset::Loader; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 6 | ▶ | use base qw/Class::Factory DBIx::Changeset/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 6 | ▶ | use vars qw{$VERSION}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 6 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 6 | $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 | ▶ | sub start_transaction { | ||||||||
|
Subroutine
start_transaction: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | =head2 commit_transaction | ||||||||||
| 38 | This is the commit_transaction interface to implement in your own class | ||||||||||
| 39 | =cut | ||||||||||
| 40 | 1 | ▶ | sub commit_transaction { | ||||||||
|
Subroutine
commit_transaction: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | =head2 rollback_transaction | ||||||||||
| 44 | This is the rollback_transaction interface to implement in your own class | ||||||||||
| 45 | =cut | ||||||||||
| 46 | 1 | ▶ | sub rollback_transaction { | ||||||||
|
Subroutine
rollback_transaction: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | =head2 apply_changeset | ||||||||||
| 50 | This is the apply_changeset interface to implement in your own class | ||||||||||
| 51 | =cut | ||||||||||
| 52 | 0 | ▶ | sub apply_changeset { | ||||||||
|
Subroutine
apply_changeset: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 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 | 6 | __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 | 6 | __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 | 6 | my @ACCESSORS = qw/db_pass db_name db_user db_host/; | |||||||||
| 102 | 6 | __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 | 3 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||
| 110 | 3 | my ( $self, $params ) = @_; | |||||||||
| 111 | |||||||||||
| 112 | 3 | foreach my $field ( keys %{$params} ) { | |||||||||
| 113 | 0 | ▶ | $self->{ $field } = $params->{ $field } if ( $self->can($field) ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 114 | } | ||||||||||
| 115 | 3 | 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 | 6 | 1; # End of DBIx::Changeset | |||||||||