#!/usr/bin/perl use warnings; use strict; use Text::WordGrams; use Lingua::StopWords qw( getStopWords ); use DBI; use DBD::SQLite; use Conclave::Utils::ISplitter; use Data::Dumper; use File::Basename; my $dbfile = shift; my $pkgid = shift; unless ($dbfile and $pkgid) { print "Example: conc-idtable2xml db.sqlite \n" and exit; } my $ids; if ($dbfile and $pkgid) { my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile"); my $sth = $dbh->prepare("SELECT * FROM idtable WHERE pkgid=?"); $sth->execute($pkgid); while (my $row = $sth->fetchrow_hashref()) { $ids->{$row->{iduid}} = $row; } } my %files; print ''."\n\n"; foreach (keys %$ids) { my $elem = lc $ids->{$_}->{idtype}; my $idline = $ids->{$_}->{idline}; my $idfile = basename $ids->{$_}->{idfile}; my $idpath = dirname $ids->{$_}->{idfile}; $files{$idfile} = $ids->{$_}->{idfile}; my $idname = $ids->{$_}->{idname}; if ($elem eq 'proc') { my $procname = "$idfile:$idname"; print "<$elem idline=\"$idline\" idfile=\"$idfile\" idpath=\"$idpath\" idname=\"$idname\" procname=\"$procname\">$_\n"; } else { print "<$elem idline=\"$idline\" idfile=\"$idfile\" idpath=\"$idpath\" idname=\"$idname\">$_\n"; } } print "\n\n"; foreach (keys %files) { print "$_\n"; } print "\n\n";