[Lxr-commits] CVS: lxr/lib/LXR/Index DBI.pm, 1.23, 1.24 Mysql.pm, 1.31, 1.32 Oracle.pm, 1.21, 1.22
Brought to you by:
ajlittoz
From: Malcolm B. <mb...@us...> - 2009-05-14 21:13:22
|
Update of /cvsroot/lxr/lxr/lib/LXR/Index In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32729/lib/LXR/Index Modified Files: DBI.pm Mysql.pm Oracle.pm Postgres.pm Removed Files: DB.pm Log Message: Remote obsolete Index::DB backend that used NDBM storage. Now only Postgres, Mysql and Oracle are supported as backends. Add a commit method to the Index interface that flushes a transaction to disk and starts another one. Added appropriate calls from genxref to Index::commit Index: DBI.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index/DBI.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- DBI.pm 21 Apr 2009 20:03:04 -0000 1.23 +++ DBI.pm 14 May 2009 21:13:07 -0000 1.24 @@ -40,6 +40,7 @@ $index = new LXR::Index::Oracle($dbname); } return $index; -} +} + 1; Index: Mysql.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index/Mysql.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- Mysql.pm 10 May 2009 11:54:29 -0000 1.31 +++ Mysql.pm 14 May 2009 21:13:07 -0000 1.32 @@ -358,6 +358,13 @@ return $id; } +sub commit { + my ($self) = @_; + $self->{dbh}->commit; + $self->{dbh}->begin_work; +} + + sub emptycache { %symcache = (); } Index: Oracle.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index/Oracle.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Oracle.pm 10 May 2009 11:54:29 -0000 1.21 +++ Oracle.pm 14 May 2009 21:13:07 -0000 1.22 @@ -354,6 +354,13 @@ return $id; } +sub commit { + my ($self) = @_; + $self->{dbh}->commit; + $self->{dbh}->begin_work; +} + + sub emptycache { %symcache = (); } Index: Postgres.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Index/Postgres.pm,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Postgres.pm 10 May 2009 11:54:29 -0000 1.32 +++ Postgres.pm 14 May 2009 21:13:07 -0000 1.33 @@ -31,8 +31,6 @@ # my (%files, %symcache); -my ($commitlimit, $transactions, $dbConnection); - sub new { my ($self, $dbname) = @_; @@ -41,8 +39,6 @@ or fatal "Can't open connection to database: $DBI::errstr\n"; $self->{dbh}->begin_work() or die "begin_work failed: $DBI::errstr"; - $commitlimit = 100; - $transactions = 0; %files = (); %symcache = (); @@ -168,7 +164,6 @@ if ($self->{dbh}) { $self->{dbh}->commit() or die "Commit failed: $DBI::errstr"; - $transactions = 0; $self->{dbh}->disconnect() or die "Disconnect failed: $DBI::errstr"; $self->{dbh} = undef; } @@ -189,7 +184,6 @@ $self->{filenum_nextval}->execute(); ($fileid) = $self->{filenum_nextval}->fetchrow_array(); $self->{files_insert}->execute($filename, $revision, $fileid); - $self->_commitIfLimit(); } $files{"$filename\t$revision"} = $fileid; # $self->{files_select}->finish(); @@ -208,7 +202,6 @@ unless ($firstrow) { $self->{releases_insert}->execute($fileid + 0, $releaseid); - $self->_commitIfLimit(); } } @@ -239,7 +232,6 @@ } else { $self->{status_update}->execute(1, $fileid, 0); } - $self->_commitIfLimit(); } sub filereferenced { @@ -266,7 +258,6 @@ } else { $self->{status_update}->execute(2, $fileid, 1); } - $self->_commitIfLimit(); } sub symdeclarations { @@ -294,7 +285,6 @@ $self->{indexes_insert}->execute($self->symid($symname), $fileid, $line, $langid, $type, $relsym ? $self->symid($relsym) : undef); - $self->_commitIfLimit(); } sub symreferences { @@ -316,7 +306,6 @@ my ($self, $symname, $fileid, $line) = @_; $self->{usage_insert}->execute($fileid, $line, $self->symid($symname)); - $self->_commitIfLimit(); } sub issymbol { @@ -341,7 +330,6 @@ $self->{symnum_nextval}->execute(); ($symid) = $self->{symnum_nextval}->fetchrow_array(); $self->{symbols_insert}->execute($symname, $symid); - $self->_commitIfLimit(); } $symcache{$symname} = $symid; } @@ -368,7 +356,6 @@ $self->{declid_nextnum}->execute(); my ($declid) = $self->{declid_nextnum}->fetchrow_array(); $self->{decl_insert}->execute($declid, $lang, $string); - $self->_commitIfLimit(); } $self->{decl_select}->execute($lang, $string); @@ -393,21 +380,14 @@ $self->{delete_releases}->execute($releaseid); $self->{delete_files}->execute($releaseid); - $self->{dbh}->commit() or die "Commit failed: $DBI::errstr"; - $self->{dbh}->begin_work() or die "begin_work failed: $DBI::errstr"; - $transactions = 0; + $self->commit() or die "Commit failed: $DBI::errstr"; } -# -# Internal subroutines -# - -sub _commitIfLimit { - my $self = shift; - unless (++$transactions % $commitlimit) { - $self->{dbh}->commit() or die "Commit failed: $DBI::errstr"; - $self->{dbh}->begin_work() or die "begin_work failed: $DBI::errstr"; - } +sub commit { + my ($self) = @_; + $self->{dbh}->commit; + $self->{dbh}->begin_work; } + 1; --- DB.pm DELETED --- |