line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Win32::SqlServer::DTS::Task::DataPump;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Win32::SqlServer::DTS::Task::DataPump - a Perl subclass of Win32::SqlServer::DTS::Task to represent a DTSDataPumpTask object
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use warnings;
|
10
|
|
|
|
|
|
|
use strict;
|
11
|
|
|
|
|
|
|
use Win32::SqlServer::DTS::Application;
|
12
|
|
|
|
|
|
|
use Test::More;
|
13
|
|
|
|
|
|
|
use XML::Simple;
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $xml = XML::Simple->new();
|
16
|
|
|
|
|
|
|
my $config = $xml->XMLin('test-config.xml');
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $app = Win32::SqlServer::DTS::Application->new( $config->{credential} );
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $package = $app->get_db_package(
|
21
|
|
|
|
|
|
|
{
|
22
|
|
|
|
|
|
|
id => '',
|
23
|
|
|
|
|
|
|
version_id => '',
|
24
|
|
|
|
|
|
|
name => $config->{package},
|
25
|
|
|
|
|
|
|
package_password => ''
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
);
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $iterator = $package->get_datapumps();
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
foreach my $datapump ( $iterator->() ) {
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
print $datapump->to_string(), "\n";
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
C implements a convenient way to fetch properties from a DTS DataPumpTask Task object of a DTS
|
40
|
|
|
|
|
|
|
Package.
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 EXPORT
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Nothing.
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
|
30835
|
use strict;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
49
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
50
|
1
|
|
|
1
|
|
5
|
use Carp qw(confess);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
76
|
|
51
|
1
|
|
|
1
|
|
6
|
use base qw(Win32::SqlServer::DTS::Task Class::Accessor);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
852
|
|
52
|
|
|
|
|
|
|
use Hash::Util qw(lock_keys);
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 METHODS
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
A good amount of methods available in the original DTS API are available, including methods to access the properties.
|
57
|
|
|
|
|
|
|
There are some methods that do not exists in the DTS API.
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice;
|
62
|
|
|
|
|
|
|
__PACKAGE__->mk_ro_accessors(
|
63
|
|
|
|
|
|
|
qw(use_identity_inserts rows_complete exception_file
|
64
|
|
|
|
|
|
|
commit_size max_errors fetch_size dest_obj dest_sql
|
65
|
|
|
|
|
|
|
first_row progress_count source_conn_id dest_conn_id source_obj source_sql
|
66
|
|
|
|
|
|
|
exception_qualifier)
|
67
|
|
|
|
|
|
|
);
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head3 new
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Overrided method from L to define additional attributes during object creation. See
|
72
|
|
|
|
|
|
|
L for more information.
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub new {
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $class = shift;
|
79
|
|
|
|
|
|
|
my $self = $class->SUPER::new(@_);
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $sibling = $self->get_sibling();
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$self->{exception_qualifier} =
|
84
|
|
|
|
|
|
|
$sibling->Properties->Parent->ExceptionFileTextQualifier;
|
85
|
|
|
|
|
|
|
$self->{input_global_vars} =
|
86
|
|
|
|
|
|
|
$sibling->Properties->Parent->InputGlobalVariableNames;
|
87
|
|
|
|
|
|
|
$self->{rows_complete} = $sibling->Properties->Parent->RowsComplete;
|
88
|
|
|
|
|
|
|
$self->{exception_file} = $sibling->Properties->Parent->ExceptionFileName;
|
89
|
|
|
|
|
|
|
$self->{commit_size} = $sibling->Properties->Parent->InsertCommitSize;
|
90
|
|
|
|
|
|
|
$self->{max_errors} = $sibling->Properties->Parent->MaximumErrorCount;
|
91
|
|
|
|
|
|
|
$self->{use_fast_load} = $sibling->Properties->Parent->UseFastLoad;
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# :TRICKY:12/12/2006:ARFjr: strange name for a property that appears with a different name in the DTS Designer
|
94
|
|
|
|
|
|
|
$self->{always_commit} = $sibling->Properties->Parent->DataPumpOptions;
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$self->{use_identity_inserts} =
|
97
|
|
|
|
|
|
|
$sibling->Properties->Parent->AllowIdentityInserts;
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$self->{fetch_size} = $sibling->Properties->Parent->FetchBufferSize;
|
100
|
|
|
|
|
|
|
$self->{dest_obj} = $sibling->Properties->Parent->DestinationObjectName;
|
101
|
|
|
|
|
|
|
$self->{dest_sql} = $sibling->Properties->Parent->DestinationSQLStatement;
|
102
|
|
|
|
|
|
|
$self->{first_row} = $sibling->Properties->Parent->FirstRow;
|
103
|
|
|
|
|
|
|
$self->{progress_count} = $sibling->Properties->Parent->ProgressRowCount;
|
104
|
|
|
|
|
|
|
$self->{source_conn_id} = $sibling->Properties->Parent->SourceConnectionID;
|
105
|
|
|
|
|
|
|
$self->{dest_conn_id} =
|
106
|
|
|
|
|
|
|
$sibling->Properties->Parent->DestinationConnectionID;
|
107
|
|
|
|
|
|
|
$self->{source_obj} = $sibling->Properties->Parent->SourceObjectName;
|
108
|
|
|
|
|
|
|
$self->{source_sql} = $sibling->Properties->Parent->SourceSQLStatement;
|
109
|
|
|
|
|
|
|
$self->{first_row} = $sibling->Properties->Parent->FirstRow;
|
110
|
|
|
|
|
|
|
$self->{fetch_size} = $sibling->Properties->Parent->FetchBufferSize;
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$self->_get_fast_load_options;
|
113
|
|
|
|
|
|
|
$self->_get_exception_file_options;
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
lock_keys( %{$self} );
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
return $self;
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
}
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head3 get_dest_conn_id
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns the value of DestinationConnectionID property.
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head3 get_dest_obj
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Returns the value of DestinationObjectName property.
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head3 get_dest_sql
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Returns the value of DestinationSQLStatement property.
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head3 get_source_obj
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Returns the value of SourceObjectName property.
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head3 get_source_sql
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Returns the value of SourceSQLStatement property.
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head3 get_source_conn_id
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns the value of SourceConnectionID property.
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head3 get_progress_count
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns the value of ProgressRowCount property.
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head3 get_rows_complete
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns the value of RowsComplete property.
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head3 get_fetch_size
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns the value of FetchBufferSize property.
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head3 get_first_row
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Returns the value of FirstRow property.
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head3 get_exception_qualifier
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns the value of ExceptionFileTextQualifier property.
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head3 get_input_global_vars
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns the value of InputGlobalVariablesNames property.
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head3 get_exception_file
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Returns the value of ExceptionFileName property.
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head3 get_commit_size
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Returns the value of InsertCommitSize property.
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head3 get_max_errors
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Returns the value of MaximumErrorCount property.
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head3 use_single_file_7
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Returns true or false depending if errors, source, and destination exception rows are all written to a single ANSI file.
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub use_single_file_7 {
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
190
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
return $self->{single_file_7};
|
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
}
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head3 use_source_row_file
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Returns true or false depending if source exception rows are written to the source exception file.
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub use_source_row_file {
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
205
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
return $self->{source_row_file};
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
}
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head3 use_error_file
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Returns true or false if error rows are written to a error file.
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=cut
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub use_error_file {
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
220
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
return $self->{overwrite};
|
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
}
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head3 overwrite_log_file
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Returns true or false if data is overwritten, rather than appended, to file.
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub overwrite_log_file {
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
235
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
return $self->{overwrite};
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
}
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head3 abort_on_log_failure
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Returns true or false if termination of the data pump if execution logging fails is enable.
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=cut
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
sub abort_on_log_failure {
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
250
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
return $self->{abort_on_log_failure};
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
}
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head3 use_destination_row_file
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Returns true or false if destination exception rows are written to the destination exception file.
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=cut
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub use_destination_row_file {
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
265
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
return $self->{destination_row_file};
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
}
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head3 use_fast_load
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Returns true or false if the use of the FastLoad option (where rows are processed in batches
|
274
|
|
|
|
|
|
|
under a single transaction commit) is enabled.
|
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=cut
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub use_fast_load {
|
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
281
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
return $self->{use_fast_load};
|
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
}
|
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=head3 log_is_ansi
|
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
Returns true or false if the encoding of the log file is ANSI ASCII.
|
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub log_is_ansi {
|
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
296
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
return $self->{is_ansi};
|
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
}
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head3 log_is_OEM
|
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
Returns true or false if the encoding of the log file is OEM.
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=cut
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub log_is_OEM {
|
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
311
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
return $self->{is_OEM};
|
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
}
|
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=head3 log_is_unicode
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Returns true or false if the encoding of the log file is Unicode (UTF-16LE).
|
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=cut
|
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
sub log_is_unicode {
|
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
326
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
return $self->{is_unicode};
|
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
}
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
=head3 always_commit
|
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
Returns true or false if the C task will commit all successful batches including the final
|
335
|
|
|
|
|
|
|
batch, even if the data pump terminates. Use this option to support restartability.
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
Strange as it may seen, this is called as I option in the DTS designer application, but receives
|
338
|
|
|
|
|
|
|
the name C property in the DTS API.
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=cut
|
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub always_commit {
|
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
345
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
return $self->{always_commit};
|
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
}
|
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub _get_exception_file_options {
|
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
my $self = shift;
|
354
|
|
|
|
|
|
|
my $numeric_value =
|
355
|
|
|
|
|
|
|
$self->get_sibling->Properties->Parent->ExceptionFileOptions;
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
#Constant Value Description
|
358
|
|
|
|
|
|
|
#----------------------------------------------------------------------------------------------------------------------
|
359
|
|
|
|
|
|
|
#DTSExceptionFile_AbortOnRowLogFailure 8192 (x2000) Terminate the data pump if execution logging fails.
|
360
|
|
|
|
|
|
|
#DTSExceptionFile_Ansi 256 (x0100) File type is ANSI (uses ANSI code page).
|
361
|
|
|
|
|
|
|
#DTSExceptionFile_DestRowFile 8 Destination exception rows are written to the
|
362
|
|
|
|
|
|
|
# destination exception file.
|
363
|
|
|
|
|
|
|
#DTSExceptionFile_ErrorFile 2 Error rows are written to the error file.
|
364
|
|
|
|
|
|
|
#DTSExceptionFile_OEM 512 (x0200) File type is OEM (uses OEM code page).
|
365
|
|
|
|
|
|
|
#DTSExceptionFile_Overwrite 4096 (x1000) Data is overwritten, rather than appended, to file.
|
366
|
|
|
|
|
|
|
#DTSExceptionFile_SingleFile70 1 Errors, source, and destination exception rows are
|
367
|
|
|
|
|
|
|
# all written to a single ANSI file.
|
368
|
|
|
|
|
|
|
#DTSExceptionFile_SourceRowFile 4 Source exception rows are written to the source exception file.
|
369
|
|
|
|
|
|
|
#DTSExceptionFile_Unicode 1024 (x0400) File type is Unicode.
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
$self->{abort_on_log_failure} = 0;
|
372
|
|
|
|
|
|
|
$self->{is_ansi} = 0;
|
373
|
|
|
|
|
|
|
$self->{destination_row_file} = 0;
|
374
|
|
|
|
|
|
|
$self->{error_file} = 0;
|
375
|
|
|
|
|
|
|
$self->{is_OEM} = 0;
|
376
|
|
|
|
|
|
|
$self->{overwrite} = 0;
|
377
|
|
|
|
|
|
|
$self->{single_file_7} = 0;
|
378
|
|
|
|
|
|
|
$self->{source_row_file} = 0;
|
379
|
|
|
|
|
|
|
$self->{is_unicode} = 0;
|
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
if ( ( $numeric_value & 8192 ) == 8192 ) {
|
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
$self->{abort_on_log_failure} = 1;
|
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
}
|
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
if ( ( $numeric_value & 256 ) == 256 ) {
|
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
$self->{is_ansi} = 1;
|
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
}
|
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
if ( ( $numeric_value & 8 ) == 8 ) {
|
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
$self->{destination_row_file} = 1;
|
396
|
|
|
|
|
|
|
}
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
if ( ( $numeric_value & 2 ) == 2 ) {
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
$self->{error_file} = 1;
|
401
|
|
|
|
|
|
|
}
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
if ( ( $numeric_value & 512 ) == 512 ) {
|
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
$self->{is_OEM} = 1;
|
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
}
|
408
|
|
|
|
|
|
|
if ( ( $numeric_value & 4096 ) == 4096 ) {
|
409
|
|
|
|
|
|
|
$self->{overwrite} = 1;
|
410
|
|
|
|
|
|
|
}
|
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
if ( ( $numeric_value & 1 ) == 1 ) {
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
$self->{single_file_7} = 1;
|
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
}
|
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
if ( ( $numeric_value & 4 ) == 4 ) {
|
419
|
|
|
|
|
|
|
$self->{source_row_file} = 1;
|
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
}
|
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
if ( ( $numeric_value & 1024 ) == 1024 ) {
|
424
|
|
|
|
|
|
|
$self->{is_unicode} = 1;
|
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
}
|
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
# from the documentation:
|
429
|
|
|
|
|
|
|
# "Errors, source, and destination exception rows are
|
430
|
|
|
|
|
|
|
# all written to a single ANSI file."
|
431
|
|
|
|
|
|
|
# Forcing "is_ansi" property to true.
|
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
$self->{is_ansi} = 1 if ( $self->{single_file_7} );
|
434
|
|
|
|
|
|
|
}
|
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=head3 use_check_constraints
|
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
Returns true or false if the datapump will check for the constrainst of the table before inserting new rows.
|
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=cut
|
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
sub use_check_constraints {
|
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
445
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
return $self->{check_constraints};
|
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
}
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=head3 use_keep_nulls
|
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Returns true or false if the datapump will insert will insert NULL values from the data source into the destination.
|
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=cut
|
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
sub use_keep_nulls {
|
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
460
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
return $self->{keep_nulls};
|
463
|
|
|
|
|
|
|
}
|
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head3 use_lock_table
|
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
Returns true or false if the datapump will lock the entire table instead using lock by page.
|
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=cut
|
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
sub use_lock_table {
|
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
my ( $self, $write_attemp ) = shift;
|
474
|
|
|
|
|
|
|
confess "This is a read only method\n" if ( defined($write_attemp) );
|
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
return $self->{lock_table};
|
477
|
|
|
|
|
|
|
}
|
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
sub _get_fast_load_options {
|
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
#Constant Value Description
|
482
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------------
|
483
|
|
|
|
|
|
|
#DTSFastLoad_CheckConstraints 2 Check constraints (default).
|
484
|
|
|
|
|
|
|
#DTSFastLoad_Default 2 Specifies the default, same as check constraints
|
485
|
|
|
|
|
|
|
#DTSFastLoad_KeepNulls 1 Keep NULLs.
|
486
|
|
|
|
|
|
|
#DTSFastLoad_NoOptions 0 No options.
|
487
|
|
|
|
|
|
|
#DTSFastLoad_TableLock 4 Lock table.
|
488
|
|
|
|
|
|
|
my $self = shift;
|
489
|
|
|
|
|
|
|
my $numeric_code = $self->get_sibling->Properties->Parent->FastLoadOptions;
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# sanity checking
|
492
|
|
|
|
|
|
|
$self->{check_constraints} = 0;
|
493
|
|
|
|
|
|
|
$self->{keep_nulls} = 0;
|
494
|
|
|
|
|
|
|
$self->{lock_table} = 0;
|
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
CHECK: {
|
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
if ( $numeric_code == 0 ) {
|
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
# do nothing, besides there is nothing to do anyway
|
501
|
|
|
|
|
|
|
last CHECK;
|
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
}
|
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
if ( ( $numeric_code && 1 ) == 1 ) {
|
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
$self->{keep_nulls} = 1;
|
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
}
|
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
if ( ( $numeric_code && 2 ) == 2 ) {
|
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
$self->{check_constraints} = 1;
|
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
}
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
if ( ( $numeric_code && 4 ) == 4 ) {
|
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
$self->{lock_table} = 1;
|
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
}
|
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
}
|
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
}
|
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head3 use_identity_inserts
|
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
Returns true or false if I will be used.
|
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=cut
|
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
sub use_identity_inserts {
|
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
my $self = shift;
|
536
|
|
|
|
|
|
|
return $self->{use_identity_inserts};
|
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
}
|
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=head3 to_string
|
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
Returns a string with all attributes from the datapump object, separated by new line characters and with a
|
543
|
|
|
|
|
|
|
short description of each attribute.
|
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
=cut
|
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
sub to_string {
|
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
my $self = shift;
|
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
return 'Datapump name: '
|
552
|
|
|
|
|
|
|
. $self->get_name()
|
553
|
|
|
|
|
|
|
. "\r\n\tDatapump description: "
|
554
|
|
|
|
|
|
|
. $self->get_description()
|
555
|
|
|
|
|
|
|
. "\r\n\tInput global variables: "
|
556
|
|
|
|
|
|
|
. $self->get_input_global_vars
|
557
|
|
|
|
|
|
|
. "\r\n\tRows complete: "
|
558
|
|
|
|
|
|
|
. $self->get_rows_complete
|
559
|
|
|
|
|
|
|
. "\r\n\tAllow identity inserts? "
|
560
|
|
|
|
|
|
|
. ( ( $self->use_identity_inserts ) ? 'true' : 'false' )
|
561
|
|
|
|
|
|
|
. "\r\n\tUse fast load? "
|
562
|
|
|
|
|
|
|
. ( ( $self->use_fast_load ) ? 'true' : 'false' )
|
563
|
|
|
|
|
|
|
. "\r\n\tException file: "
|
564
|
|
|
|
|
|
|
. $self->get_exception_file
|
565
|
|
|
|
|
|
|
. "\r\n\tInsert commit size: "
|
566
|
|
|
|
|
|
|
. $self->get_commit_size
|
567
|
|
|
|
|
|
|
. "\r\n\tMaximum number of errors allowed: "
|
568
|
|
|
|
|
|
|
. $self->get_max_errors
|
569
|
|
|
|
|
|
|
. "\r\n\tUses Keep Nulls? "
|
570
|
|
|
|
|
|
|
. ( ( $self->use_keep_nulls ) ? 'true' : 'false' )
|
571
|
|
|
|
|
|
|
. "\r\n\tUses Lock Table? "
|
572
|
|
|
|
|
|
|
. ( ( $self->use_lock_table ) ? 'true' : 'false' )
|
573
|
|
|
|
|
|
|
. "\r\n\tUses Check Constraints? "
|
574
|
|
|
|
|
|
|
. ( ( $self->use_check_constraints ) ? 'true' : 'false' )
|
575
|
|
|
|
|
|
|
. "\r\n\tRows completed: "
|
576
|
|
|
|
|
|
|
. $self->get_rows_complete
|
577
|
|
|
|
|
|
|
. "\r\n\tUses single file on SQL 7 format? "
|
578
|
|
|
|
|
|
|
. ( ( $self->use_single_file_7 ) ? 'true' : 'false' )
|
579
|
|
|
|
|
|
|
. "\r\n\tUse source row file? "
|
580
|
|
|
|
|
|
|
. ( ( $self->use_source_row_file ) ? 'true' : 'false' )
|
581
|
|
|
|
|
|
|
. "\r\n\tUse error file? "
|
582
|
|
|
|
|
|
|
. ( ( $self->use_error_file ) ? 'true' : 'false' )
|
583
|
|
|
|
|
|
|
. "\r\n\tOverwrite log file? "
|
584
|
|
|
|
|
|
|
. ( ( $self->overwrite_log_file ) ? 'true' : 'false' )
|
585
|
|
|
|
|
|
|
. "\r\n\tAbort on logging failure? "
|
586
|
|
|
|
|
|
|
. ( ( $self->abort_on_log_failure ) ? 'true' : 'false' )
|
587
|
|
|
|
|
|
|
. "\r\n\tUse destination row file? "
|
588
|
|
|
|
|
|
|
. ( ( $self->use_destination_row_file ) )
|
589
|
|
|
|
|
|
|
. "\r\n\tLog encoding is ANSI ASCII? "
|
590
|
|
|
|
|
|
|
. ( ( $self->log_is_ansi ) ? 'true' : 'false' )
|
591
|
|
|
|
|
|
|
. "\r\n\tLog encoding is OEM? "
|
592
|
|
|
|
|
|
|
. ( ( $self->log_is_OEM ) ? 'true' : 'false' )
|
593
|
|
|
|
|
|
|
. "\r\n\tLog encoding is Unicode? "
|
594
|
|
|
|
|
|
|
. ( ( $self->log_is_unicode ) ? 'true' : 'false' )
|
595
|
|
|
|
|
|
|
. "\r\n\tRows processed: "
|
596
|
|
|
|
|
|
|
. $self->get_rows_complete()
|
597
|
|
|
|
|
|
|
. "\r\n\tUses identity insert? "
|
598
|
|
|
|
|
|
|
. ( ( $self->use_identity_inserts ) ? 'true' : 'false' )
|
599
|
|
|
|
|
|
|
. "\r\n\tException filename: "
|
600
|
|
|
|
|
|
|
. $self->get_exception_file()
|
601
|
|
|
|
|
|
|
. "\r\n\tCommit size: "
|
602
|
|
|
|
|
|
|
. $self->get_commit_size()
|
603
|
|
|
|
|
|
|
. "\r\n\tMaximum errors allowed: "
|
604
|
|
|
|
|
|
|
. $self->get_max_errors()
|
605
|
|
|
|
|
|
|
. "\r\n\tFetch buffer size: "
|
606
|
|
|
|
|
|
|
. $self->get_fetch_size()
|
607
|
|
|
|
|
|
|
. "\r\n\tDestination object: "
|
608
|
|
|
|
|
|
|
. $self->get_dest_obj()
|
609
|
|
|
|
|
|
|
. "\r\n\tDestination SQL statement: "
|
610
|
|
|
|
|
|
|
. $self->get_dest_sql()
|
611
|
|
|
|
|
|
|
. "\r\n\tFirst row to copy: "
|
612
|
|
|
|
|
|
|
. $self->get_first_row()
|
613
|
|
|
|
|
|
|
. "\r\n\tProgress row count: "
|
614
|
|
|
|
|
|
|
. $self->get_progress_count()
|
615
|
|
|
|
|
|
|
. "\r\n\tSource connection ID: "
|
616
|
|
|
|
|
|
|
. $self->get_source_conn_id()
|
617
|
|
|
|
|
|
|
. "\r\n\tDestination connection ID: "
|
618
|
|
|
|
|
|
|
. $self->get_dest_conn_id()
|
619
|
|
|
|
|
|
|
. "\r\n\tSource object: "
|
620
|
|
|
|
|
|
|
. $self->get_source_obj()
|
621
|
|
|
|
|
|
|
. "\r\n\tSource SQL statement: "
|
622
|
|
|
|
|
|
|
. $self->get_source_sql()
|
623
|
|
|
|
|
|
|
. "\r\n\tText quafilier in exception file: "
|
624
|
|
|
|
|
|
|
. $self->get_exception_qualifier();
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
}
|
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=head3 get_input_global_vars
|
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
Returns a string or a list of Data Transformation Services (DTS) global variable names that are to be
|
631
|
|
|
|
|
|
|
used as parameters in a query or created in a subpackage, depending on the context that the method is invoked.
|
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
The returned string is made of the global variable names separated by semi-colons characters.
|
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=cut
|
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
sub get_input_global_vars {
|
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
my $self = shift;
|
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
if (wantarray) {
|
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
my @list = split( /\;/, $self->{input_global_vars} );
|
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
map { s/^\"//; s/\"$//; } @list;
|
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
return \@list;
|
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
}
|
650
|
|
|
|
|
|
|
else {
|
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
return $self->{input_global_vars};
|
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
}
|
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
}
|
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
1;
|
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
__END__
|