From: tla Date: Thu, 7 Jun 2012 11:57:19 +0000 (+0200) Subject: allow specification of database UUID X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28333e88b0c5a5d267fe3086da25882cc04f1013;p=scpubgit%2Fstemmatology.git allow specification of database UUID --- diff --git a/script/make_tradition.pl b/script/make_tradition.pl index 97e8145..591e56e 100755 --- a/script/make_tradition.pl +++ b/script/make_tradition.pl @@ -14,9 +14,9 @@ binmode STDOUT, ":utf8"; eval { no warnings; binmode $DB::OUT, ":utf8"; }; my( $informat, $inbase, $outformat, $help, $language, $name, $sep, $stemmafile, - $dsn, $dbuser, $dbpass, $from, $to ) + $dsn, $dbuser, $dbpass, $from, $to, $dbid ) = ( '', '', '', '', 'Default', 'Tradition', "\t", '', - "dbi:SQLite:dbname=stemmaweb/db/traditions.db", undef, undef, undef, undef ); + "dbi:SQLite:dbname=stemmaweb/db/traditions.db", undef, undef, undef, undef, undef ); GetOptions( 'i|in=s' => \$informat, 'b|base=s' => \$inbase, @@ -31,6 +31,7 @@ GetOptions( 'i|in=s' => \$informat, 't|to=s' => \$to, 'sep=s' => \$sep, 'dsn=s' => \$dsn, + 'dbid=s' => \$dbid, ); if( $help ) { @@ -98,7 +99,12 @@ if( $outformat eq 'stemma' ) { my $dir = Text::Tradition::Directory->new( 'dsn' => $dsn, 'extra_args' => $extra_args ); my $scope = $dir->new_scope; - my $uuid = $dir->store( $tradition ); + my $uuid; + if( $dbid ) { + $uuid = $dir->store( $dbid => $tradition ); + } else { + $uuid = $dir->store( $tradition ); + } print STDERR "Saved tradition to database with ID $uuid\n"; } else { my $output = "as_$outformat";