From: Mark Addison Date: Mon, 29 Mar 2004 09:57:50 +0000 (+0000) Subject: Added shortcut method to get the fields Schema object. X-Git-Tag: v0.06~118 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c1e3c768182d75d6b1f24aeba26964602994a01c;p=dbsrgits%2FSQL-Translator.git Added shortcut method to get the fields Schema object. --- diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index 483becc..aa6ff1d 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.17 2004-03-23 21:45:19 grommit Exp $ +# $Id: Field.pm,v 1.18 2004-03-29 09:57:50 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -50,7 +50,7 @@ use SQL::Translator::Utils 'parse_list_arg'; use base 'Class::Base'; use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.17 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.18 $ =~ /(\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 @@ -489,6 +489,23 @@ Get or set the field's order. } # ---------------------------------------------------------------------- +sub schema { + +=head2 schema + +Shortcut to get the fields schema ($field->table->schema) or undef if it +doesn't have one. + + my $schema = $field->schema; + +=cut + + my $self = shift; + if ( my $table = $self->table ) { return $table->schema || undef; } + return undef; +} + +# ---------------------------------------------------------------------- sub size { =pod