1SQL::Translator::FilterU:s:eNramCeosn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Filter::Names(3)
2
3
4

NAME

6       SQL::Translator::Filter::Names - Tweak the names of schema objects.
7

SYNOPSIS

9         #! /usr/bin/perl -w
10         use SQL::Translator;
11
12         # Lowercase all table names and upper case the first letter of all field
13         # names. (MySql style!)
14         #
15         my $sqlt = SQL::Translator->new(
16             filename => \@ARGV,
17             from     => 'MySQL',
18             to       => 'MySQL',
19             filters => [
20               Names => {
21                   'tables' => 'lc',
22                   'fields' => 'ucfirst',
23               },
24             ],
25         ) || die "SQLFairy error : ".SQL::Translator->error;
26         print($sqlt->translate) || die "SQLFairy error : ".$sqlt->error;
27

DESCRIPTION

SEE ALSO

30       perl(1), SQL::Translator
31

BUGS

TODO

34       Name Groups
35           Define a bunch of usefull groups to run the name filters over. e.g.
36           all, fkeys, pkeys etc.
37
38       More Functions
39           e.g. camelcase, titlecase, single word etc.  Also a way to pass in
40           a regexp.
41
42           May also want a way to pass in arguments for the func e.g. prefix.
43
44       Multiple Filters on the same name (filter order)?
45           Do we actually need this, you could just run lots of filters. Would
46           make adding func args to the interface easier.
47
48               filters => [
49                   [ 'Names', { all => 'lc' } ],
50                   [ 'Names', {
51                       tables => 'lc',
52                       fields => 'ucfirst',
53                   } ],
54               ],
55
56           Mind you if you could give the filter a list this wouldn't be a
57           problem!
58
59               filters => [
60                   [ 'Names',
61                       all    => 'lc'
62                       fields => 'ucfirst',
63                   ],
64               ],
65
66           Which is nice. Might have to change the calling conventions for
67           filters.  Would also provide an order to run the filters in rather
68           than having to hard code it into the filter it's self.
69

AUTHOR

71perl v5.12.0                      2009-08-18 SQL::Translator::Filter::Names(3)
Impressum