From: Mark Addison Date: Thu, 4 Nov 2004 16:29:56 +0000 (+0000) Subject: Added SQL::Translator::Schema::Object, a base class for all the Schema X-Git-Tag: v0.11008~605 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6a880d1daac518c07475bad0c7ef74d0416386b;p=dbsrgits%2FSQL-Translator.git Added SQL::Translator::Schema::Object, a base class for all the Schema objects and made them all use it. --- diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index 6f4ddfa..bbd5ae4 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema; # ---------------------------------------------------------------------- -# $Id: Schema.pm,v 1.18 2004-10-15 03:52:50 allenday Exp $ +# $Id: Schema.pm,v 1.19 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -43,7 +43,6 @@ returns the database structure. =cut use strict; -use Class::Base; use SQL::Translator::Schema::Constants; use SQL::Translator::Schema::Procedure; use SQL::Translator::Schema::Table; @@ -52,10 +51,10 @@ use SQL::Translator::Schema::View; use SQL::Translator::Schema::Graph; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; use vars qw[ $VERSION $TABLE_ORDER $VIEW_ORDER $TRIGGER_ORDER $PROC_ORDER ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- sub init { diff --git a/lib/SQL/Translator/Schema/Constraint.pm b/lib/SQL/Translator/Schema/Constraint.pm index 49126b1..423a592 100644 --- a/lib/SQL/Translator/Schema/Constraint.pm +++ b/lib/SQL/Translator/Schema/Constraint.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Constraint; # ---------------------------------------------------------------------- -# $Id: Constraint.pm,v 1.13 2004-03-29 11:18:12 grommit Exp $ +# $Id: Constraint.pm,v 1.14 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -44,14 +44,14 @@ C is the constraint object. =cut use strict; -use Class::Base; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.13 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/; my %VALID_CONSTRAINT_TYPE = ( PRIMARY_KEY, 1, diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index f306ff4..e42ae93 100644 --- a/lib/SQL/Translator/Schema/Field.pm +++ b/lib/SQL/Translator/Schema/Field.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Field; # ---------------------------------------------------------------------- -# $Id: Field.pm,v 1.19 2004-07-09 00:46:28 grommit Exp $ +# $Id: Field.pm,v 1.20 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -43,14 +43,14 @@ C is the field object. =cut use strict; -use Class::Base; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/; # Stringify to our name, being careful not to pass any args through so we don't # accidentally set it to undef. We also have to tweak bool so the object is diff --git a/lib/SQL/Translator/Schema/Index.pm b/lib/SQL/Translator/Schema/Index.pm index 9b482af..7c3682d 100644 --- a/lib/SQL/Translator/Schema/Index.pm +++ b/lib/SQL/Translator/Schema/Index.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Index; # ---------------------------------------------------------------------- -# $Id: Index.pm,v 1.8 2004-02-09 22:15:15 kycl4rk Exp $ +# $Id: Index.pm,v 1.9 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -46,14 +46,14 @@ Primary and unique keys are table constraints, not indices. =cut use strict; -use Class::Base; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; my %VALID_INDEX_TYPE = ( UNIQUE, 1, diff --git a/lib/SQL/Translator/Schema/Object.pm b/lib/SQL/Translator/Schema/Object.pm new file mode 100644 index 0000000..856c511 --- /dev/null +++ b/lib/SQL/Translator/Schema/Object.pm @@ -0,0 +1,64 @@ +package SQL::Translator::Schema::Object; + +# ---------------------------------------------------------------------- +# $Id: Object.pm,v 1.1 2004-11-04 16:29:56 grommit Exp $ +# ---------------------------------------------------------------------- +# 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 +# published by the Free Software Foundation; version 2. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA +# ------------------------------------------------------------------- + +=pod + +=head1 NAME + +SQL::Translator::Schema::Object - Base class SQL::Translator Schema objects. + +=head1 SYNOPSIS + +=head1 DESCSIPTION + +Doesn't currently provide any functionaliy apart from sub classing +L. Here to provide a single place to impliment global Schema +object functionality. + +=cut + +use strict; +use Class::Base; +use base 'Class::Base'; + +use vars qw[ $VERSION ]; + +$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/; + + +1; + +# ---------------------------------------------------------------------- + +=pod + +=head1 SEE ALSO + +=head1 TODO + +=head1 BUGS + +=head1 AUTHOR + +Ken Y. Clark Ekclark@cpan.orgE, Mark Addison Emark.addison@itn.co.ukE + +=cut diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index 5ec5f82..bfc0f2e 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Procedure; # ---------------------------------------------------------------------- -# $Id: Procedure.pm,v 1.2 2004-02-09 22:15:15 kycl4rk Exp $ +# $Id: Procedure.pm,v 1.3 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -48,13 +48,13 @@ stored procedures (and possibly other pieces of nameable SQL code?). =cut use strict; -use Class::Base; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION); -$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- sub init { diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index c178ba5..64e3b83 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Table; # ---------------------------------------------------------------------- -# $Id: Table.pm,v 1.26 2004-03-29 12:25:54 grommit Exp $ +# $Id: Table.pm,v 1.27 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -40,7 +40,6 @@ C is the table object. =cut use strict; -use Class::Base; use SQL::Translator::Utils 'parse_list_arg'; use SQL::Translator::Schema::Constants; use SQL::Translator::Schema::Constraint; @@ -48,10 +47,11 @@ use SQL::Translator::Schema::Field; use SQL::Translator::Schema::Index; use Data::Dumper; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw( $VERSION $FIELD_ORDER ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.26 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.27 $ =~ /(\d+)\.(\d+)/; # Stringify to our name, being careful not to pass any args through so we don't diff --git a/lib/SQL/Translator/Schema/Trigger.pm b/lib/SQL/Translator/Schema/Trigger.pm index bc726b5..90cfd5b 100644 --- a/lib/SQL/Translator/Schema/Trigger.pm +++ b/lib/SQL/Translator/Schema/Trigger.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::Trigger; # ---------------------------------------------------------------------- -# $Id: Trigger.pm,v 1.3 2004-02-09 22:15:15 kycl4rk Exp $ +# $Id: Trigger.pm,v 1.4 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -48,13 +48,13 @@ C is the trigger object. =cut use strict; -use Class::Base; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- sub init { diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index d0d6bf6..afd3b5b 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -1,7 +1,7 @@ package SQL::Translator::Schema::View; # ---------------------------------------------------------------------- -# $Id: View.pm,v 1.7 2004-02-09 22:15:15 kycl4rk Exp $ +# $Id: View.pm,v 1.8 2004-11-04 16:29:56 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -44,13 +44,13 @@ C is the view object. =cut use strict; -use Class::Base; use SQL::Translator::Utils 'parse_list_arg'; -use base 'Class::Base'; +use base 'SQL::Translator::Schema::Object'; + use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- sub init {