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 namespace
25       "http://sqlfairy.sourceforge.net/sqlfairy.xml."  See SQL::Transla‐
26       tor::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
46       Leave the attribute out all together to use the default in
47       Schema::Field.  Use empty quotes or 'EMPTY_STRING' for a zero lenth
48       string. 'NULL' for an explicit null (currently sets default_value to
49       undef in the Schema::Field obj).
50
51         <sqlf:field default_value="" />                <!-- Empty string -->
52         <sqlf:field default_value="EMPTY_STRING" />    <!-- Empty string -->
53         <sqlf:field default_value="NULL" />            <!-- NULL -->
54
55       ARGS
56
57       Doesn't take any extra parser args at the moment.
58

LEGACY FORMAT

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

BUGS

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

SEE ALSO

82       perl, SQL::Translator, SQL::Translator::Producer::XML::SQLFairy,
83       SQL::Translator::Schema.
84

TODO

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

AUTHOR

93       Mark D. Addison <mark.addison@itn.co.uk>.
94
95
96
97perl v5.8.8                       2007S-Q1L0:-:2T4ranslator::Parser::XML::SQLFairy(3)
Impressum