annotate Lib/IMPL/SQL/Schema/Traits.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 d1676be8afcc
children dacfe7c0311a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
1 package IMPL::SQL::Schema::Traits;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
2 use strict;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
3 use IMPL::_core::version;
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
4 use IMPL::Exception();
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
5
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
6 use parent qw(IMPL::Object);
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
7
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
8 # required for use with typeof operator
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
9 use IMPL::SQL::Schema::Constraint::PrimaryKey();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
10 use IMPL::SQL::Schema::Constraint::Index();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
11 use IMPL::SQL::Schema::Constraint::Unique();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
12 use IMPL::SQL::Schema::Constraint::ForeignKey();
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
13
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
14 ###################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
15
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
16 package IMPL::SQL::Schema::Traits::Table;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
17 use base qw(IMPL::Object::Fields);
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
18
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
19 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 columns
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22 constraints
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 options
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
24 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
25
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
26 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 my ($this,$table,$columns,$constraints,$options) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 $this->{name} = $table or die new IMPL::InvalidArgumentException(table => "A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 $this->{columns} = $columns if defined $columns;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 $this->{constraints} = $constraints if defined $constraints;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 $this->{options} = $options if defined $options;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
33 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
34
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
35 ###################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
36
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
37 package IMPL::SQL::Schema::Traits::Column;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
38 use base qw(IMPL::Object::Fields);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
39
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
40 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
41 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
42 type
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
43 isNullable
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
44 defaultValue
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45 tag
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
46 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
47
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
48 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
49 my ($this, $name, $type, %args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
50
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
51 $this->{name} = $name or die new IMPL::InvalidArgumentException("name");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
52 $this->{type} = $type or die new IMPL::InvalidArgumentException("type");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
53 $this->{isNullable} = $args{isNullable} if exists $args{isNullable};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
54 $this->{defaultValue} = $args{defaultValue} if exists $args{defaultValue};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
55 $this->{tag} = $args{tag} if exists $args{tag};
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
56 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
57
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
58 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
59
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
60 package IMPL::SQL::Schema::Traits::Constraint;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
61 use base qw(IMPL::Object::Fields);
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
62
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
63 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
64 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
65 columns
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
66 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
67
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
68 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
69 my ($this, $name, $columns) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
71 $this->{name} = $name;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
72 $this->{columns} = $columns; # list of columnNames
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
73 }
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
74
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
75 sub constraintClass {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
76 die new IMPL::NotImplementedException();
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
77 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
78
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
79 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
80
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
81 package IMPL::SQL::Schema::Traits::PrimaryKey;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
82
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
83 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
84
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
85 __PACKAGE__->PassThroughArgs;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
86
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
87 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::PrimaryKey };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
88
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
89 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
90
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
91 package IMPL::SQL::Schema::Traits::Index;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
92
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
93 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
94
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
95 __PACKAGE__->PassThroughArgs;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
96
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
97 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::Index };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
98
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
99 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
100
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
101 package IMPL::SQL::Schema::Traits::Unique;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
102
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
103 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
104
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
105 __PACKAGE__->PassThroughArgs;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
106
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
107 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::Unique };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
108
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
109 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
110
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
111 package IMPL::SQL::Schema::Traits::ForeignKey;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
112
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
113 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
114 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
115 foreignTable
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
116 foreignColumns
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
117 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
118
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
119 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::ForeignKey };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
120
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
121 our %CTOR = (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
122 'IMPL::SQL::Schema::Traits::Constraint' => sub { @_[0..1] }
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
123 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
124
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
125 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
126 my ($this,$foreignTable,$foreignColumns) = @_[0,3,4];
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
127
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
128 $this->{foreignTable} = $foreignTable;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
129 $this->{foreignColunms} = $foreignColumns;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
130 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
131
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
132
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
133 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
134
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
135 package IMPL::SQL::Schema::Traits::CreateTable;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
136
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
137 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
138 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
139 use IMPL::lang;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
140
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
141 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
142 public property table => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
143 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
144
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
145 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
146 my ($this,$table) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
147
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
148 die new IMPL::InvalidArgumentException("table", "An object of IMPL::SQL::Schema::Traits::Table type is required")
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
149 unless is $table, typeof IMPL::SQL::Schema::Traits::Table;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
150
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
151 $this->table($table);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
152 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
153
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
154 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
155 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
156
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
157 return 0 if ( $schema->GetTable( $this->table->{name} ) );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
158
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
159 $schema->AddTable($this->table);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
160 return 1;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
161 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
162
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
163 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
164
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
165 package IMPL::SQL::Schema::Traits::DropTable;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
166 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
167 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
168
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
169 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
170 public property tableName => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
171 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
172
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
173 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
174 my ($this,$tableName) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
175
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
176 $this->tableName($tableName) or die new IMPL::InvalidArgumentException("tableName is required");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
177 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
178
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
179 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
180 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
181
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
182 return 0 if $schema->GetTable( $this->tableName );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
183
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
184 $schema->RemoveTable($this->tableName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
185
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
186 return 1;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
187 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
188
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
189 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
190
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
191 package IMPL::SQL::Schema::Traits::RenameTable;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
192 use parent qw(-norequire IMPL::SQL::Schema::Traits);
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
193 use IMPL::Class::Property;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
194
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
195 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
196 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
197 public property tableNewName => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
198 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
199
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
200 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
201 my ($this, $oldName, $newName) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
202
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
203 $this->tableName($oldName) or die new IMPL::InvalidArgumentException("A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
204 $this->tableNewName($newName) or die new IMPL::InvalidArgumentException("A new table name is required");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
205 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
206
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
207 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
208 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
209
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
210 return 0 if not $schema->GetTable($this->tableName) or $schema->GetTable($this->tableNewName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
211
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
212 $this->RenameTable($this->tableName, $this->tableNewName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
213
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
214 return 1;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
215 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
216
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
217 #################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
218
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
219 package IMPL::SQL::Schema::Traits::AlterTableAddColumn;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
220 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
221 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
222 use IMPL::lang;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
223
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
224 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
225 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
226 public property column => prop_get | owner_set;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
227 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
228
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
229 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
230 my ($this,$tableName,$column) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
231
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
232 $this->tableName($tableName) or die new IMPL::InvalidArgumentException("A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
233
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
234 die new IMPL::InvalidArgumentException("A column should be a IMPL::SQL::Schema::Traits::Column object")
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
235 unless is $column, typeof IMPL::SQL::Schema::Traits::Column;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
236
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
237 $this->column($column);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
238 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
239
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
240 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
241 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
242
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
243 my $table = $schema->GetTable($this->tableName) or return 0;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
244
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
245 return 0 if $table->GetColumn( $this->column->{name} );
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
246
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
247 $table->AddColumn($this->column);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
248
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
249 return 1;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
250 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
251
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
252 #################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
253
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
254 package IMPL::SQL::Schema::Traits::AlterTableDropColumn;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
255 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
256 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
257
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
258 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
259 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
260 public property columnName => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
261 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
262
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
263 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
264 my ($this,$table,$column) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
265
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
266 $this->tableName($table) or die new IMPL::InvalidArgumentException(tableName => "A table name should be specified");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
267 $this->columnName($column) or die new IMPL::InvalidArgumentException(columnName => "A column name should be specified");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
268 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
269
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
270 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
271 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
272
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
273 local $@;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
274
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
275 return eval {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
276 $schema->GetTable($this->tableName)->RemoveColumn($this->columnName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
277 return 1;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
278 } || 0;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
279 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
280
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
281 #################################################
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
282
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
283 package IMPL::SQL::Schema::Traits::AlterTableChangeColumn;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
284 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
285 use IMPL::Class::Property;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
286
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
287 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
288 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
289 public property columnName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
290 public property columnType => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
291 public property defaultValue => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
292 public property isNullable => prop_all;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
293 public property options => prop_all; # hash diff format, (keys have a prefix '+' - add or update value, '-' remove value)
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
294 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
295
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
296 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
297 my ($this, $table,$column,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
298
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
299 $this->tableName($table) or die new IMPL::InvalidArgumentException(tableName => "A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
300 $this->columnName($column) or die new IMPL::InvalidArgumentException(columnName => "A column name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
301
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
302 $this->$_($args{$_})
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
303 for (grep exists $args{$_}, qw(columnType defaultValue isNullable options));
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
304 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
305
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
306 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
307 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
308
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
309 local $@;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
310
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
311 return eval {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
312 my $column = $schema->GetTable($this->tableName)->GetColumn($this->columnName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
313 $column->SetType($this->columnType) if defined $this->columnType;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
314 $column->SetNullable($this->isNullable) if defined $this->isNullable;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
315 $column->SetDefaultValue($this->defaultValue) if defined $this->defaultValue;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
316 $column->SetOptions($this->options) if defined $this->options;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
317
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
318 return 1;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
319 } || 0;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
320 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
321
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
322 #################################################
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
323
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
324 package IMPL::SQL::Schema::Traits::AlterTableAddConstraint;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
325 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
326 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
327 use IMPL::lang;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
328
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
329 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
330 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
331 public property constraint => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
332 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
333
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
334 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
335 my ($this,$table,$constraint) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
336
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
337 $this->tableName($table) or die new IMPL::InvalidArgumentException( tableName => "A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
338
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
339 die new IMPL::InvalidArgumentException(constaraint => "A valid IMPL::SQL::Schema::Traits::Constarint is required")
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
340 unless is $constraint, typeof IMPL::SQL::Schema::Traits::Constraint;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
341
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
342 $this->constraint($constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
343 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
344
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
345 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
346 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
347
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
348 local $@;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
349
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
350 return eval {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
351 $schema->GetTable($this->tableName)->AddConstraint($this->constraint->constraintClass, $this->constraint);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
352 return 1;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
353 } || 0;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
354
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
355 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
356
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
357 #################################################
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
358
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
359 package IMPL::SQL::Schema::Traits::AlterTableDropConstraint;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
360 use parent qw(-norequire IMPL::SQL::Schema::Traits);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
361 use IMPL::Class::Property;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
362
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
363 BEGIN {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
364 public property tableName => prop_get | owner_set;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
365 public property constraintName => prop_get | owner_set;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
366 }
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
367
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
368 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
369 my ($this,$table,$constraint) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
370
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
371 die new IMPL::InvalidArgumentException( tableName => "A table name is required" ) unless $table;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
372 die new IMPL::InvalidArgumentException( constraintName => "A constraint name is required" ) unless $constraint;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
373
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
374 $this->tableName($table);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
375 $this->constraintName($constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
376 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
377
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
378 sub apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
379 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
380
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
381 my $table = $schema->GetTable($this->tableName) or return 0;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
382
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
383 return 0 unless $table->GetConstraint($this->constraintName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
384
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
385 $table->RemoveConstraint($this->constraintName);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
386 return 1;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
387 }
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
388
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
389
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
390 1;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
391
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
392 __END__
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
393
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
394 =pod
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
395
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
396 =head1 NAME
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
397
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
398 C<IMPL::SQL::Traits> - Операции над объектками SQL схемы.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
399
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
400 =head1 DESCRIPTION
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
401
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
402 Изменения схемы могу быть представлены в виде последовательности примитивных операций.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
403 Правила выполнения последовательности примитывных действий могут варьироваться
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
404 в зависимости от процессора, который их выполняет. Например C<IMPL::SQL::Schema::Traits::Processor>.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
405
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
406 Данные, которые содержаться в примитивных операциях не могут существовать независимо от схемы.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
407
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
408 =head1 OPEARATIONS
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
409
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
410 =head2 General
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
411
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
412 Методы обще для всех примитивных операций.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
413
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
414 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
415
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
416 =item C<apply($schema)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
417
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
418 Пытается приминить операцию к указанной схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
419
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
420 Возвращаемое значение:
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
421
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
422 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
423
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
424 =item C<true>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
425
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
426 Операция успешно применена к схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
427
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
428 =item C<false>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
429
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
430 Операция не может быть применена к схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
431
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
432 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
433
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
434 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
435
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
436 =head2 Primitive operations
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
437
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
438 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
439
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
440 =item C<IMPL::SQL::Schema::Traits::CreateTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
441
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
442 Создает таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
443
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
444 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
445
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
446 =item C<CTOR($table)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
447
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
448 =item C<[get]table>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
449
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
450 C<IMPL::SQL::Schema::Traits::Table> - описание создаваемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
451
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
452 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
453
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
454 =item C<IMPL::SQL::Schema::Traits::DropTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
455
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
456 Удалает таблицу по имени
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
457
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
458 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
459
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
460 =item C<CTOR($tableName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
461
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
462 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
463
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
464 Имя удаляемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
465
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
466 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
467
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
468 =item C<IMPL::SQL::Schema::Traits::RenameTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
469
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
470 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
471
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
472 =item C<CTOR($tableName,$tableNewName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
473
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
474 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
475
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
476 Имя таблицы, которую требуется переименовать
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
477
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
478 =item C<[get]tableNewName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
479
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
480 Новое имя таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
481
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
482 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
483
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
484 =item C<IMPL::SQL::Schema::Traits::AlterTableAddColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
485
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
486 Добавляет столбец в таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
487
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
488 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
489
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
490 =item C<CTOR($tableName,$column)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
491
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
492 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
493
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
494 Имя таблицы в которую нужно добавить столбец
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
495
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
496 =item C<[get]column>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
497
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
498 C<IMPL::SQL::Schema::Traits::Column> - описание столбца который нужно добавить
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
499
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
500 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
501
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
502 =item C<IMPL::SQL::Schema::Traits::AlterTableDropColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
503
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
504 Удаляет столбец из таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
505
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
506 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
507
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
508 =item C<CTOR($tableName,$columnName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
509
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
510 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
511
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
512 Имя таблицы в которой нужно удалить столбец
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
513
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
514 =item C<[get]columnName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
515
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
516 Имя столбца для удаления
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
517
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
518 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
519
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
520 =item C<IMPL::SQL::Schema::Traits::AlterTableChangeColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
521
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
522 Меняет описание столбца
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
523
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
524 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
525
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
526 =item C<CTOR($tableName,$columnName,%args)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
527
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
528 C<%args> - хеш, ключами которого являются оставшиеся свойства создаваемого объекта.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
529
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
530 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
531
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
532 Имя таблицы в которой находится столбец.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
533
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
534 =item C<[get]columnName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
535
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
536 Имя столбца для изменения
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
537
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
538 =item C<[get]columnType>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
539
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
540 Новый тип столбца. Не задан, если тип не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
541
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
542 =item C<[get]defaultValue>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
543
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
544 Значение по умолчанию. Не задано, если не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
545
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
546 =item C<[get]isNullable>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
547
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
548 Может ли столбец содержать C<NULL>. Не задано, если не меняется.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
549
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
550 =item C<[get]options>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
551
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
552 Хеш опций, не задан, если опции не меняются
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
553
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
554 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
555
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
556 =item C<IMPL::SQL::Schema::Traits::AlterTableAddConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
557
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
558 Базовый класс для операций по добавлению ограничений
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
559
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
560 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
561
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
562 =item C<CTOR($tableName,$constraint)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
563
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
564 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
565
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
566 Имя таблицы в которую добавляется ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
567
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
568 =item C<[get]constraint>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
569
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
570 C<IMPL::SQL::Schema::Traits::Constraint> - описние ограничения, которое нужно добавить.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
571
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
572 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
573
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
574 =item C<IMPL::SQL::Schema::Traits::AlterTableDropConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
575
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
576 Удаляет ограничение на таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
577
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
578 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
579
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
580 =item C<CTOR($tableName,$constraintName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
581
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
582 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
583
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
584 Имя таблицы в которой требуется удалить ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
585
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
586 =item C<[get]constraintName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
587
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
588 Имя ограничения для удаления.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
589
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
590 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
591
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
592 =back
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
593
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
594 =cut