From: Paul Harrington Date: Wed, 8 Oct 2003 18:35:15 +0000 (+0000) Subject: reverting to previous revision as I had duplicated some of the subroutines to handle... X-Git-Tag: v0.04~107 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=42624697766641e212200d69521377a6162fa0da;p=dbsrgits%2FSQL-Translator.git reverting to previous revision as I had duplicated some of the subroutines to handle procedures... sorry about that! --- diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index 02962d2..beac893 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.11 2003-10-08 18:30:15 phrrngtn Exp $ +# $Id: Schema.pm,v 1.12 2003-10-08 18:35:15 phrrngtn Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark # @@ -49,15 +49,12 @@ use SQL::Translator::Schema::Procedure; use SQL::Translator::Schema::Table; use SQL::Translator::Schema::Trigger; use SQL::Translator::Schema::View; -use SQL::Translator::Schema::Procedure; - use SQL::Translator::Utils 'parse_list_arg'; - use base 'Class::Base'; use vars qw[ $VERSION $TABLE_ORDER $VIEW_ORDER $TRIGGER_ORDER $PROC_ORDER ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.11 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/; # ---------------------------------------------------------------------- sub init { @@ -271,53 +268,6 @@ not be created. } # ---------------------------------------------------------------------- -sub add_procedure { - -=pod - -=head2 add_procedure - -Add a procedure object. Returns the new -SQL::Translator::Schema::Procedure object. The "name" parameter is -required. If you try to create a procedure with the same name as an -existing procedure, you will get an error and the procedure will not -be created. - - my $p1 = $schema->add_procedure( name => 'foo' ); - my $p2 = SQL::Translator::Schema::Procedure->new( name => 'bar' ); - $p2 = $schema->add_procedure( $p2 ) or die $schema->error; - -=cut - - my $self = shift; - my $procedure_class = 'SQL::Translator::Schema::Procedure'; - my $procedure; - - if ( UNIVERSAL::isa( $_[0], $procedure_class ) ) { - $procedure= shift; - $procedure->schema( $self ); - } - else { - my %args = @_; - return $self->error('No procedure name') unless $args{'name'}; - $args{'schema'} = $self; - $procedure = $procedure_class->new( \%args ) or return $procedure_class->error; - } - - my $procedure_name = $procedure->name or return $self->error('No procedure name'); - - if ( defined $self->{'procedures'}{ $procedure_name } ) { - return $self->error(qq[Can't create procedure: "$procedure_name" exists]); - } - else { - $self->{'procedures'}{ $procedure_name } = $procedure; - } - - return $procedure; -} - - -# ---------------------------------------------------------------------- sub database { =pod @@ -555,53 +505,6 @@ Returns all the views as an array or array reference. } } - - -# ---------------------------------------------------------------------- -sub get_procedure { - -=pod - -=head2 get_procedure - -Returns a procedure by the name provided. - - my $view = $schema->get_procedure('foo'); - -=cut - - my $self = shift; - my $procedure_name = shift or return $self->error('No procedure name'); - return $self->error('Procedure "$procedure_name" does not exist') unless - exists $self->{'procedures'}{ $procedure_name }; - return $self->{'procedures'}{ $procedure_name }; -} - -# ---------------------------------------------------------------------- -sub get_procedures { - -=pod - -=head2 get_procedures - -Returns all the procedures as an array or array reference. - - my @procedures = $schema->get_procedures; - -=cut - - my $self = shift; - my @procedures = values %{ $self->{'procedures'} }; - - if ( @procedures ) { - return wantarray ? @procedures : \@procedures; - } - else { - $self->error('No procedures'); - return wantarray ? () : undef; - } -} - # ---------------------------------------------------------------------- sub make_natural_joins {