comparison Lib/Schema/DB/Type.pm @ 0:03e58a454b20

Создан репозитарий
author Sergey
date Tue, 14 Jul 2009 12:54:37 +0400
parents
children 16ada169ca75
comparison
equal deleted inserted replaced
-1:000000000000 0:03e58a454b20
1 use strict;
2 package Schema::DB::Type;
3 use Common;
4 our @ISA=qw(Object);
5
6 BEGIN {
7 DeclareProperty Name => ACCESS_READ;
8 DeclareProperty MaxLength => ACCESS_READ;
9 DeclareProperty Scale => ACCESS_READ;
10 DeclareProperty Unsigned => ACCESS_READ;
11 DeclareProperty Zerofill => ACCESS_READ;
12 DeclareProperty Tag => ACCESS_READ;
13 }
14
15 sub CTOR {
16 my $this = shift;
17 $this->SUPER::CTOR(@_);
18
19 $this->{$Scale} = 0 if not $this->{$Scale};
20 }
21
22 sub isEquals {
23 my ($a,$b) = @_;
24
25 if (defined $a and defined $b) {
26 return $a == $b;
27 } else {
28 if (defined $a or defined $b) {
29 return 0;
30 } else {
31 return 1;
32 }
33 }
34 }
35
36 sub isSame {
37 my ($this,$other) = @_;
38
39 return ($this->{$Name} eq $other->{$Name} and isEquals($this->{$MaxLength},$other->{$MaxLength}) and isEquals($this->{$Scale},$other->{$Scale}));
40 }
41
42 1;