1SQL::Translator::ParserU:s:eXrMLC:o:nStQrLiFbauitreydS(Q3PL)e:r:lTrDaoncsulmaetnotra:t:iPoanrser::XML::SQLFairy(3)
2
3
4

NAME

6       SQL::Translator::Parser::XML::SQLFairy - parser for SQL::Translator's
7       XML.
8

SYNOPSIS

10         use SQL::Translator;
11
12         my $translator = SQL::Translator->new( show_warnings  => 1 );
13
14         my $out = $obj->translate(
15             from     => 'XML-SQLFairy',
16             to       => 'MySQL',
17             filename => 'schema.xml',
18         ) or die $translator->error;
19
20         print $out;
21

DESCRIPTION

23       This parser handles the flavor of XML used natively by the SQLFairy
24       project (SQL::Translator).  The XML must be in the XML namespace
25       "http://sqlfairy.sourceforge.net/sqlfairy.xml".  See
26       SQL::Translator::Producer::XML::SQLFairy for details of this format.
27
28       You do not need to specify every attribute of the Schema objects as any
29       missing from the XML will be set to their default values. e.g. A field
30       could be written using only;
31
32        <sqlf:field name="email" data_type="varchar" size="255" />
33
34       Instead of the full;
35
36        <sqlf:field name="email" data_type="varchar" size="255" is_nullable="1"
37          is_auto_increment="0" is_primary_key="0" is_foreign_key="0" order="4">
38          <sqlf:comments></sqlf:comments>
39        </sqlf:field>
40
41       If you do not explicitly set the order of items using order attributes
42       on the tags then the order the tags appear in the XML will be used.
43
44   default_value
45       Leave the attribute out all together to use the default in
46       SQL::Translator::Schema::Field.  Use empty quotes or 'EMPTY_STRING' for
47       a zero length string. 'NULL' for an explicit null (currently sets
48       default_value to undef in the field object).
49
50         <sqlf:field default_value="" />                <!-- Empty string -->
51         <sqlf:field default_value="EMPTY_STRING" />    <!-- Empty string -->
52         <sqlf:field default_value="NULL" />            <!-- NULL -->
53
54   ARGS
55       Doesn't take any extra parser args at the moment.
56

LEGACY FORMAT

58       The previous version of the SQLFairy XML allowed the attributes of the
59       schema objects to be written as either xml attributes or as data
60       elements, in any combination. While this allows for lots of flexibility
61       in writing the XML the result is a great many possible XML formats, not
62       so good for DTD writing, XPathing etc! So we have moved to a fixed
63       version described in SQL::Translator::Producer::XML::SQLFairy.
64
65       This version of the parser will still parse the old formats and emit
66       warnings when it sees them being used but they should be considered
67       heavily depreciated.
68
69       To convert your old format files simply pass them through the
70       translator :)
71
72        $ sqlt -f XML-SQLFairy -t XML-SQLFairy schema-old.xml > schema-new.xml
73

BUGS

75       Ignores the order attribute for Constraints, Views, Indices, Views,
76       Triggers and Procedures, using the tag order instead. (This is the
77       order output by the SQLFairy XML producer).
78

SEE ALSO

80       perl, SQL::Translator, SQL::Translator::Producer::XML::SQLFairy,
81       SQL::Translator::Schema.
82

TODO

84       ·   Support options attribute.
85
86       ·   Test foreign keys are parsed ok.
87
88       ·   Control over defaulting.
89

AUTHOR

91       Mark D. Addison <mark.addison@itn.co.uk>, Jonathan Yu
92       <frequency@cpan.org>
93
94
95
96perl v5.32.0                      2020S-Q0L9:-:1T4ranslator::Parser::XML::SQLFairy(3)
Impressum