annotate Lib/IMPL/SQL/Schema/Traits.pm @ 164:eb3e9861a761

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