[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.2, Wed Jul 5 21:48:11 2006 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    
# Line 21  Line 46 
46  # Get the command-line options.  # Get the command-line options.
47  my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout', 'DBKernel'],  my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout', 'DBKernel'],
48                                          {                                          {
49                                               phone => ["", "phone number (international format) to call when load finishes"],
50                                          },                                          },
51                                              '<table1> <table2> ...',                                              '<table1> <table2> ...',
52                                              @ARGV);                                              @ARGV);
53    # Set a variable to contain return type information.
54    my $rtype;
55    # Insure we catch errors.
56    eval {
57  # Get a Sprout object.  # Get a Sprout object.
58  my $sprout = SFXlate->new_sprout_only();  my $sprout = SFXlate->new_sprout_only();
59  # 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
60  # to be rebuilt.  # to be rebuilt.
61  $sprout->LoadUpdate(1, \@parameters);  $sprout->LoadUpdate(1, \@parameters);
62  # Denote we're done.  };
63    if ($@) {
64        Trace("Load failed with error: $@") if T(0);
65        $rtype = "error";
66    } else {
67  Trace("Load complete.") if T(2);  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    
79  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3