/[webpac]/trunk/index_DBI.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/index_DBI.pm

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

revision 12 by dpavlin, Wed Jan 22 22:27:19 2003 UTC revision 13 by dpavlin, Sun Feb 16 22:41:37 2003 UTC
# Line 59  sub insert { Line 59  sub insert {
59          my $self = shift;          my $self = shift;
60    
61          my $field = shift;          my $field = shift;
62          my $index_data = shift;          my $index_data = shift || return;
63          my $ident = shift;      # e.g. library id          my $ident = shift || return;    # e.g. library id
64    
65          if (! $index_data) {          if (! $index_data) {
66                  print STDERR "\$index->insert() -- no value to insert\n";                  print STDERR "\$index->insert() -- no value to insert\n";
# Line 115  sub fetch { Line 115  sub fetch {
115    
116          my @sql_args;          my @sql_args;
117    
118          my $sql = "select $what from $field";          my $sql = "select $what,ord from $field";
119    
120          if ($where) {          if ($where) {
121                  my $sql2 = " select ord from $field where upper($what) like upper(?)||'%'";                  my $sql2 = " select ord from $field where upper($what) like upper(?)||'%'";
# Line 123  sub fetch { Line 123  sub fetch {
123    
124                  $sth->execute($where) || die "sql2: $sql2; ".$self->{dbh}->errstr();                  $sth->execute($where) || die "sql2: $sql2; ".$self->{dbh}->errstr();
125                  if (my $row = $sth->fetchrow_hashref) {                  if (my $row = $sth->fetchrow_hashref) {
126                          $from_ord += $row->{ord};                          $from_ord += $row->{ord} - 1;
127                  }                  }
128          }          }
129          $sql .= " order by ord limit $rows offset $from_ord";          $sql .= " order by ord limit $rows offset $from_ord";

Legend:
Removed from v.12  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26