annotate Lib/IMPL/SQL/Schema/Traits.pm @ 167:1f7a6d762394

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