comparison Lib/IMPL/SQL/Schema/Type.pm @ 167:1f7a6d762394

SQL schema in progress
author sourcer
date Thu, 12 May 2011 08:57:19 +0400
parents 76515373dac0
children d1676be8afcc
comparison
equal deleted inserted replaced
166:4267a2ac3d46 167:1f7a6d762394
1 use strict; 1 use strict;
2 use warnings;
2 package IMPL::SQL::Schema::Type; 3 package IMPL::SQL::Schema::Type;
4
3 use parent qw(IMPL::Object IMPL::Object::Autofill); 5 use parent qw(IMPL::Object IMPL::Object::Autofill);
4 use IMPL::Class::Property; 6
7 use IMPL::lang qw( :declare :constants :compare );
8
5 use IMPL::Class::Property::Direct; 9 use IMPL::Class::Property::Direct;
6 10
7 BEGIN { 11 BEGIN {
8 public _direct property name => prop_get; 12 public _direct property name => PROP_GET;
9 public _direct property maxLength => prop_get; 13 public _direct property maxLength => PROP_GET;
10 public _direct property scale => prop_get; 14 public _direct property scale => PROP_GET;
11 public _direct property unsigned => prop_get; 15 public _direct property unsigned => PROP_GET;
12 public _direct property zerofill => prop_get; 16 public _direct property zerofill => PROP_GET;
13 public _direct property tag => prop_get; 17 public _direct property tag => PROP_GET;
14 } 18 }
15 19
16 __PACKAGE__->PassThroughArgs; 20 __PACKAGE__->PassThroughArgs;
17 21
18 sub CTOR { 22 sub CTOR {
19 my $this = shift; 23 my $this = shift;
20 24
21 $this->{$scale} = 0 if not $this->{$scale}; 25 $this->{$scale} = 0 if not $this->{$scale};
22 } 26 }
23 27
24 sub isEquals { 28 sub SameValue {
25 my ($a,$b) = @_;
26
27 if (defined $a and defined $b) {
28 return $a == $b;
29 } else {
30 if (defined $a or defined $b) {
31 return 0;
32 } else {
33 return 1;
34 }
35 }
36 }
37
38 sub isSame {
39 my ($this,$other) = @_; 29 my ($this,$other) = @_;
40 30
41 return ($this->{$name} eq $other->{$name} and isEquals($this->{$maxLength},$other->{$maxLength}) and isEquals($this->{$scale},$other->{$scale})); 31 return (
32 $this->{$name} eq $other->name
33 and equals($this->{$maxLength},$other->{$maxLength})
34 and equals($this->{$scale},$other->{$scale})
35 );
42 } 36 }
43 37
44 1; 38 1;
45 39
46 __END__ 40 __END__