package SQL::Translator::Schema::Field;
# ----------------------------------------------------------------------
-# $Id: Field.pm,v 1.14 2004-03-23 21:05:19 grommit Exp $
+# $Id: Field.pm,v 1.15 2004-03-23 21:26:55 grommit Exp $
# ----------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use base 'Class::Base';
use vars qw($VERSION $TABLE_COUNT $VIEW_COUNT);
-$VERSION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\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
return $self->{'name'} || '';
}
+sub full_name {
+
+=head2 full_name
+
+Read only method to return the fields name with its table name pre-pended.
+e.g. "person.foo".
+
+=cut
+
+ my $self = shift;
+ return $self->table.".".$self->name;
+}
+
# ----------------------------------------------------------------------
sub order {
$| = 1;
use strict;
-use Test::More tests => 196;
+use Test::More tests => 197;
use SQL::Translator::Schema::Constants;
require_ok( 'SQL::Translator::Schema' );
warn $person_table->error;
isa_ok( $f1, 'SQL::Translator::Schema::Field', 'Field' );
is( $f1->name, 'foo', 'Field name is "foo"' );
+ is( $f1->full_name, 'person.foo', 'Field full_name is "person.foo"' );
is( "$f1", 'foo', 'Field stringifies to "foo"' );
is( $f1->data_type, '', 'Field data type is blank' );
is( $f1->size, 0, 'Field size is "0"' );