/[wait]/trunk/lib/WAIT/Table.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WAIT/Table.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 115 by dpavlin, Wed Jul 14 07:35:56 2004 UTC revision 116 by dpavlin, Wed Jul 14 09:48:26 2004 UTC
# Line 132  sub new { Line 132  sub new {
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.
# Line 157  sub new { Line 157  sub new {
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};
# Line 219  table! Line 219  table!
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;
# Line 278  sub create_inverted_index { Line 278  sub create_inverted_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;
# Line 484  sub insert { Line 484  sub insert {
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;
# Line 704  sub open_index_scan { Line 704  sub open_index_scan {
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    

Legend:
Removed from v.115  
changed lines
  Added in v.116

  ViewVC Help
Powered by ViewVC 1.1.26