From: Darren Chamberlain Date: Mon, 27 Jan 2003 17:04:48 +0000 (+0000) Subject: Documentation fixes; added Chris' name to copyright notice; updated copyright year. X-Git-Tag: v0.01~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=abfa405acf15e963e5b5760fa74464d91ca25f7e;p=dbsrgits%2FSQL-Translator.git Documentation fixes; added Chris' name to copyright notice; updated copyright year. --- diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm index 872f53b..b9d0727 100644 --- a/lib/SQL/Translator.pm +++ b/lib/SQL/Translator.pm @@ -1,10 +1,11 @@ package SQL::Translator; # ---------------------------------------------------------------------- -# $Id: Translator.pm,v 1.14 2002-11-26 03:59:57 kycl4rk Exp $ +# $Id: Translator.pm,v 1.15 2003-01-27 17:04:43 dlc Exp $ # ---------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -50,10 +51,10 @@ SQL::Translator - convert schema from one database to another This module attempts to simplify the task of converting one database create syntax to another through the use of Parsers (which understand -the sourced format) and Producers (which understand the destination +the source format) and Producers (which understand the destination format). The idea is that any Parser can be used with any Producer in -the conversion process. So, if you wanted PostgreSQL-to-Oracle, you -would use the PostgreSQL parser and the Oracle producer. +the conversion process. So, if you wanted Postgres-to-Oracle, you +would use the Postgres parser and the Oracle producer. =cut @@ -62,7 +63,7 @@ use vars qw( $VERSION $REVISION $DEFAULT_SUB $DEBUG $ERROR ); use base 'Class::Base'; $VERSION = '0.01'; -$REVISION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/; +$REVISION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; $ERROR = ""; @@ -176,7 +177,6 @@ sub init { =head1 METHODS -# ---------------------------------------------------------------------- =head2 B Toggles whether or not to add "DROP TABLE" statements just before the @@ -193,7 +193,6 @@ sub add_drop_table { } -# ---------------------------------------------------------------------- =head2 B Allows the user to override default translation of fields. For example, @@ -210,7 +209,6 @@ sub custom_translate { return $self->{'custom_translate'} || {}; } -# ---------------------------------------------------------------------- =head2 B Toggles whether to print comments in the output. Accepts a true or false @@ -227,13 +225,12 @@ sub no_comments { return $self->{'no_comments'} || 0; } -# ---------------------------------------------------------------------- =head2 B The B method is an accessor/mutator, used to retrieve or define what subroutine is called to produce the output. A subroutine -defined as a producer will be invoked as a function (not a method) and -passed 2 parameters: its container SQL::Translator instance and a +defined as a producer will be invoked as a function (I) +and passed 2 parameters: its container SQL::Translator instance and a data structure. It is expected that the function transform the data structure to a string. The SQL::Transformer instance is provided for informational purposes; for example, the type of the parser can be @@ -402,7 +399,6 @@ sub producer_args { $self->{'producer_args'}; } -# ---------------------------------------------------------------------- =head2 B The B method defines or retrieves a subroutine that will be @@ -507,7 +503,6 @@ sub parser_args { $self->{'parser_args'}; } -# ---------------------------------------------------------------------- =head2 B Toggles whether to print warnings of name conflicts, identifier @@ -527,7 +522,6 @@ sub show_warnings { return $self->{'show_warnings'} || 0; } -# ---------------------------------------------------------------------- =head2 B The B method calls the subroutines referenced by the @@ -574,7 +568,6 @@ You get the idea. =back -# ---------------------------------------------------------------------- =head2 B, B Using the B method, the filename of the data to be parsed @@ -663,7 +656,6 @@ sub data { return $self->{'data'}; } -# ---------------------------------------------------------------------- =pod =head2 B @@ -827,7 +819,7 @@ sub load { } # ---------------------------------------------------------------------- -sub isa { UNIVERSAL::isa($_[0], $_[1]) } +sub isa($$) { UNIVERSAL::isa($_[0], $_[1]) } 1; @@ -862,6 +854,9 @@ USA =head1 SEE ALSO -L, L +L, +L, +L, +L =cut diff --git a/lib/SQL/Translator/Parser.pm b/lib/SQL/Translator/Parser.pm index f3f3af6..1e8a655 100644 --- a/lib/SQL/Translator/Parser.pm +++ b/lib/SQL/Translator/Parser.pm @@ -1,10 +1,11 @@ package SQL::Translator::Parser; # ---------------------------------------------------------------------- -# $Id: Parser.pm,v 1.5 2002-11-22 03:03:40 kycl4rk Exp $ +# $Id: Parser.pm,v 1.6 2003-01-27 17:04:44 dlc Exp $ # ---------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Parser; use strict; use vars qw( $VERSION ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; sub parse { "" } diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index ece96e5..93cdcc3 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -1,10 +1,11 @@ package SQL::Translator::Parser::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.8 2002-11-28 04:21:06 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.9 2003-01-27 17:04:45 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -41,7 +42,7 @@ The grammar is influenced heavily by Tim Bunce's "mysql2ora" grammar. use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use Data::Dumper; diff --git a/lib/SQL/Translator/Parser/Sybase.pm b/lib/SQL/Translator/Parser/Sybase.pm index f0369a8..db4b7c8 100644 --- a/lib/SQL/Translator/Parser/Sybase.pm +++ b/lib/SQL/Translator/Parser/Sybase.pm @@ -1,10 +1,11 @@ package SQL::Translator::Parser::Sybase; # ------------------------------------------------------------------- -# $Id: Sybase.pm,v 1.3 2002-11-22 03:03:40 kycl4rk Exp $ +# $Id: Sybase.pm,v 1.4 2003-01-27 17:04:46 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as diff --git a/lib/SQL/Translator/Parser/xSV.pm b/lib/SQL/Translator/Parser/xSV.pm index f93d61b..46b9624 100644 --- a/lib/SQL/Translator/Parser/xSV.pm +++ b/lib/SQL/Translator/Parser/xSV.pm @@ -1,10 +1,11 @@ package SQL::Translator::Parser::xSV; # ------------------------------------------------------------------- -# $Id: xSV.pm,v 1.3 2002-11-22 03:03:40 kycl4rk Exp $ +# $Id: xSV.pm,v 1.4 2003-01-27 17:04:46 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Parser::xSV; use strict; use vars qw($VERSION @EXPORT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; use Exporter; use Text::ParseWords qw(quotewords); diff --git a/lib/SQL/Translator/Producer.pm b/lib/SQL/Translator/Producer.pm index 25cac69..dff7fea 100644 --- a/lib/SQL/Translator/Producer.pm +++ b/lib/SQL/Translator/Producer.pm @@ -1,10 +1,11 @@ package SQL::Translator::Producer; # ------------------------------------------------------------------- -# $Id: Producer.pm,v 1.4 2002-11-22 03:03:40 kycl4rk Exp $ +# $Id: Producer.pm,v 1.5 2003-01-27 17:04:45 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Producer; use strict; use vars qw($VERSION); -$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; sub produce { "" } diff --git a/lib/SQL/Translator/Producer/MySQL.pm b/lib/SQL/Translator/Producer/MySQL.pm index a6b2e4f..c97b433 100644 --- a/lib/SQL/Translator/Producer/MySQL.pm +++ b/lib/SQL/Translator/Producer/MySQL.pm @@ -1,10 +1,11 @@ package SQL::Translator::Producer::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.4 2002-11-22 03:03:40 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.5 2003-01-27 17:04:46 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Producer::MySQL; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use Data::Dumper; diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index 84dfc31..f3664f9 100644 --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@ -1,10 +1,11 @@ package SQL::Translator::Producer::Oracle; # ------------------------------------------------------------------- -# $Id: Oracle.pm,v 1.8 2002-12-11 01:44:54 kycl4rk Exp $ +# $Id: Oracle.pm,v 1.9 2003-01-27 17:04:46 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Producer::Oracle; use strict; use vars qw[ $VERSION $DEBUG $WARN ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; my %translate = ( diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index 96b85dd..90f0118 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -1,10 +1,11 @@ package SQL::Translator::Producer::PostgreSQL; # ------------------------------------------------------------------- -# $Id: PostgreSQL.pm,v 1.5 2003-01-02 17:47:59 kycl4rk Exp $ +# $Id: PostgreSQL.pm,v 1.6 2003-01-27 17:04:48 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -29,7 +30,7 @@ SQL::Translator::Producer::PostgreSQL - PostgreSQL producer for SQL::Translator use strict; use vars qw[ $DEBUG $WARN $VERSION ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use Data::Dumper; diff --git a/lib/SQL/Translator/Producer/XML.pm b/lib/SQL/Translator/Producer/XML.pm index 66b3e88..e71b281 100644 --- a/lib/SQL/Translator/Producer/XML.pm +++ b/lib/SQL/Translator/Producer/XML.pm @@ -1,10 +1,11 @@ package SQL::Translator::Producer::XML; # ------------------------------------------------------------------- -# $Id: XML.pm,v 1.4 2002-11-28 04:21:07 kycl4rk Exp $ +# $Id: XML.pm,v 1.5 2003-01-27 17:04:48 dlc Exp $ # ------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -37,7 +38,7 @@ Meant to create some sort of usable XML output. use strict; use vars qw[ $VERSION $XML ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/; # ------------------------------------------------------------------- sub produce { diff --git a/lib/SQL/Translator/Validator.pm b/lib/SQL/Translator/Validator.pm index 948c5fa..97910e7 100644 --- a/lib/SQL/Translator/Validator.pm +++ b/lib/SQL/Translator/Validator.pm @@ -1,10 +1,11 @@ package SQL::Translator::Validator; # ---------------------------------------------------------------------- -# $Id: Validator.pm,v 1.6 2002-11-25 14:49:44 dlc Exp $ +# $Id: Validator.pm,v 1.7 2003-01-27 17:04:45 dlc Exp $ # ---------------------------------------------------------------------- -# Copyright (C) 2002 Ken Y. Clark , -# darren chamberlain +# Copyright (C) 2003 Ken Y. Clark , +# darren chamberlain , +# Chris Mungall # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -23,7 +24,7 @@ package SQL::Translator::Validator; use strict; use vars qw($VERSION @EXPORT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; use Exporter; use base qw(Exporter); @@ -129,8 +130,7 @@ SQL::Translator::Validate - Validate that a data structure is correct =head1 SYNOPSIS - print "1..1\n"; - + use Test::More plan tests => 1; use SQL::Translator; use SQL::Translator::Validator; @@ -139,8 +139,7 @@ SQL::Translator::Validate - Validate that a data structure is correct # Default producer passes the data structure through unchanged my $parsed = $tr->translate($datafile); - print "not " unless validate($parsed); - print "ok 1 # data structure looks OK\n"; + ok(validate($parsed), "data structure conformance to definition"); =head1 DESCRIPTION @@ -157,13 +156,13 @@ testing tool (every SQL::Translator install will have this module), or, potentially, even as a runtime assertion for producers you don't trust: - $tr->producer(\¶noid_producer); + $tr->producer(\¶noid_producer, real_producer => "MySQL"); sub paranoid_producer { my ($tr, $data) = @_; validate($data) or die "You gave me crap!" # Load real producer, and execute it - $tr->producer("MySQL"); + $tr->producer($tr->producer_args->{'real_producer'}); return $tr->produce($data); }