• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.9.5/CPANInternal-140/DBIx-Class-Schema-Loader-0.07033/lib/DBIx/Class/Schema/Loader/DBI/
1package DBIx::Class::Schema::Loader::DBI::Writing;
2use strict;
3
4our $VERSION = '0.07033';
5
6# Empty. POD only.
7
8=head1 NAME
9
10DBIx::Class::Schema::Loader::DBI::Writing - Loader subclass writing guide for DBI
11
12=head1 SYNOPSIS
13
14  package DBIx::Class::Schema::Loader::DBI::Foo;
15
16  # THIS IS JUST A TEMPLATE TO GET YOU STARTED.
17
18  use strict;
19  use warnings;
20  use base 'DBIx::Class::Schema::Loader::DBI';
21  use mro 'c3';
22
23  sub _table_uniq_info {
24      my ($self, $table) = @_;
25
26      # ... get UNIQUE info for $table somehow
27      # and return a data structure that looks like this:
28
29      return [
30         [ 'keyname' => [ 'colname' ] ],
31         [ 'keyname2' => [ 'col1name', 'col2name' ] ],
32         [ 'keyname3' => [ 'colname' ] ],
33      ];
34
35      # Where the "keyname"'s are just unique identifiers, such as the
36      # name of the unique constraint, or the names of the columns involved
37      # concatenated if you wish.
38  }
39
40  sub _table_comment {
41      my ( $self, $table ) = @_;
42      return 'Comment';
43  }
44
45  sub _column_comment {
46      my ( $self, $table, $column_number ) = @_;
47      return 'Col. comment';
48  }
49
50  1;
51
52=head1 DETAILS
53
54The only required method for new subclasses is C<_table_uniq_info>,
55as there is not (yet) any standardized, DBD-agnostic way for obtaining
56this information from DBI.
57
58The base DBI Loader contains generic methods that *should* work for
59everything else in theory, although in practice some DBDs need to
60override one or more of the other methods.  The other methods one might
61likely want to override are: C<_table_pk_info>, C<_table_fk_info>,
62C<_tables_list> and C<_extra_column_info>.  See the included DBD drivers
63for examples of these.
64
65To import comments from the database you need to implement C<_table_comment>,
66C<_column_comment>
67
68=head1 AUTHOR
69
70See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
71
72=head1 LICENSE
73
74This library is free software; you can redistribute it and/or modify it under
75the same terms as Perl itself.
76
77=cut
78
791;
80