annotate Lib/IMPL/SQL/Schema/Traits.pm @ 326:793cc7f0a7e7

IMPL::Web::AutoLocator added Sibling method for locating sibling resources
author sergey
date Wed, 29 May 2013 17:58:45 +0400
parents 2f06250bab5f
children
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
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
8 # required for use with typeof operator
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
9 use IMPL::SQL::Schema::Constraint::PrimaryKey();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
10 use IMPL::SQL::Schema::Constraint::Index();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
11 use IMPL::SQL::Schema::Constraint::Unique();
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
12 use IMPL::SQL::Schema::Constraint::ForeignKey();
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
13
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
14 ###################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
15
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
16 package IMPL::SQL::Schema::Traits::Table;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
17 use base qw(IMPL::Object::Fields);
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
18
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
19 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 columns
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22 constraints
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 options
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
24 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
25
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
26 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 my ($this,$table,$columns,$constraints,$options) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 $this->{name} = $table or die new IMPL::InvalidArgumentException(table => "A table name is required");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 $this->{columns} = $columns if defined $columns;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 $this->{constraints} = $constraints if defined $constraints;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 $this->{options} = $options if defined $options;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
33 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
34
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
35 ###################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
36
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
37 package IMPL::SQL::Schema::Traits::Column;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
38 use base qw(IMPL::Object::Fields);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
39
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
40 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
41 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
42 type
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
43 isNullable
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
44 defaultValue
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
45 tag
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
46 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
47
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
48 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
49 my ($this, $name, $type, %args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
50
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
51 $this->{name} = $name or die new IMPL::InvalidArgumentException("name");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
52 $this->{type} = $type or die new IMPL::InvalidArgumentException("type");
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
53 $this->{isNullable} = $args{isNullable} if exists $args{isNullable};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
54 $this->{defaultValue} = $args{defaultValue} if exists $args{defaultValue};
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
55 $this->{tag} = $args{tag} if exists $args{tag};
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
56 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
57
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
58 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
59
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
60 package IMPL::SQL::Schema::Traits::Constraint;
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
61 use base qw(IMPL::Object::Fields);
167
1f7a6d762394 SQL schema in progress
sourcer
parents: 165
diff changeset
62
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
63 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
64 name
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
65 columns
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
66 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
67
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
68 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
69 my ($this, $name, $columns) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
70
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
71 $this->{name} = $name;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
72 $this->{columns} = $columns; # list of columnNames
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
73 }
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 sub constraintClass {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
76 die new IMPL::NotImplementedException();
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
77 }
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
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
81 package IMPL::SQL::Schema::Traits::PrimaryKey;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
82
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
83 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
84
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
85 __PACKAGE__->PassThroughArgs;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
86
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
87 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::PrimaryKey };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
88
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
89 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
90
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
91 package IMPL::SQL::Schema::Traits::Index;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
92
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
93 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
94
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
95 __PACKAGE__->PassThroughArgs;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
96
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
97 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::Index };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
98
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
99 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
100
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
101 package IMPL::SQL::Schema::Traits::Unique;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
102
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
103 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
104
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
105 __PACKAGE__->PassThroughArgs;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
106
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
107 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::Unique };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
108
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
109 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
110
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
111 package IMPL::SQL::Schema::Traits::ForeignKey;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
112
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
113 use base qw(IMPL::SQL::Schema::Traits::Constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
114 use fields qw(
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
115 foreignTable
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
116 foreignColumns
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
117 onUpdate
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
118 onDelete
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
119 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
120
168
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
121 use constant { constraintClass => typeof IMPL::SQL::Schema::Constraint::ForeignKey };
6148f89bb7bf IMPL::SQL::Schema::Traits::Diff alfa version
sourcer
parents: 167
diff changeset
122
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
123 our %CTOR = (
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
124 'IMPL::SQL::Schema::Traits::Constraint' => sub { @_[0..1] }
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
125 );
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
126
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
127 sub CTOR {
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
128 my ($this,$foreignTable,$foreignColumns,%args) = @_[0,3..$#_];
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
129
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
130 $this->{foreignTable} = $foreignTable;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
131 $this->{foreignColumns} = $foreignColumns;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
132
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
133 $this->{onDelete} = $args{onDelete} if $args{onDelete};
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
134 $this->{onUpdate} = $args{onUpdate} if $args{onUpdate};
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
135 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
136
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
137
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
138 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
139
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
140 package IMPL::SQL::Schema::Traits::CreateTable;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
141
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
142 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
143 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
144 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
145 Table => '-IMPL::SQL::Schema::Traits::Table',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
146 ArgException => '-IMPL::InvalidArgumentException',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
147 OpException => '-IMPL::InvalidOperationException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
148 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
149 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
150 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
151 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
152 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
153 table => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
154 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
155 };
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
156 use IMPL::lang;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
157
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
158 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
159 my ($this,$table) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
160
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
161 die ArgException->new("table", "An object of IMPL::SQL::Schema::Traits::Table type is required")
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
162 unless is($table, Table);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
163
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
164 $this->table($table);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
165 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
166
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
167 sub CanApply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
168 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
169
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
170 return( $schema->GetTable( $this->table->{name} ) ? 0 : 1 );
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
171 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
172
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
173 sub Apply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
174 my ($this,$schema) = @_;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
175
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
176 my $args = {%{$this->table}};
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
177
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
178 my $constraints = delete $args->{constraints} || [];
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
179
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
180 my $table = $schema->AddTable($args);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
181
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
182 $table->AddConstraint($_->constraintClass, $_) foreach @{$constraints};
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
183 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
184
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
185 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
186
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
187 package IMPL::SQL::Schema::Traits::DropTable;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
188 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
189 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
190 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
191 ArgException => '-IMPL::InvalidArgumentException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
192 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
193 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
194 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
195 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
196 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
197 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
198 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
199 };
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
200
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
201 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
202 my ($this,$tableName) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
203
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
204 $this->tableName($tableName) or die ArgException->new("tableName is required");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
205 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
206
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
207 sub CanApply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
208 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
209
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
210 return $schema->GetTable( $this->tableName ) ? 1 : 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
211 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
212
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
213 sub Apply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
214 my ($this,$schema) = @_;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
215
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
216 $schema->RemoveTable($this->tableName);
164
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 ##################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
220
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
221 package IMPL::SQL::Schema::Traits::RenameTable;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
222 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
223 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
224 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
225 ArgException => '-IMPL::InvalidArgumentException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
226 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
227 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
228 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
229 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
230 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
231 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
232 tableNewName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
233 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
234 };
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
235
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
236 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
237 my ($this, $oldName, $newName) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
238
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
239 $this->tableName($oldName) or die ArgException->new("A table name is required");
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
240 $this->tableNewName($newName) or die ArgException->new("A new table name is required");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
241 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
242
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
243 sub CanApply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
244 my ($this, $schema) = @_;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
245
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
246 return ($schema->GetTable($this->tableName) and not $schema->GetTable($this->tableNewName) ? 1 : 0 );
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
247 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
248
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
249 sub Apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
250 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
251
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
252 $schema->RenameTable($this->tableName, $this->tableNewName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
253
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
254 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
255
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
256 #################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
257
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
258 package IMPL::SQL::Schema::Traits::AlterTableAddColumn;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
259
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
260 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
261 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
262 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
263 Column => '-IMPL::SQL::Schema::Traits::Column',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
264 ArgException => '-IMPL::InvalidArgumentException',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
265 OpException => '-IMPL::InvalidOperationException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
266 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
267 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
268 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
269 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
270 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
271 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
272 column => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
273 position => PROP_RO
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
274 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
275 };
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
276 use IMPL::lang;
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
277
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
278
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
279 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
280 my ($this,$tableName,$column) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
281
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
282 $this->tableName($tableName) or die ArgException->new("A table name is required");
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
283
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
284 die ArgException->new("A column should be a IMPL::SQL::Schema::Traits::Column object")
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
285 unless is($column, Column);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
286
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
287 $this->column($column);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
288 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
289
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
290 sub CanApply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
291 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
292
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
293 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
294 or return 0;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
295
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
296 return $table->GetColumn( $this->column->{name} ) ? 0 : 1;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
297 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
298
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
299 sub Apply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
300 my ($this,$schema) = @_;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
301
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
302 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
303 or die OpException->new("The specified table doesn't exists", $this->tableName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
304
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
305 if ($this->position) {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
306 $table->AddColumn($this->column);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
307 } else {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
308 $table->InsertColumn($this->column,$this->position);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
309 }
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
310 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
311
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
312 #################################################
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
313
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
314 package IMPL::SQL::Schema::Traits::AlterTableDropColumn;
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
315
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
316 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
317 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
318 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
319 FK => '-IMPL::SQL::Schema::Constraint::ForeignKey',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
320 ArgException => '-IMPL::InvalidArgumentException',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
321 OpException => '-IMPL::InvalidOperationException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
322 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
323 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
324 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
325 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
326 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
327 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
328 columnName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
329 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
330 };
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
331 use IMPL::lang;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
332
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
333
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
334 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
335 my ($this,$table,$column) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
336
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
337 $this->tableName($table) or die ArgException->new(tableName => "A table name should be specified");
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
338 $this->columnName($column) or die ArgException->new(columnName => "A column name should be specified");
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
339 }
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
340
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
341 sub CanApply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
342 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
343
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
344 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
345 or return 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
346
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
347 $table->GetColumn($this->columnName) or
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
348 return 0;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
349
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
350 # столбец
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
351 return $table->GetColumnConstraints($this->columnName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
352 ? 0
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
353 : 1
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
354 ;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
355 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
356
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
357 sub Apply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
358 my ($this,$schema) = @_;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
359
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
360 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
361 or die OpException->new("The specified table doesn't exists", $this->tableName);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
362
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
363 $table->RemoveColumn($this->columnName);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
364 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
365
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
366 #################################################
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
367
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
368 package IMPL::SQL::Schema::Traits::AlterTableChangeColumn;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
369
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
370 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
371 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
372 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
373 Constraint => '-IMPL::SQL::Schema::Traits::Constraint',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
374 ArgException => '-IMPL::InvalidArgumentException',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
375 OpException => '-IMPL::InvalidOperationException'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
376 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
377 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
378 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
379 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
380 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
381 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
382 columnName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
383 columnType => PROP_RW,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
384 defaultValue => PROP_RW,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
385 isNullable => PROP_RW,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
386 position => PROP_RW,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
387 options => PROP_RW # hash diff format, (keys have a prefix '+' - add or update value, '-' remove value)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
388 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
389 };
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
390 use IMPL::lang;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
391
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
392 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
393 my ($this, $table,$column,%args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
394
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
395 $this->tableName($table) or die ArgException->new(tableName => "A table name is required");
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
396 $this->columnName($column) or die ArgException->new(columnName => "A column name is required");
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
397
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
398 $this->$_($args{$_})
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
399 for (grep exists $args{$_}, qw(columnType defaultValue isNullable options));
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
400 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
401
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
402 sub CanApply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
403 my ($this,$schema) = @_;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
404
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
405 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
406 or return 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
407
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
408 return $table->GetColumn($this->columnName) ? 1 : 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
409 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
410
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
411 sub Apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
412 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
413
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
414 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
415 or die OpException->new("The specified table doesn't exists", $this->tableName);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
416
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
417 my $column = $table->GetColumn($this->columnName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
418 or die OpException->new("The specified column doesn't exists", $this->tableName, $this->columnName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
419
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
420 $column->SetType($this->columnType) if defined $this->columnType;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
421 $column->SetNullable($this->isNullable) if defined $this->isNullable;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
422 $column->SetDefaultValue($this->defaultValue) if defined $this->defaultValue;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
423 $column->SetOptions($this->options) if defined $this->options;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
424
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
425 $table->SetColumnPosition($this->position)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
426 if ($this->position);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
427
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
428 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
429
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
430 #################################################
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
431
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
432 package IMPL::SQL::Schema::Traits::AlterTableAddConstraint;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
433
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
434 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
435 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
436 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
437 Constraint => '-IMPL::SQL::Schema::Traits::Constraint',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
438 ArgException => '-IMPL::InvalidArgumentException',
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
439 FK => '-IMPL::SQL::Schema::Traits::ForeignKey'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
440 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
441 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
442 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
443 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
444 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
445 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
446 constraint => PROP_RO
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
447 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
448 };
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
449 use IMPL::lang;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
450
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
451 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
452 my ($this,$table,$constraint) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
453
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
454 $this->tableName($table) or die ArgException->new( tableName => "A table name is required");
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
455
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
456 die ArgException->new(constaraint => "A valid " . Constraint . " is required")
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
457 unless is($constraint, Constraint);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
458
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
459 $this->constraint($constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
460 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
461
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
462 sub CanApply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
463 my ($this, $schema) = @_;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
464
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
465 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
466 or return 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
467
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
468 my $constraint = $this->constraint;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
469
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
470 my @columns = map $table->GetColumn($_), @{$constraint->{columns} || []};
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
471
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
472 # проверяем, что в таблице есть все столбцы для создания ограничения
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
473 return 0 if grep not($_), @columns;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
474
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
475 if (is($constraint,FK)) {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
476 my $foreignTable = $schema->GetTable($constraint->{foreignTable})
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
477 or return 0;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
478
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
479 my @foreignColumns = map $foreignTable->GetColumn($_), @{$constraint->{foreignColumns}||[]};
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
480
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
481 # внешняя таблица имеет нужные столбцы
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
482 return 0
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
483 if grep not($_), @foreignColumns;
272
sergey
parents: 271
diff changeset
484
sergey
parents: 271
diff changeset
485 # типы столбцов во внешней таблице совпадают с типами столбцов ограничения
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
486 return 0
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
487 if grep not($columns[$_]->type->SameValue($foreignColumns[$_]->type)), (0 .. $#columns);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
488 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
489
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
490 return 1;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
491 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
492
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
493 sub Apply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
494 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
495
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
496 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
497 or die IMPL::InvalidOperationException->new("The specified table doesn't exists", $this->tableName);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
498
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
499 my $constraint = $this->constraint;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
500
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
501 if (is($constraint,FK)) {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
502 my $args = { %$constraint };
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
503 $args->{referencedTable} = $schema->GetTable(delete $args->{foreignTable});
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
504 $args->{referencedColumns} = delete $args->{foreignColumns};
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
505 $table->AddConstraint($constraint->constraintClass, $args);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
506 } else {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
507 $table->AddConstraint($constraint->constraintClass, $constraint);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
508 }
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
509
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
510 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
511
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
512 #################################################
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
513
165
76515373dac0 Added Class::Template,
wizard
parents: 164
diff changeset
514 package IMPL::SQL::Schema::Traits::AlterTableDropConstraint;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
515 use IMPL::Const qw(:prop);
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
516 use IMPL::declare {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
517 require => {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
518 PK => '-IMPL::SQL::Schema::Constraint::PrimaryKey'
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
519 },
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
520 base => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
521 '-IMPL::SQL::Schema::Traits' => undef
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
522 ],
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
523 props => [
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
524 tableName => PROP_RO,
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
525 constraintName => PROP_RO
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
526 ]
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
527 };
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
528 use IMPL::lang qw(is);
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
529
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
530 sub CTOR {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
531 my ($this,$table,$constraint) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
532
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
533 die new IMPL::InvalidArgumentException( tableName => "A table name is required" ) unless $table;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
534 die new IMPL::InvalidArgumentException( constraintName => "A constraint name is required" ) unless $constraint;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
535
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
536 $this->tableName($table);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
537 $this->constraintName($constraint);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
538 }
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
539
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
540 sub CanApply {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
541 my ($this,$schema) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
542
283
2f06250bab5f *IMPL::SQL::MySQL fixed issues with foreign keys and drop table
sergey
parents: 272
diff changeset
543 my $table = $schema->GetTable($this->tableName)
2f06250bab5f *IMPL::SQL::MySQL fixed issues with foreign keys and drop table
sergey
parents: 272
diff changeset
544 or return 0;
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
545
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
546 my $constraint = $table->GetConstraint($this->constraintName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
547 or return 0;
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
548
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
549 # есть ли внешние ключи на данную таблицу
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
550 return (
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
551 is($constraint,PK)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
552 && values( %{$constraint->connectedFK || {}} )
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
553 ? 0
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
554 : 1
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
555 );
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
556 }
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
557
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
558 sub Apply {
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
559 my ($this,$schema) = @_;
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
560
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
561 my $table = $schema->GetTable($this->tableName)
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
562 or die IMPL::InvalidOperationException->new("The specified table doesn't exists", $this->tableName);
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
563
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
564 $table->RemoveConstraint($this->constraintName);
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
565 }
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
566
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
567
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 44
diff changeset
568 1;
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
569
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
570 __END__
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
571
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
572 =pod
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
573
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
574 =head1 NAME
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
575
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
576 C<IMPL::SQL::Traits> - Операции над объектками SQL схемы.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
577
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
578 =head1 DESCRIPTION
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
579
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
580 Изменения схемы могу быть представлены в виде последовательности примитивных операций.
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
581 Правила выполнения последовательности примитывных действий могут варьироваться
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
582 в зависимости от процессора, который их выполняет. Например C<IMPL::SQL::Schema::Traits::Processor>.
163
6ce1f052b90a temp commit
wizard
parents: 49
diff changeset
583
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
584 Данные, которые содержаться в примитивных операциях не могут существовать независимо от схемы.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
585
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
586 =head1 OPERATIONS
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
587
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
588 =head2 General
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
589
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
590 Методы обще для всех примитивных операций.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
591
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
592 =head3 C<CanApply($schema)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
593
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
594 Определяет возможность применения операции к указанной схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
595
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
596 Возвращаемое значение:
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
597
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
598 =over
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
599
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
600 =item C<true>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
601
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
602 Операция приминима к схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
603
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
604 =item C<false>
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
605
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
606 Операция не может быть применена к схеме.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
607
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
608 =back
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
609
271
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
610 =head3 C<Apply($schema)>
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
611
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
612 Применяет операцию к указанной схеме.
56364d0c4b4f +IMPL::SQL::Schema::MySQL: added basic support for MySQL
cin
parents: 269
diff changeset
613
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
614 =head2 Primitive operations
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
615
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
616 =head3 C<IMPL::SQL::Schema::Traits::CreateTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
617
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
618 Создает таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
619
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
620 =head4 C<CTOR($table)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
621
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
622 =head4 C<[get]table>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
623
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
624 C<IMPL::SQL::Schema::Traits::Table> - описание создаваемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
625
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
626 =head3 C<IMPL::SQL::Schema::Traits::DropTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
627
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
628 Удалает таблицу по имени
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
629
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
630 =head4 C<CTOR($tableName)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
631
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
632 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
633
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
634 Имя удаляемой таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
635
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
636 =head3 C<IMPL::SQL::Schema::Traits::RenameTable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
637
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
638 =head4 C<CTOR($tableName,$tableNewName)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
639
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
640 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
641
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
642 Имя таблицы, которую требуется переименовать
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
643
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
644 =head4 C<[get]tableNewName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
645
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
646 Новое имя таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
647
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
648 =head3 C<IMPL::SQL::Schema::Traits::AlterTableAddColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
649
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
650 Добавляет столбец в таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
651
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
652 =head4 C<CTOR($tableName,$column,$position)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
653
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
654 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
655
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
656 Имя таблицы в которую нужно добавить столбец
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
657
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
658 =head4 C<[get]column>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
659
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
660 C<IMPL::SQL::Schema::Traits::Column> - описание столбца который нужно добавить
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
661
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
662 =head4 C<[get]position>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
663
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
664 Позиция на которую нужно вставить столбец
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
665
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
666 =head3 C<IMPL::SQL::Schema::Traits::AlterTableDropColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
667
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
668 Удаляет столбец из таблицы
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
669
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
670 =head4 C<CTOR($tableName,$columnName)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
671
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
672 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
673
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
674 Имя таблицы в которой нужно удалить столбец
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
675
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
676 =head4 C<[get]columnName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
677
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
678 Имя столбца для удаления
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
679
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
680 =head3 C<IMPL::SQL::Schema::Traits::AlterTableChangeColumn>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
681
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
682 Меняет описание столбца
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
683
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
684 =head4 C<CTOR($tableName,$columnName,%args)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
685
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
686 C<%args> - хеш, ключами которого являются оставшиеся свойства создаваемого объекта.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
687
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
688 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
689
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
690 Имя таблицы в которой находится столбец.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
691
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
692 =head4 C<[get]columnName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
693
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
694 Имя столбца для изменения
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
695
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
696 =head4 C<[get]columnType>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
697
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
698 Новый тип столбца. Не задан, если тип не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
699
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
700 =head4 C<[get]defaultValue>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
701
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
702 Значение по умолчанию. Не задано, если не меняется
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
703
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
704 =head4 C<[get]isNullable>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
705
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
706 Может ли столбец содержать C<NULL>. Не задано, если не меняется.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
707
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
708 =head4 C<[get]options>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
709
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
710 Хеш опций, не задан, если опции не меняются. Данный хеш содержит разничу между
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
711 старыми и новыми значениями свойства C<tag> столбца.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
712
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
713
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
714 =head3 C<IMPL::SQL::Schema::Traits::AlterTableAddConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
715
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
716 Базовый класс для операций по добавлению ограничений
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
717
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
718 =head4 C<CTOR($tableName,$constraint)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
719
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
720 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
721
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
722 Имя таблицы в которую добавляется ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
723
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
724 =head4 C<[get]constraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
725
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
726 C<IMPL::SQL::Schema::Traits::Constraint> - описние ограничения, которое нужно добавить.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
727
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
728 =head3 C<IMPL::SQL::Schema::Traits::AlterTableDropConstraint>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
729
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
730 Удаляет ограничение на таблицу
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
731
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
732 =head4 C<CTOR($tableName,$constraintName)>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
733
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
734 =head4 C<[get]tableName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
735
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
736 Имя таблицы в которой требуется удалить ограничение.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
737
269
dacfe7c0311a SQL schema updated (unstable)
sergey
parents: 194
diff changeset
738 =head4 C<[get]constraintName>
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
739
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
740 Имя ограничения для удаления.
164
eb3e9861a761 SQL traits in progress
wizard
parents: 163
diff changeset
741
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 169
diff changeset
742 =cut