annotate Lib/IMPL/SQL/Schema/Traits.pm @ 183:2184fa28b49e

IMPL::Web::View::TTLoader tests
author cin
date Wed, 28 Mar 2012 17:28:51 +0400
parents d1676be8afcc
children 4d0e1962161c
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;
169
fd92830036c3 corrected IMPL::SQL::Schema::Diff
sourcer
parents: 168
diff changeset
374
fd92830036c3 corrected IMPL::SQL::Schema::Diff
sourcer
parents: 168
diff changeset
375 $this->tableName($table);
fd92830036c3 corrected IMPL::SQL::Schema::Diff
sourcer
parents: 168
diff changeset
376 $this->constraintName($constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
377 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
378
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
379 sub apply {
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
380 my ($this,$schema) = @_;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
381
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
382 my $table = $schema->GetTable($this->tableName) or return 0;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
383
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
384 return 0 unless $table->GetConstraint($this->constraintName);
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
385
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
386 $table->RemoveConstraint($this->constraintName);
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
387 return 1;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
388 }
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
389
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
390
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
391 1;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
392
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
393 __END__
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
394
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
395 =pod
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
396
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
397 =head1 NAME
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
398
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
399 C<IMPL::SQL::Traits> - Операции над объектками SQL схемы.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
400
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
401 =head1 DESCRIPTION
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
402
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
403 Изменения схемы могу быть представлены в виде последовательности примитивных операций.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
404 Правила выполнения последовательности примитывных действий могут варьироваться
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
405 в зависимости от процессора, который их выполняет. Например C<IMPL::SQL::Schema::Traits::Processor>.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
406
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
407 Данные, которые содержаться в примитивных операциях не могут существовать независимо от схемы.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
408
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
409 =head1 OPEARATIONS
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
410
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
411 =head2 General
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
412
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
413 Методы обще для всех примитивных операций.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
414
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
415 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
416
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
417 =item C<apply($schema)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
418
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
419 Пытается приминить операцию к указанной схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
420
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
421 Возвращаемое значение:
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
422
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
423 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
424
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
425 =item C<true>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
426
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
427 Операция успешно применена к схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
428
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
429 =item C<false>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
430
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
431 Операция не может быть применена к схеме.
164
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 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
436
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
437 =head2 Primitive operations
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
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
441 =item C<IMPL::SQL::Schema::Traits::CreateTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
442
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
443 Создает таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
444
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
445 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
446
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
447 =item C<CTOR($table)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
448
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
449 =item C<[get]table>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
450
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
451 C<IMPL::SQL::Schema::Traits::Table> - описание создаваемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
452
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
453 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
454
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
455 =item C<IMPL::SQL::Schema::Traits::DropTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
456
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
457 Удалает таблицу по имени
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
458
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
459 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
460
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
461 =item C<CTOR($tableName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
462
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
463 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
464
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
465 Имя удаляемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
466
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
467 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
468
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
469 =item C<IMPL::SQL::Schema::Traits::RenameTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
470
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
471 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
472
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
473 =item C<CTOR($tableName,$tableNewName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
474
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
475 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
476
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
477 Имя таблицы, которую требуется переименовать
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
478
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
479 =item C<[get]tableNewName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
480
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
481 Новое имя таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
482
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
483 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
484
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
485 =item C<IMPL::SQL::Schema::Traits::AlterTableAddColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
486
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
487 Добавляет столбец в таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
488
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
489 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
490
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
491 =item C<CTOR($tableName,$column)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
492
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
493 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
494
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
495 Имя таблицы в которую нужно добавить столбец
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
496
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
497 =item C<[get]column>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
498
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
499 C<IMPL::SQL::Schema::Traits::Column> - описание столбца который нужно добавить
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
500
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
501 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
502
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
503 =item C<IMPL::SQL::Schema::Traits::AlterTableDropColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
504
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
505 Удаляет столбец из таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
506
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
507 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
508
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
509 =item C<CTOR($tableName,$columnName)>
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
513 Имя таблицы в которой нужно удалить столбец
164
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
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
517 Имя столбца для удаления
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
518
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
519 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
520
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
521 =item C<IMPL::SQL::Schema::Traits::AlterTableChangeColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
522
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
523 Меняет описание столбца
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
524
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
525 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
526
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
527 =item C<CTOR($tableName,$columnName,%args)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
528
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
529 C<%args> - хеш, ключами которого являются оставшиеся свойства создаваемого объекта.
164
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]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
532
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
533 Имя таблицы в которой находится столбец.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
534
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
535 =item C<[get]columnName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
536
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
537 Имя столбца для изменения
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
538
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
539 =item C<[get]columnType>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
540
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
541 Новый тип столбца. Не задан, если тип не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
542
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
543 =item C<[get]defaultValue>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
544
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
545 Значение по умолчанию. Не задано, если не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
546
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
547 =item C<[get]isNullable>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
548
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
549 Может ли столбец содержать C<NULL>. Не задано, если не меняется.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
550
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
551 =item C<[get]options>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
552
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
553 Хеш опций, не задан, если опции не меняются
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
554
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
555 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
556
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
557 =item C<IMPL::SQL::Schema::Traits::AlterTableAddConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
558
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
559 Базовый класс для операций по добавлению ограничений
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
560
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
561 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
562
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
563 =item C<CTOR($tableName,$constraint)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
564
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
565 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
566
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
567 Имя таблицы в которую добавляется ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
568
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
569 =item C<[get]constraint>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
570
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
571 C<IMPL::SQL::Schema::Traits::Constraint> - описние ограничения, которое нужно добавить.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
572
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
573 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
574
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
575 =item C<IMPL::SQL::Schema::Traits::AlterTableDropConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
576
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
577 Удаляет ограничение на таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
578
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
579 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
580
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
581 =item C<CTOR($tableName,$constraintName)>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
582
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
583 =item C<[get]tableName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
584
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
585 Имя таблицы в которой требуется удалить ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
586
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
587 =item C<[get]constraintName>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
588
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
589 Имя ограничения для удаления.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
590
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
591 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
592
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
593 =back
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
594
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
595 =cut