132 |
|
|
133 |
# Check for mandatory attrs early |
# Check for mandatory attrs early |
134 |
for my $x (qw(name attr env maindbfile tablename)) { |
for my $x (qw(name attr env maindbfile tablename)) { |
135 |
$self->{$x} = $parm{$x} or croak "No $x specified"; |
$self->{$x} = $parm{$x} or confess "No $x specified"; |
136 |
} |
} |
137 |
|
|
138 |
# Do that before we eventually add '_weight' to attributes. |
# Do that before we eventually add '_weight' to attributes. |
157 |
unshift @{$parm{attr}}, '_weight' unless $attr{'_weight'}; |
unshift @{$parm{attr}}, '_weight' unless $attr{'_weight'}; |
158 |
} |
} |
159 |
|
|
160 |
$self->{path} = $parm{path} or croak "No path specified"; |
$self->{path} = $parm{path} or confess "No path specified"; |
161 |
bless $self, $type; |
bless $self, $type; |
162 |
|
|
163 |
$self->{djk} = $parm{djk} if defined $parm{djk}; |
$self->{djk} = $parm{djk} if defined $parm{djk}; |
219 |
sub create_index { |
sub create_index { |
220 |
my $self= shift; |
my $self= shift; |
221 |
|
|
222 |
croak "Cannot create index for table aready populated" |
confess "Cannot create index for table aready populated" |
223 |
if $self->{nextk} > 1; |
if $self->{nextk} > 1; |
224 |
|
|
225 |
require WAIT::Index; |
require WAIT::Index; |
278 |
my $self = shift; |
my $self = shift; |
279 |
my %parm = @_; |
my %parm = @_; |
280 |
|
|
281 |
croak "No attribute specified" unless $parm{attribute}; |
confess "No attribute specified" unless $parm{attribute}; |
282 |
croak "No pipeline specified" unless $parm{pipeline}; |
confess "No pipeline specified" unless $parm{pipeline}; |
283 |
|
|
284 |
$parm{predicate} ||= $parm{pipeline}->[-1]; |
$parm{predicate} ||= $parm{pipeline}->[-1]; |
285 |
|
|
286 |
croak "Cannot create index for table aready populated" |
confess "Cannot create index for table aready populated" |
287 |
if $self->{nextk} > 1; |
if $self->{nextk} > 1; |
288 |
|
|
289 |
require WAIT::InvertedIndex; |
require WAIT::InvertedIndex; |
484 |
defined $self->{db} or $self->open; |
defined $self->{db} or $self->open; |
485 |
|
|
486 |
# We should move all writing methods to a subclass to check only once |
# We should move all writing methods to a subclass to check only once |
487 |
$self->{mode} & O_RDWR or croak "Cannot insert into table opened in RD_ONLY mode"; |
$self->{mode} & O_RDWR or confess "Cannot insert into table opened in RD_ONLY mode"; |
488 |
|
|
489 |
my $tuple = join($;, map($parm{$_} || '', @{$self->{attr}})); |
my $tuple = join($;, map($parm{$_} || '', @{$self->{attr}})); |
490 |
my $key; |
my $key; |
704 |
if (defined $self->{indexes}->{$name}) { |
if (defined $self->{indexes}->{$name}) { |
705 |
$self->{indexes}->{$name}->open_scan($code); |
$self->{indexes}->{$name}->open_scan($code); |
706 |
} else { |
} else { |
707 |
croak "No such index '$name'"; |
confess "No such index '$name'"; |
708 |
} |
} |
709 |
} |
} |
710 |
|
|