[Bio] / Sprout / SingleTableLoad.pl Repository:
ViewVC logotype

Annotation of /Sprout/SingleTableLoad.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     =head1 Single Table Load
4 :    
5 :     This script loads one or more Sprout table from an existing DTX file.
6 :    
7 : parrello 1.2 It takes as positional parameters the table names. The command-line
8 :     options are as follows.
9 :    
10 :     =over 4
11 :    
12 :     =item trace
13 :    
14 :     Desired tracing level. The default is 3.
15 :    
16 :     =item user
17 :    
18 :     Suffix to use for trace, output, and error files created.
19 :    
20 :     =item background
21 :    
22 :     Redirect the standard and error output to files in the FIG temporary directory.
23 :    
24 :     =item sql
25 :    
26 :     Trace SQL statements.
27 :    
28 :     =item phone
29 :    
30 :     Phone number to message when the load finishes.
31 :    
32 :     =back
33 : parrello 1.1
34 :     =cut
35 :    
36 :     use strict;
37 :     use Tracer;
38 :     use DocUtils;
39 :     use TestUtils;
40 :     use Cwd;
41 :     use Sprout;
42 :     use SFXlate;
43 :     use File::Copy;
44 :     use File::Path;
45 :    
46 :     # Get the command-line options.
47 :     my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout', 'DBKernel'],
48 :     {
49 : parrello 1.2 phone => ["", "phone number (international format) to call when load finishes"],
50 : parrello 1.1 },
51 :     '<table1> <table2> ...',
52 :     @ARGV);
53 : parrello 1.2 # Set a variable to contain return type information.
54 :     my $rtype;
55 :     # Insure we catch errors.
56 :     eval {
57 :     # Get a Sprout object.
58 :     my $sprout = SFXlate->new_sprout_only();
59 :     # Attempt the load. Note that we have the truncate flag on to force the table
60 :     # to be rebuilt.
61 :     $sprout->LoadUpdate(1, \@parameters);
62 :     };
63 :     if ($@) {
64 :     Trace("Load failed with error: $@") if T(0);
65 :     $rtype = "error";
66 :     } else {
67 :     Trace("Load complete.") if T(2);
68 :     $rtype = "no error";
69 :     }
70 :     if ($options->{phone}) {
71 :     my $msgID = Tracer::SendSMS($options->{phone}, "Sprout table load terminated with $rtype.");
72 :     if ($msgID) {
73 :     Trace("Phone message sent with ID $msgID.") if T(2);
74 :     } else {
75 :     Trace("Phone message not sent.") if T(2);
76 :     }
77 :     }
78 : parrello 1.1
79 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3