# Testing 1,2,3,4...
#=============================================================================
-
-BEGIN {
- maybe_plan(284, 'SQL::Translator::Parser::XML::SQLFairy');
-}
-foreach (
- "$Bin/data/xml/schema-basic.xml",
- "$Bin/data/xml/schema-basic-attribs.xml"
-) {
- do_file($_);
+BEGIN {
+ maybe_plan(142, 'SQL::Translator::Parser::XML::SQLFairy');
}
-sub do_file {
- my $testschema = shift;
- # Parse the test XML schema
- my $obj;
- $obj = SQL::Translator->new(
- debug => DEBUG,
- show_warnings => 1,
- add_drop_table => 1,
- );
- die "Can't find test schema $testschema" unless -e $testschema;
- my $sql = $obj->translate(
- from => 'XML-SQLFairy',
- to => 'MySQL',
- filename => $testschema,
- );
- print $sql if DEBUG;
-
- # Test the schema objs generted from the XML
- #
- my $scma = $obj->schema;
-
- # Hmmm, when using schema_ok the field test data gets a bit too nested and
- # fiddly to work with. (See 28xml-xmi-parser-sqlfairy.t for more split out
- # version)
- schema_ok( $scma, {
- tables => [
- {
- name => "Basic",
- fields => [
- {
- name => "id",
- data_type => "int",
- default_value => undef,
- is_nullable => 0,
- size => 10,
- is_primary_key => 1,
- is_auto_increment => 1,
- },
- {
- name => "title",
- data_type => "varchar",
- is_nullable => 0,
- default_value => "hello",
- size => 100,
- },
- {
- name => "description",
- data_type => "text",
- is_nullable => 1,
- default_value => "",
- },
- {
- name => "email",
- data_type => "varchar",
- size => 255,
- is_unique => 1,
- default_value => undef,
- is_nullable => 1,
- },
- {
- name => "explicitnulldef",
- data_type => "varchar",
- default_value => undef,
- is_nullable => 1,
- },
- {
- name => "explicitemptystring",
- data_type => "varchar",
- default_value => "",
- is_nullable => 1,
- },
- {
- name => "emptytagdef",
- data_type => "varchar",
- default_value => "",
- is_nullable => 1,
- },
- ],
- constraints => [
- {
- type => PRIMARY_KEY,
- fields => ["id"],
- },
- {
- name => 'emailuniqueindex',
- type => UNIQUE,
- fields => ["email"],
- }
- ],
- indices => [
- {
- name => "titleindex",
- fields => ["title"],
- },
- ],
- } # end table Basic
- ], # end tables
-
- views => [
- {
- name => 'email_list',
- sql => "SELECT email FROM Basic WHERE email IS NOT NULL",
- fields => ['email'],
- },
- ],
-
- triggers => [
- {
- name => 'foo_trigger',
- perform_action_when => 'after',
- database_event => 'insert',
- on_table => 'foo',
- action => 'update modified=timestamp();',
- },
- ],
-
- procedures => [
- {
- name => 'foo_proc',
- sql => 'select foo from bar',
- parameters => ['foo', 'bar'],
- owner => 'Nomar',
- comments => 'Go Sox!',
- },
- ],
-
- }); # end schema
-
-} # end do_file()
+my $testschema = "$Bin/data/xml/schema.xml";
+
+my $sqlt;
+$sqlt = SQL::Translator->new(
+ debug => DEBUG,
+ show_warnings => 1,
+ add_drop_table => 1,
+);
+die "Can't find test schema $testschema" unless -e $testschema;
+my $sql = $sqlt->translate(
+ from => 'XML-SQLFairy',
+ to => 'MySQL',
+ filename => $testschema,
+) or die $sqlt->error;
+print $sql if DEBUG;
+
+# Test the schema objs generted from the XML
+#
+my $scma = $sqlt->schema;
+
+# Hmmm, when using schema_ok the field test data gets a bit too nested and
+# fiddly to work with. (See 28xml-xmi-parser-sqlfairy.t for more a split out
+# version)
+schema_ok( $scma, {
+ tables => [
+ {
+ name => "Basic",
+ fields => [
+ {
+ name => "id",
+ data_type => "int",
+ default_value => undef,
+ is_nullable => 0,
+ size => 10,
+ is_primary_key => 1,
+ is_auto_increment => 1,
+ },
+ {
+ name => "title",
+ data_type => "varchar",
+ is_nullable => 0,
+ default_value => "hello",
+ size => 100,
+ },
+ {
+ name => "description",
+ data_type => "text",
+ is_nullable => 1,
+ default_value => "",
+ },
+ {
+ name => "email",
+ data_type => "varchar",
+ size => 255,
+ is_unique => 1,
+ default_value => undef,
+ is_nullable => 1,
+ },
+ {
+ name => "explicitnulldef",
+ data_type => "varchar",
+ default_value => undef,
+ is_nullable => 1,
+ },
+ {
+ name => "explicitemptystring",
+ data_type => "varchar",
+ default_value => "",
+ is_nullable => 1,
+ },
+ {
+ name => "emptytagdef",
+ data_type => "varchar",
+ default_value => "",
+ is_nullable => 1,
+ },
+ ],
+ constraints => [
+ {
+ type => PRIMARY_KEY,
+ fields => ["id"],
+ },
+ {
+ name => 'emailuniqueindex',
+ type => UNIQUE,
+ fields => ["email"],
+ }
+ ],
+ indices => [
+ {
+ name => "titleindex",
+ fields => ["title"],
+ },
+ ],
+ } # end table Basic
+ ], # end tables
+
+ views => [
+ {
+ name => 'email_list',
+ sql => "SELECT email FROM Basic WHERE email IS NOT NULL",
+ fields => ['email'],
+ },
+ ],
+
+ triggers => [
+ {
+ name => 'foo_trigger',
+ perform_action_when => 'after',
+ database_event => 'insert',
+ on_table => 'foo',
+ action => 'update modified=timestamp();',
+ },
+ ],
+
+ procedures => [
+ {
+ name => 'foo_proc',
+ sql => 'select foo from bar',
+ parameters => ['foo', 'bar'],
+ owner => 'Nomar',
+ comments => 'Go Sox!',
+ },
+ ],
+
+}); # end schema
-#!/usr/bin/perl -w
+#!/usr/bin/perl -w
# vim:filetype=perl
# Before `make install' is performed this script should be runnable with
#=============================================================================
BEGIN {
- maybe_plan(18,
+ maybe_plan(12,
'XML::Writer',
'Test::Differences',
'SQL::Translator::Producer::XML::SQLFairy');
use SQL::Translator::Producer::XML::SQLFairy;
#
-# emit_empty_tags => 0
+# basic stuff
#
{
my ($obj,$ans,$xml);
$ans = <<EOXML;
-<sqlt:schema xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:name></sqlt:name>
- <sqlt:database></sqlt:database>
- <sqlt:table>
- <sqlt:name>Basic</sqlt:name>
- <sqlt:order>1</sqlt:order>
- <sqlt:fields>
- <sqlt:field>
- <sqlt:name>id</sqlt:name>
- <sqlt:data_type>integer</sqlt:data_type>
- <sqlt:size>10</sqlt:size>
- <sqlt:is_nullable>0</sqlt:is_nullable>
- <sqlt:is_auto_increment>1</sqlt:is_auto_increment>
- <sqlt:is_primary_key>1</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments>comment on id field</sqlt:comments>
- <sqlt:order>1</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>title</sqlt:name>
- <sqlt:data_type>varchar</sqlt:data_type>
- <sqlt:size>100</sqlt:size>
- <sqlt:is_nullable>0</sqlt:is_nullable>
- <sqlt:default_value>hello</sqlt:default_value>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>2</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>description</sqlt:name>
- <sqlt:data_type>text</sqlt:data_type>
- <sqlt:size>65535</sqlt:size>
- <sqlt:is_nullable>1</sqlt:is_nullable>
- <sqlt:default_value></sqlt:default_value>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>3</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>email</sqlt:name>
- <sqlt:data_type>varchar</sqlt:data_type>
- <sqlt:size>255</sqlt:size>
- <sqlt:is_nullable>1</sqlt:is_nullable>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>4</sqlt:order>
- </sqlt:field>
- </sqlt:fields>
- <sqlt:indices>
- <sqlt:index>
- <sqlt:name>titleindex</sqlt:name>
- <sqlt:type>NORMAL</sqlt:type>
- <sqlt:fields>title</sqlt:fields>
- <sqlt:options></sqlt:options>
- </sqlt:index>
- </sqlt:indices>
- <sqlt:constraints>
- <sqlt:constraint>
- <sqlt:name></sqlt:name>
- <sqlt:type>PRIMARY KEY</sqlt:type>
- <sqlt:fields>id</sqlt:fields>
- <sqlt:reference_table></sqlt:reference_table>
- <sqlt:reference_fields></sqlt:reference_fields>
- <sqlt:on_delete></sqlt:on_delete>
- <sqlt:on_update></sqlt:on_update>
- <sqlt:match_type></sqlt:match_type>
- <sqlt:expression></sqlt:expression>
- <sqlt:options></sqlt:options>
- <sqlt:deferrable>1</sqlt:deferrable>
- </sqlt:constraint>
- <sqlt:constraint>
- <sqlt:name></sqlt:name>
- <sqlt:type>UNIQUE</sqlt:type>
- <sqlt:fields>email</sqlt:fields>
- <sqlt:reference_table></sqlt:reference_table>
- <sqlt:reference_fields></sqlt:reference_fields>
- <sqlt:on_delete></sqlt:on_delete>
- <sqlt:on_update></sqlt:on_update>
- <sqlt:match_type></sqlt:match_type>
- <sqlt:expression></sqlt:expression>
- <sqlt:options></sqlt:options>
- <sqlt:deferrable>1</sqlt:deferrable>
- </sqlt:constraint>
- </sqlt:constraints>
- </sqlt:table>
-</sqlt:schema>
-EOXML
-
-$obj = SQL::Translator->new(
- debug => DEBUG,
- trace => TRACE,
- show_warnings => 1,
- add_drop_table => 1,
- from => 'MySQL',
- to => 'XML-SQLFairy',
-);
-lives_ok {$xml = $obj->translate($file);} "Translate (emit_empty_tags=>0) ran";
-ok("$xml" ne "" ,"Produced something!");
-print "XML:\n$xml" if DEBUG;
-# Strip sqlf header with its variable date so we diff safely
-$xml =~ s/^([^\n]*\n){7}//m;
-eq_or_diff $xml, $ans ,"XML looks right";
-
-} # end emit_empty_tags=>0
-
-#
-# emit_empty_tags => 1
-#
-{
-my ($obj,$ans,$xml);
-
-$ans = <<EOXML;
-<sqlt:schema xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:name></sqlt:name>
- <sqlt:database></sqlt:database>
- <sqlt:table>
- <sqlt:name>Basic</sqlt:name>
- <sqlt:order>2</sqlt:order>
- <sqlt:fields>
- <sqlt:field>
- <sqlt:name>id</sqlt:name>
- <sqlt:data_type>integer</sqlt:data_type>
- <sqlt:size>10</sqlt:size>
- <sqlt:is_nullable>0</sqlt:is_nullable>
- <sqlt:default_value></sqlt:default_value>
- <sqlt:is_auto_increment>1</sqlt:is_auto_increment>
- <sqlt:is_primary_key>1</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments>comment on id field</sqlt:comments>
- <sqlt:order>5</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>title</sqlt:name>
- <sqlt:data_type>varchar</sqlt:data_type>
- <sqlt:size>100</sqlt:size>
- <sqlt:is_nullable>0</sqlt:is_nullable>
- <sqlt:default_value>hello</sqlt:default_value>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>6</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>description</sqlt:name>
- <sqlt:data_type>text</sqlt:data_type>
- <sqlt:size>65535</sqlt:size>
- <sqlt:is_nullable>1</sqlt:is_nullable>
- <sqlt:default_value></sqlt:default_value>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>7</sqlt:order>
- </sqlt:field>
- <sqlt:field>
- <sqlt:name>email</sqlt:name>
- <sqlt:data_type>varchar</sqlt:data_type>
- <sqlt:size>255</sqlt:size>
- <sqlt:is_nullable>1</sqlt:is_nullable>
- <sqlt:default_value></sqlt:default_value>
- <sqlt:is_auto_increment>0</sqlt:is_auto_increment>
- <sqlt:is_primary_key>0</sqlt:is_primary_key>
- <sqlt:is_foreign_key>0</sqlt:is_foreign_key>
- <sqlt:comments></sqlt:comments>
- <sqlt:order>8</sqlt:order>
- </sqlt:field>
- </sqlt:fields>
- <sqlt:indices>
- <sqlt:index>
- <sqlt:name>titleindex</sqlt:name>
- <sqlt:type>NORMAL</sqlt:type>
- <sqlt:fields>title</sqlt:fields>
- <sqlt:options></sqlt:options>
- </sqlt:index>
- </sqlt:indices>
- <sqlt:constraints>
- <sqlt:constraint>
- <sqlt:name></sqlt:name>
- <sqlt:type>PRIMARY KEY</sqlt:type>
- <sqlt:fields>id</sqlt:fields>
- <sqlt:reference_table></sqlt:reference_table>
- <sqlt:reference_fields></sqlt:reference_fields>
- <sqlt:on_delete></sqlt:on_delete>
- <sqlt:on_update></sqlt:on_update>
- <sqlt:match_type></sqlt:match_type>
- <sqlt:expression></sqlt:expression>
- <sqlt:options></sqlt:options>
- <sqlt:deferrable>1</sqlt:deferrable>
- </sqlt:constraint>
- <sqlt:constraint>
- <sqlt:name></sqlt:name>
- <sqlt:type>UNIQUE</sqlt:type>
- <sqlt:fields>email</sqlt:fields>
- <sqlt:reference_table></sqlt:reference_table>
- <sqlt:reference_fields></sqlt:reference_fields>
- <sqlt:on_delete></sqlt:on_delete>
- <sqlt:on_update></sqlt:on_update>
- <sqlt:match_type></sqlt:match_type>
- <sqlt:expression></sqlt:expression>
- <sqlt:options></sqlt:options>
- <sqlt:deferrable>1</sqlt:deferrable>
- </sqlt:constraint>
- </sqlt:constraints>
- </sqlt:table>
-</sqlt:schema>
-EOXML
-
-$obj = SQL::Translator->new(
- debug => DEBUG,
- trace => TRACE,
- show_warnings => 1,
- add_drop_table => 1,
- from => 'MySQL',
- to => 'XML-SQLFairy',
- producer_args => { emit_empty_tags => 1 },
-);
-lives_ok { $xml=$obj->translate($file); } "Translate (emit_empty_tags=>1) ran";
-ok("$xml" ne "" ,"Produced something!");
-print "XML emit_empty_tags=>1:\n$xml" if DEBUG;
-# Strip sqlf header with its variable date so we diff safely
-$xml =~ s/^([^\n]*\n){7}//m;
-eq_or_diff $xml, $ans ,"XML looks right";
-
-} # end emit_empty_tags => 1
-
-#
-# attrib_values => 1
-#
-{
-my ($obj,$ans,$xml);
-
-$ans = <<EOXML;
-<sqlt:schema name="" database="" xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:table name="Basic" order="3">
- <sqlt:fields>
- <sqlt:field name="id" data_type="integer" size="10" is_nullable="0" is_auto_increment="1" is_primary_key="1" is_foreign_key="0" comments="comment on id field" order="9" />
- <sqlt:field name="title" data_type="varchar" size="100" is_nullable="0" default_value="hello" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" comments="" order="10" />
- <sqlt:field name="description" data_type="text" size="65535" is_nullable="1" default_value="" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" comments="" order="11" />
- <sqlt:field name="email" data_type="varchar" size="255" is_nullable="1" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" comments="" order="12" />
- </sqlt:fields>
- <sqlt:indices>
- <sqlt:index name="titleindex" type="NORMAL" fields="title" options="" />
- </sqlt:indices>
- <sqlt:constraints>
- <sqlt:constraint name="" type="PRIMARY KEY" fields="id" reference_table="" reference_fields="" on_delete="" on_update="" match_type="" expression="" options="" deferrable="1" />
- <sqlt:constraint name="" type="UNIQUE" fields="email" reference_table="" reference_fields="" on_delete="" on_update="" match_type="" expression="" options="" deferrable="1" />
- </sqlt:constraints>
- </sqlt:table>
-</sqlt:schema>
+<sqlf:schema name="" database="" xmlns:sqlf="http://sqlfairy.sourceforge.net/sqlfairy.xml">
+ <sqlf:table name="Basic" order="1">
+ <sqlf:fields>
+ <sqlf:field name="id" data_type="integer" size="10" is_nullable="0" is_auto_increment="1" is_primary_key="1" is_foreign_key="0" order="1">
+ <sqlf:comments>comment on id field</sqlf:comments>
+ </sqlf:field>
+ <sqlf:field name="title" data_type="varchar" size="100" is_nullable="0" default_value="hello" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" order="2">
+ <sqlf:comments></sqlf:comments>
+ </sqlf:field>
+ <sqlf:field name="description" data_type="text" size="65535" is_nullable="1" default_value="" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" order="3">
+ <sqlf:comments></sqlf:comments>
+ </sqlf:field>
+ <sqlf:field name="email" data_type="varchar" size="255" is_nullable="1" is_auto_increment="0" is_primary_key="0" is_foreign_key="0" order="4">
+ <sqlf:comments></sqlf:comments>
+ </sqlf:field>
+ </sqlf:fields>
+ <sqlf:indices>
+ <sqlf:index name="titleindex" type="NORMAL" fields="title" options="" />
+ </sqlf:indices>
+ <sqlf:constraints>
+ <sqlf:constraint name="" type="PRIMARY KEY" fields="id" reference_table="" reference_fields="" on_delete="" on_update="" match_type="" expression="" options="" deferrable="1" />
+ <sqlf:constraint name="" type="UNIQUE" fields="email" reference_table="" reference_fields="" on_delete="" on_update="" match_type="" expression="" options="" deferrable="1" />
+ </sqlf:constraints>
+ </sqlf:table>
+</sqlf:schema>
EOXML
$obj = SQL::Translator->new(
add_drop_table => 1,
from => "MySQL",
to => "XML-SQLFairy",
- producer_args => { attrib_values => 1 },
);
lives_ok {$xml = $obj->translate($file);} "Translate (attrib_values=>1) ran";
ok("$xml" ne "" ,"Produced something!");
-print "XML attrib_values=>1:\n$xml" if DEBUG;
+print "XML:\n$xml" if DEBUG;
# Strip sqlf header with its variable date so we diff safely
-$xml =~ s/^([^\n]*\n){7}//m;
-eq_or_diff $xml, $ans ,"XML looks right";
+$xml =~ s/^([^\n]*\n){7}//m;
+eq_or_diff $xml, $ans, "XML looks right";
-} # end attrib_values => 1
+} # end basic stuff
#
# View
my ($obj,$ans,$xml);
$ans = <<EOXML;
-<sqlt:schema xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:name></sqlt:name>
- <sqlt:database></sqlt:database>
- <sqlt:view>
- <sqlt:name>foo_view</sqlt:name>
- <sqlt:sql>select name, age from person</sqlt:sql>
- <sqlt:fields>name,age</sqlt:fields>
- <sqlt:order>1</sqlt:order>
- </sqlt:view>
-</sqlt:schema>
+<sqlf:schema name="" database="" xmlns:sqlf="http://sqlfairy.sourceforge.net/sqlfairy.xml">
+ <sqlf:view name="foo_view" fields="name,age" order="1">
+ <sqlf:sql>select name, age from person</sqlf:sql>
+ </sqlf:view>
+</sqlf:schema>
EOXML
$obj = SQL::Translator->new(
fields => $fields,
schema => $s,
) or die $s->error;
-
+
# As we have created a Schema we give translate a dummy string so that
# it will run the produce.
lives_ok {$xml =$obj->translate("FOO");} "Translate (View) ran";
my ($obj,$ans,$xml);
$ans = <<EOXML;
-<sqlt:schema xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:name></sqlt:name>
- <sqlt:database></sqlt:database>
- <sqlt:trigger>
- <sqlt:name>foo_trigger</sqlt:name>
- <sqlt:database_event>insert</sqlt:database_event>
- <sqlt:action>update modified=timestamp();</sqlt:action>
- <sqlt:on_table>foo</sqlt:on_table>
- <sqlt:perform_action_when>after</sqlt:perform_action_when>
- <sqlt:order>1</sqlt:order>
- </sqlt:trigger>
-</sqlt:schema>
+<sqlf:schema name="" database="" xmlns:sqlf="http://sqlfairy.sourceforge.net/sqlfairy.xml">
+ <sqlf:trigger name="foo_trigger" database_event="insert" on_table="foo" perform_action_when="after" order="1">
+ <sqlf:action>update modified=timestamp();</sqlf:action>
+ </sqlf:trigger>
+</sqlf:schema>
EOXML
$obj = SQL::Translator->new(
on_table => $on_table,
action => $action,
) or die $s->error;
-
+
# As we have created a Schema we give translate a dummy string so that
# it will run the produce.
lives_ok {$xml =$obj->translate("FOO");} "Translate (Trigger) ran";
my ($obj,$ans,$xml);
$ans = <<EOXML;
-<sqlt:schema xmlns:sqlt="http://sqlfairy.sourceforge.net/sqlfairy.xml">
- <sqlt:name></sqlt:name>
- <sqlt:database></sqlt:database>
- <sqlt:procedure>
- <sqlt:name>foo_proc</sqlt:name>
- <sqlt:sql>select foo from bar</sqlt:sql>
- <sqlt:parameters>foo,bar</sqlt:parameters>
- <sqlt:owner>Nomar</sqlt:owner>
- <sqlt:comments>Go Sox!</sqlt:comments>
- <sqlt:order>1</sqlt:order>
- </sqlt:procedure>
-</sqlt:schema>
+<sqlf:schema name="" database="" xmlns:sqlf="http://sqlfairy.sourceforge.net/sqlfairy.xml">
+ <sqlf:procedure name="foo_proc" parameters="foo,bar" owner="Nomar" order="1">
+ <sqlf:sql>select foo from bar</sqlf:sql>
+ <sqlf:comments>Go Sox!</sqlf:comments>
+ </sqlf:procedure>
+</sqlf:schema>
EOXML
$obj = SQL::Translator->new(
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Created by SQL::Translator::Producer::XML
-Created on Fri Aug 1 11:24:58 2003
-
- -->
-
-<sqlf:schema xmlns:sqlf="http://sqlfairy.sourceforge.net/sqlfairy.xml">
-
- <sqlf:table>
- <sqlf:name>Basic</sqlf:name>
- <sqlf:order>1</sqlf:order>
- <sqlf:fields>
- <sqlf:field>
- <sqlf:name>id</sqlf:name>
- <sqlf:is_primary_key>1</sqlf:is_primary_key>
- <sqlf:is_auto_increment>1</sqlf:is_auto_increment>
- <sqlf:data_type>int</sqlf:data_type>
- <sqlf:is_nullable>0</sqlf:is_nullable>
- <sqlf:size>10</sqlf:size>
- <sqlf:order>1</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>title</sqlf:name>
- <sqlf:data_type>varchar</sqlf:data_type>
- <sqlf:size>100</sqlf:size>
- <sqlf:default_value>hello</sqlf:default_value>
- <sqlf:is_nullable>0</sqlf:is_nullable>
- <sqlf:order>2</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>description</sqlf:name>
- <sqlf:data_type>text</sqlf:data_type>
- <sqlf:default_value></sqlf:default_value>
- <sqlf:order>3</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>email</sqlf:name>
- <sqlf:data_type>varchar</sqlf:data_type>
- <sqlf:is_nullable>1</sqlf:is_nullable>
- <sqlf:size>255</sqlf:size>
- <sqlf:order>4</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>explicitnulldef</sqlf:name>
- <sqlf:data_type>varchar</sqlf:data_type>
- <sqlf:is_nullable>1</sqlf:is_nullable>
- <sqlf:default_value>NULL</sqlf:default_value>
- <sqlf:order>5</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>explicitemptystring</sqlf:name>
- <sqlf:data_type>varchar</sqlf:data_type>
- <sqlf:is_nullable>1</sqlf:is_nullable>
- <sqlf:default_value>EMPTY_STRING</sqlf:default_value>
- <sqlf:order>6</sqlf:order>
- </sqlf:field>
- <sqlf:field>
- <sqlf:name>emptytagdef</sqlf:name>
- <sqlf:data_type>varchar</sqlf:data_type>
- <sqlf:is_nullable>1</sqlf:is_nullable>
- <sqlf:default_value/>
- <sqlf:order>7</sqlf:order>
- </sqlf:field>
- </sqlf:fields>
-
- <sqlf:indices>
- <sqlf:index>
- <sqlf:fields>title</sqlf:fields>
- <sqlf:name>titleindex</sqlf:name>
- <sqlf:type>NORMAL</sqlf:type>
- </sqlf:index>
- </sqlf:indices>
-
- <sqlf:constraints>
- <sqlf:constraint>
- <sqlf:deferrable>1</sqlf:deferrable>
- <sqlf:fields>email</sqlf:fields>
- <sqlf:name>emailuniqueindex</sqlf:name>
- <sqlf:type>UNIQUE</sqlf:type>
- </sqlf:constraint>
- </sqlf:constraints>
- </sqlf:table>
-
- <sqlf:view>
- <sqlf:fields>email</sqlf:fields>
- <sqlf:name>email_list</sqlf:name>
- <sqlf:order>1</sqlf:order>
- <sqlf:sql>SELECT email FROM Basic WHERE email IS NOT NULL</sqlf:sql>
- </sqlf:view>
-
- <sqlf:trigger>
- <sqlf:action>update modified=timestamp();</sqlf:action>
- <sqlf:database_event>insert</sqlf:database_event>
- <sqlf:name>foo_trigger</sqlf:name>
- <sqlf:on_table>foo</sqlf:on_table>
- <sqlf:order>1</sqlf:order>
- <sqlf:perform_action_when>after</sqlf:perform_action_when>
- </sqlf:trigger>
-
- <sqlf:procedure>
- <sqlf:comments>Go Sox!</sqlf:comments>
- <sqlf:name>foo_proc</sqlf:name>
- <sqlf:order>1</sqlf:order>
- <sqlf:owner>Nomar</sqlf:owner>
- <sqlf:parameters>foo,bar</sqlf:parameters>
- <sqlf:sql>select foo from bar</sqlf:sql>
- </sqlf:procedure>
-
-</sqlf:schema>