package SQL::Translator::Parser::YAML;
# -------------------------------------------------------------------
-# $Id: YAML.pm,v 1.4 2004-01-25 18:10:55 kycl4rk Exp $
+# $Id: YAML.pm,v 1.7 2005-06-08 11:30:15 grommit Exp $
# -------------------------------------------------------------------
-# Copyright (C) 2003 darren chamberlain <darren@cpan.org>,
-# Ken Y. Clark <kclark@cpan.org>.
+# Copyright (C) 2002-4 SQLFairy Authors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
use strict;
use vars qw($VERSION);
-$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/;
use SQL::Translator::Schema;
use SQL::Translator::Utils qw(header_comment);
$data = Load($data);
$data = $data->{'schema'};
- warn Dumper( $data ) if $translator->debug;
+ warn "YAML data:",Dumper( $data ) if $translator->debug;
my $schema = $translator->schema;
for my $tdata ( @tables ) {
my $table = $schema->add_table(
name => $tdata->{'name'},
+ extra => $tdata->{'extra'},
) or die $schema->error;
my @fields =
$schema->add_procedure( %$tdata ) or die $schema->error;
}
+ if ( my $tr_data = $data->{'translator'} ) {
+ $translator->add_drop_table( $tr_data->{'add_drop_table'} );
+ $translator->filename( $tr_data->{'filename'} );
+ $translator->no_comments( $tr_data->{'no_comments'} );
+ $translator->parser_args( $tr_data->{'parser_args'} );
+ $translator->producer_args( $tr_data->{'producer_args'} );
+ $translator->parser_type( $tr_data->{'parser_type'} );
+ $translator->producer_type( $tr_data->{'producer_type'} );
+ $translator->show_warnings( $tr_data->{'show_warnings'} );
+ $translator->trace( $tr_data->{'trace'} );
+ }
+
return 1;
}
C<SQL::Translator::Parser::YAML> parses a schema serialized with YAML.
-=head1 AUTHOR
+=head1 AUTHORS
Darren Chamberlain E<lt>darren@cpan.orgE<gt>,
Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.