48 |
|
|
49 |
Name of the directory to use for the load files, WITHOUT a trailing slash. |
Name of the directory to use for the load files, WITHOUT a trailing slash. |
50 |
|
|
51 |
|
=item estimatedRows (optional) |
52 |
|
|
53 |
|
Estimated maximum number of table rows. If omitted, the table will be created in |
54 |
|
a format that permits an essentially unlimited number of rows. |
55 |
|
|
56 |
=back |
=back |
57 |
|
|
58 |
=cut |
=cut |
59 |
|
|
60 |
sub new { |
sub new { |
61 |
# Get the parameters. |
# Get the parameters. |
62 |
my ($class, $erdb, $relationName, $directory) = @_; |
my ($class, $erdb, $relationName, $directory, $estimatedRows) = @_; |
63 |
# Validate the directory name. |
# Validate the directory name. |
64 |
if (! -d $directory) { |
if (! -d $directory) { |
65 |
Confess("Load directory \"$directory\" not found."); |
Confess("Load directory \"$directory\" not found."); |
66 |
} |
} |
67 |
# Determine the name for this relation's load file. |
# Determine the name for this relation's load file. |
68 |
my $fileName = "$directory/$relationName.dtx"; |
my $fileName = "$directory/$relationName.dtx"; |
69 |
|
# Decide whether or not we should specify estimated rows. |
70 |
|
my $rowEstimate = ($FIG_Config::estimate_rows ? $estimatedRows : undef); |
71 |
# Create the target table. If this is a pre-index DBMS, we |
# Create the target table. If this is a pre-index DBMS, we |
72 |
# also create the indexes. If the table already exists, |
# also create the indexes. If the table already exists, |
73 |
# it will be dropped. |
# it will be dropped. |
74 |
$erdb->CreateTable($relationName, $FIG_Config::preIndex); |
$erdb->CreateTable($relationName, $FIG_Config::preIndex, $rowEstimate); |
75 |
# Open the output file and remember its handle. |
# Open the output file and remember its handle. |
76 |
my $fileHandle = Open(undef, ">$fileName"); |
my $fileHandle = Open(undef, ">$fileName"); |
77 |
# Create the $erload object. |
# Create the $erload object. |
177 |
$self->_FlushData(); |
$self->_FlushData(); |
178 |
# If this is a post-index DBMS, create the indexes. |
# If this is a post-index DBMS, create the indexes. |
179 |
if (! $FIG_Config::preIndex) { |
if (! $FIG_Config::preIndex) { |
180 |
$self->{erdb}->CreateIndex($self->RelName); |
$self->{dbh}->CreateIndex($self->RelName); |
181 |
} |
} |
182 |
# Delete the load file. |
# Delete the load file. |
183 |
unlink $self->{fileName}; |
unlink $self->{fileName}; |