comparison Lib/IMPL/SQL/Schema/Column.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 6148f89bb7bf
children 5c82eec23bb6
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
18 18
19 sub CTOR { 19 sub CTOR {
20 my $this = shift; 20 my $this = shift;
21 21
22 $this->{$name} or 22 $this->{$name} or
23 die new IMPL::InvalidArgumentException('A column name is required'); 23 die new IMPL::InvalidArgumentException('A column name is required');
24 24
25 $this->{$isNullable} = 0 if not exists $this->{$isNullable}; 25 $this->{$isNullable} = 0 if not exists $this->{$isNullable};
26 26
27 is( $this->{$type}, typeof IMPL::SQL::Schema::Type) or 27 is( $this->{$type}, typeof IMPL::SQL::Schema::Type) or
28 die new IMPL::InvalidArgumentException('a type is required for the column',$this->{$name}); 28 die new IMPL::InvalidArgumentException('a type is required for the column',$this->{$name});
29 } 29 }
30 30
31 sub SameValue { 31 sub SameValue {
32 my ($this,$other) = @_; 32 my ($this,$other) = @_;
33 33
34 return ( 34 return (
35 $this->{$name} eq $other->{$name} 35 $this->{$name} eq $other->{$name}
36 and $this->{$isNullable} == $other->{$isNullable} 36 and $this->{$isNullable} == $other->{$isNullable}
37 and equals_s($this->{$defaultValue}, $other->{$defaultValue}) 37 and equals_s($this->{$defaultValue}, $other->{$defaultValue})
38 and $this->{$type}->SameValue($other->{$type}) 38 and $this->{$type}->SameValue($other->{$type})
39 ); 39 );
40 } 40 }
41 41
42 sub SetType { 42 sub SetType {
43 my ($this,$newType) = @_; 43 my ($this,$newType) = @_;
44 44
45 $this->{$type} = $newType; 45 $this->{$type} = $newType;
46 } 46 }
47 47
48 sub SetDefaultValue { 48 sub SetDefaultValue {
49 my ($this,$value) = @_; 49 my ($this,$value) = @_;
50 50
51 $this->{$defaultValue} = $value; 51 $this->{$defaultValue} = $value;
52 } 52 }
53 53
54 sub SetNullable { 54 sub SetNullable {
55 my ($this, $value) = @_; 55 my ($this, $value) = @_;
56 56
57 $this->{$isNullable} = $value; 57 $this->{$isNullable} = $value;
58 } 58 }
59 59
60 sub SetOptions { 60 sub SetOptions {
61 my ($this,$diff) = @_; 61 my ($this,$diff) = @_;
62 62
63 return unless ref $diff eq 'HASH'; 63 return unless ref $diff eq 'HASH';
64 64
65 $this->tag({}) unless $this->tag; 65 $this->tag({}) unless $this->tag;
66 66
67 hashApply($this->tag,$diff); 67 hashApply($this->tag,$diff);
68 } 68 }
69 69
70 1; 70 1;