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

Diff of /Sprout/SingleTableLoad.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Wed Apr 19 17:09:00 2006 UTC revision 1.3, Tue Feb 5 05:47:32 2008 UTC
# Line 4  Line 4 
4    
5  This script loads one or more Sprout table from an existing DTX file.  This script loads one or more Sprout table from an existing DTX file.
6    
7  It takes as positional parameters the table names.  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    
34  =cut  =cut
35    
36  use strict;  use strict;
37  use Tracer;  use Tracer;
 use DocUtils;  
 use TestUtils;  
38  use Cwd;  use Cwd;
39  use Sprout;  use Sprout;
40  use SFXlate;  use SFXlate;
# Line 21  Line 44 
44  # Get the command-line options.  # Get the command-line options.
45  my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout', 'DBKernel'],  my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout', 'DBKernel'],
46                                          {                                          {
47                                               phone => ["", "phone number (international format) to call when load finishes"],
48                                          },                                          },
49                                              '<table1> <table2> ...',                                              '<table1> <table2> ...',
50                                              @ARGV);                                              @ARGV);
51    # Set a variable to contain return type information.
52    my $rtype;
53    # Insure we catch errors.
54    eval {
55  # Get a Sprout object.  # Get a Sprout object.
56  my $sprout = SFXlate->new_sprout_only();  my $sprout = SFXlate->new_sprout_only();
57  # Attempt the load. Note that we have the truncate flag on to force the table  # Attempt the load. Note that we have the truncate flag on to force the table
58  # to be rebuilt.  # to be rebuilt.
59  $sprout->LoadUpdate(1, \@parameters);  $sprout->LoadUpdate(1, \@parameters);
60  # Denote we're done.  };
61    if ($@) {
62        Trace("Load failed with error: $@") if T(0);
63        $rtype = "error";
64    } else {
65  Trace("Load complete.") if T(2);  Trace("Load complete.") if T(2);
66        $rtype = "no error";
67    }
68    if ($options->{phone}) {
69        my $msgID = Tracer::SendSMS($options->{phone}, "Sprout table load terminated with $rtype.");
70        if ($msgID) {
71            Trace("Phone message sent with ID $msgID.") if T(2);
72        } else {
73            Trace("Phone message not sent.") if T(2);
74        }
75    }
76    
77  1;  1;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3