49
|
1 use strict;
|
|
2 package IMPL::SQL::Schema::Column;
|
165
|
3 use parent qw(IMPL::Object IMPL::Object::Autofill);
|
49
|
4
|
167
|
5 use IMPL::lang qw( :DEFAULT :compare :declare :constants );
|
49
|
6 use IMPL::Class::Property::Direct;
|
167
|
7 use IMPL::Exception();
|
49
|
8
|
|
9 BEGIN {
|
167
|
10 public _direct property name => PROP_GET;
|
|
11 public _direct property type => PROP_GET;
|
|
12 public _direct property isNullable => PROP_GET;
|
|
13 public _direct property defaultValue => PROP_GET;
|
|
14 public _direct property tag => PROP_GET;
|
49
|
15 }
|
|
16
|
|
17 __PACKAGE__->PassThroughArgs;
|
|
18
|
|
19 sub CTOR {
|
|
20 my $this = shift;
|
|
21
|
167
|
22 $this->{$name} or
|
|
23 die new IMPL::InvalidArgumentException('A column name is required');
|
49
|
24
|
167
|
25 $this->{$isNullable} = 0 if not exists $this->{$isNullable};
|
|
26
|
|
27 is( $this->{$type}, typeof IMPL::SQL::Schema::Type) or
|
|
28 die new IMPL::InvalidArgumentException('a type is required for the column',$this->{$name});
|
49
|
29 }
|
|
30
|
167
|
31 sub SameValue {
|
49
|
32 my ($this,$other) = @_;
|
|
33
|
167
|
34 return (
|
|
35 $this->{$name} eq $other->{$name}
|
|
36 and $this->{$isNullable} == $other->{$isNullable}
|
|
37 and equals_s($this->{$defaultValue}, $other->{$defaultValue})
|
|
38 and $this->{$type}->SameValue($other->{$type})
|
|
39 );
|
49
|
40 }
|
|
41
|
|
42 1;
|