[Lxr-commits] CVS: lxr/lib/LXR/Index Mysql.pm,1.12,1.13
Brought to you by:
ajlittoz
From: Malcolm B. <mb...@us...> - 2004-04-21 22:53:11
|
Update of /cvsroot/lxr/lxr/lib/LXR/Index In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2070/lib/LXR/Index Modified Files: Mysql.pm Log Message: Fix bug where a file that fails to index is marked as indexed for future runs. Now file is only marked as indexed/referenced after a successful completion of the pass. Fixes bug 676739 incomplete information if run is aborted Index: Mysql.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index/Mysql.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Mysql.pm 18 Nov 2001 03:31:34 -0000 1.12 +++ Mysql.pm 21 Apr 2004 22:52:11 -0000 1.13 @@ -234,8 +234,8 @@ return $symid; } -# If this file has not been indexed earlier, mark it as being indexed -# now and return true. Return false if already indexed. +# If this file has not been indexed earlier return true. Return false +# if already indexed. sub toindex { my ($self, $fileid) = @_; my ($status); @@ -247,16 +247,32 @@ if(!defined($status)) { $self->{status_insert}->execute($fileid+0, 0); } - return $self->{status_update}->execute(1, $fileid, 0) > 0; + + return $status == 0; } +sub setindexed { + my ($self, $fileid) = @_; + $self->{status_update}->execute(1, $fileid, 0); + } + sub toreference { my ($self, $fileid) = @_; - my ($rv); + my ($status); - return $self->{status_update}->execute(2, $fileid, 1) > 0; + $self->{status_get}->execute($fileid); + $status = $self->{status_get}->fetchrow_array(); + $self->{status_get}->finish(); + + return $status < 2; } +sub setreferenced { + my ($self, $fileid) = @_; + $self->{status_update}->execute(2, $fileid, 1); + } + + # This function should be called before parsing each new file, # if this is not done the too much memory will be used and # tings will become very slow. |