annotate Lib/IMPL/SQL/Schema/Type.pm @ 250:129e48bb5afb

DOM refactoring ObjectToDOM methods are virtual QueryToDOM uses inflators Fixed transform for the complex values in the ObjectToDOM QueryToDOM doesn't allow to use complex values (HASHes) as values for nodes (overpost problem)
author sergey
date Wed, 07 Nov 2012 04:17:53 +0400
parents 5c82eec23bb6
children 4ddb27ff4a0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
1 use strict;
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
2 use warnings;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
3 package IMPL::SQL::Schema::Type;
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
4
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
5 use parent qw(IMPL::Object IMPL::Object::Autofill);
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
6
232
5c82eec23bb6 Fixed degradations due refactoring
sergey
parents: 194
diff changeset
7 use IMPL::lang qw( :declare :compare );
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
8
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
9 use IMPL::Class::Property::Direct;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
11 BEGIN {
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
12 public _direct property name => PROP_GET;
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
13 public _direct property maxLength => PROP_GET;
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
14 public _direct property scale => PROP_GET;
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
15 public _direct property unsigned => PROP_GET;
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
16 public _direct property zerofill => PROP_GET;
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
17 public _direct property tag => PROP_GET;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
18 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
20 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
21
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
22 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
23 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
24
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
25 $this->{$scale} = 0 if not $this->{$scale};
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
26 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
27
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
28 sub SameValue {
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
29 my ($this,$other) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
30
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
31 return (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 $this->{$name} eq $other->name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33 and equals($this->{$maxLength},$other->{$maxLength})
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 and equals($this->{$scale},$other->{$scale})
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
35 );
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
36 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
37
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 32
diff changeset
38 1;
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
39
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
40 __END__
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
41
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
42 =pod
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
43
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
44 =head1 NAME
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
45
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
46 C<IMPL::SQL::Schema::Type> Описывает SQL типы данных
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
47
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
48 =head1 SYNOPSIS
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
49
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
50 =begin code
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
51
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
52 use IMPL::SQL::Schema::Type;
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
53
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
54 my $varchar_t = new IMPL::SQL::Schema::Type( name => 'varchar', maxLength => 255 );
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
55
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
56 my $real_t = new IMPL::SQL::Schema::Type( name => 'float', maxLength=> 10, scale => 4); # mysql: float(10,4)
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
57
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
58 =end
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
59
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
60 Данный класс используется для стандатрного описания SQL типов данных. В зависимости
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
61 от движка БД эти объекты могут быть представлены различными строковыми представлениями.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
62
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
63 =head1 MEMBERS
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
64
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
65 =over
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
66
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
67 =item C<CTOR(%props)>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
68
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
69 Конструктор, заполняет объект значениями которые были переданы в конструкторе.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
70
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
71 =item C<[get]name>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
72
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
73 Имя типа. Обязательно.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
74
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
75 =item C<[get]maxLength>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
76
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
77 Максимальная длина, используется только для типов, имеющих длину (либо переменную,
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
78 либо постоянную).
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
79
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
80 =item C<[get]scale>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
81
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
82 Точность, количество знаков после запятой. Используется вместе с C<maxLength>.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
83
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
84 =item C<[get]unsigned>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
85
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
86 Используется с числовыми данными, обозначает беззнаковые типы.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
87
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
88 =item C<[get]zerofill>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
89
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
90 Нестандартный атрибут дополняющий числа лидирующими нулями до C<maxLength>.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
91
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
92 =item C<[get]tag>
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
93
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
94 Хеш с дополнительными опциями.
165
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
95
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
96 =back
76515373dac0 Added Class::Template,
wizard
parents: 49
diff changeset
97
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 167
diff changeset
98 =cut