1SQL::Translator::ProducUesre:r:GCroanpthrViibzu(t3e)d PeSrQlL:D:oTcruamnesnltaattoiro:n:Producer::GraphViz(3)
2
3
4
6 SQL::Translator::Producer::GraphViz - GraphViz producer for SQL::Trans‐
7 lator
8
10 use SQL::Translator;
11
12 my $trans = new SQL::Translator(
13 from => 'MySQL', # or your db of choice
14 to => 'GraphViz',
15 producer_args => {
16 out_file => 'schema.png',
17 add_color => 1,
18 show_constraints => 1,
19 show_datatypes => 1,
20 show_col_sizes => 1
21 }
22 ) or die SQL::Translator->error;
23
24 $trans->translate or die $trans->error;
25
27 Creates a graph of a schema using the amazing graphviz (see
28 http://www.graphviz.org/) application (via the GraphViz module). It's
29 nifty--you should try it!
30
32 * out_file
33 the name of the file where the graphviz graphic is to be written
34
35 * layout (DEFAULT: 'dot')
36 determines which layout algorithm GraphViz will use; possible val‐
37 ues are 'dot' (the default GraphViz layout for directed graph lay‐
38 outs), 'neato' (for undirected graph layouts - spring model) or
39 'twopi' (for undirected graph layouts - circular)
40
41 * node_shape (DEFAULT: 'record')
42 sets the node shape of each table in the graph; this can be one of
43 'record', 'plaintext', 'ellipse', 'circle', 'egg', 'triangle',
44 'box', 'diamond', 'trapezium', 'parallelogram', 'house', 'hexagon',
45 or 'octagon'
46
47 * output_type (DEFAULT: 'png')
48 sets the file type of the output graphic; possible values are 'ps',
49 'hpgl', 'pcl', 'mif', 'pic', 'gd', 'gd2', 'gif', 'jpeg', 'png',
50 'wbmp', 'cmap', 'ismap', 'imap', 'vrml', 'vtx', 'mp', 'fig', 'svg',
51 'canon', 'plain' or 'text' (see GraphViz for details on each of
52 these)
53
54 * width (DEFAULT: 8.5)
55 width (in inches) of the output graphic
56
57 * height (DEFAULT: 11)
58 height (in inches) of the output grahic
59
60 * fontsize
61 custom font size for node and edge labels (note that arbitrarily
62 large sizes may be ignored due to page size or graph size con‐
63 straints)
64
65 * fontname
66 custom font name (or full path to font file) for node, edge, and
67 graph labels
68
69 * nodeattrs
70 reference to a hash of node attribute names and their values; these
71 may override general fontname or fontsize parameter
72
73 * edgeattrs
74 reference to a hash of edge attribute names and their values; these
75 may override general fontname or fontsize parameter
76
77 * graphattrs
78 reference to a hash of graph attribute names and their values;
79 these may override the general fontname parameter
80
81 * show_fields (DEFAULT: true)
82 if set to a true value, the names of the colums in a table will be
83 displayed in each table's node
84
85 * show_fk_only
86 if set to a true value, only columns which are foreign keys will be
87 displayed in each table's node
88
89 * show_datatypes
90 if set to a true value, the datatype of each column will be dis‐
91 played next to each column's name; this option will have no effect
92 if the value of show_fields is set to false
93
94 * show_col_sizes
95 if set to a true value, the size (in bytes) of each CHAR and VAR‐
96 CHAR column will be displayed in parentheses next to the column's
97 name; this option will have no effect if the value of show_fields
98 is set to false
99
100 * show_constraints
101 if set to a true value, a field's constraints (i.e., its pri‐
102 mary-key-ness, its foreign-key-ness and/or its uniqueness) will
103 appear as a comma-separated list in brackets next to the field's
104 name; this option will have no effect if the value of show_fields
105 is set to false
106
107 * add_color
108 if set to a true value, the graphic will have a background color of
109 'lightgoldenrodyellow'; otherwise the background color will be
110 white
111
112 * natural_join
113 if set to a true value, the make_natural_join method of SQL::Trans‐
114 lator::Schema will be called before generating the graph; a true
115 value for join_pk_only (see below) implies a true value for this
116 option
117
118 * join_pk_only
119 the value of this option will be passed as the value of the like-
120 named argument in the make_natural_join method (see natural_join
121 above) of SQL::Translator::Schema, if either the value of this
122 option or the natural_join option is set to true
123
124 * skip_fields
125 the value of this option will be passed as the value of the like-
126 named argument in the make_natural_join method (see natural_join
127 above) of SQL::Translator::Schema, if either the natural_join or
128 join_pk_only options has a true value
129
131 Ken Y. Clark <kclark@cpan.org>
132
134 SQL::Translator, GraphViz
135
136
137
138perl v5.8.8 2007-10S-Q2L4::Translator::Producer::GraphViz(3)