annotate Lib/IMPL/SQL/Schema/Traits.pm @ 166:4267a2ac3d46

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