annotate Lib/IMPL/SQL/Schema/Traits.pm @ 168:6148f89bb7bf

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