/[webpac]/trunk2/lib/WebPac/Index.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 /trunk2/lib/WebPac/Index.pm

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

revision 60 by dpavlin, Fri Jul 4 18:23:00 2003 UTC revision 93 by dpavlin, Sun Jul 13 14:44:03 2003 UTC
# Line 17  my %sth_cache; # cache prepared statemen Line 17  my %sth_cache; # cache prepared statemen
17  my $c_table;  my $c_table;
18  my $c_count;  my $c_count;
19    
20    # bench time
21    my $t = time();
22    
23  sub new {  sub new {
24          my $class = shift;          my $class = shift;
25          my $self = {};          my $self = {};
# Line 96  sub insert { Line 99  sub insert {
99          $Table{$field}++;          $Table{$field}++;
100    
101          #$sth_cache{$field."select"}->execute($index_data) || die "cache: $field select; ".$self->{dbh}->errstr();          #$sth_cache{$field."select"}->execute($index_data) || die "cache: $field select; ".$self->{dbh}->errstr();
102    
103            # XXX for some strange reason, it seems that some entries in my
104            # database produce strings which start with null byte. I suspect
105            # this to be bug in OpenIsis 0.9.0.
106            # This should fix it..
107            $index_data =~ s/^[^\w]+//;
108          $index_data = substr($index_data,0,255);          $index_data = substr($index_data,0,255);
109    
110          my $uc = uc($index_data);          my $uc = uc($index_data);
111          if (! $c_table->{$field}->{$ident}->{$uc}) {          if (! $c_table->{$field}->{$ident}->{$uc}) {
112                  $sth_cache{$field."insert"}->execute($index_data,$ident,0) || die "cache: $field insert; ".$self->{dbh}->errstr();                  $sth_cache{$field."insert"}->execute($index_data,$ident,0) || warn "cache: $field insert ($index_data,$ident); ".$self->{dbh}->errstr();
113  #print stderr "in index: $index_data\n";  #print stderr "in index: $index_data\n";
114                  $c_table->{$field}->{$ident}->{$uc} = $index_data;                  $c_table->{$field}->{$ident}->{$uc} = $index_data;
115                  $c_count->{$field}->{$ident}->{$uc} = 1;                  $c_count->{$field}->{$ident}->{$uc} = 1;
# Line 191  sub close { Line 201  sub close {
201    
202                  foreach my $table (keys %Table) {                  foreach my $table (keys %Table) {
203  # FIX  # FIX
204    print STDERR "last operation took ",time()-$t," seconds...\n";
205    $t=time();
206  print STDERR "creating ord for $table...\n";  print STDERR "creating ord for $table...\n";
207                          create_ord($table);                          create_ord($table);
208                          undef $sth_cache{$table."select"};                          undef $sth_cache{$table."select"};

Legend:
Removed from v.60  
changed lines
  Added in v.93

  ViewVC Help
Powered by ViewVC 1.1.26