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