From 8f9a5221d1a950cb2964dfceb2a28d35c69b4cc0 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Mon, 8 Sep 2008 21:27:37 +0200 Subject: [PATCH] Make the export script only on given tree --- scripts/export.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/export.pl b/scripts/export.pl index 5c21edf..145f34d 100755 --- a/scripts/export.pl +++ b/scripts/export.pl @@ -26,13 +26,17 @@ BEGIN { use PciIds::Db; use PciIds::DBQAny; +my $tree = shift; + +die "Specify tree to dump as a first parameter\n" unless defined $tree; + my $db = PciIds::DBQAny::new( connectDb(), { - 'list' => 'SELECT id, name, note FROM locations WHERE id like "PC/%" OR id like "PD/%" ORDER BY id' + 'list' => 'SELECT id, name, note FROM locations WHERE id like ? ORDER BY id' } ); my $lastInvalid = undef; -foreach( @{$db->query( 'list', [] )} ) { +foreach( @{$db->query( 'list', [ "$tree/%" ] )} ) { my( $id, $name, $description ) = @{$_}; next if defined $lastInvalid and substr( $id, 0, length $lastInvalid ) eq $lastInvalid; if( !defined $name || $name eq '' ) { -- 2.39.2