[Bio] / FigKernelPackages / ServerThing.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/ServerThing.pm

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

revision 1.57, Thu Oct 21 13:03:16 2010 UTC revision 1.58, Sat Oct 30 13:52:58 2010 UTC
# Line 363  Line 363 
363      return $retVal;      return $retVal;
364  }  }
365    
366    =head3 ChangeDB
367    
368        ServerThing::ChangeDB($thing, $newDbName);
369    
370    Change the sapling database used by this server. The old database will be closed and a
371    new one attached.
372    
373    =over 4
374    
375    =item newDbName
376    
377    Name of the new Sapling database on which this server should operate. If omitted, the
378    default database will be used.
379    
380    =back
381    
382    =cut
383    
384    sub ChangeDB {
385        # Get the parameters.
386        my ($thing, $newDbName) = @_;
387        # Default the db-name if it's not specified.
388        if (! defined $newDbName) {
389            $newDbName = $FIG_Config::saplingDB;
390        }
391        # Check to see if we really need to change.
392        my $oldDB = $thing->{db};
393        if (! defined $oldDB || $oldDB->dbName() ne $newDbName) {
394            # We need a new sapling.
395            require Sapling;
396            my $newDB = Sapling->new(dbName => $newDbName);
397            $thing->{db} = $newDB;
398        }
399    }
400    
401    
402  =head2 Gene Correspondence File Methods  =head2 Gene Correspondence File Methods
403    
# Line 1097  Line 1132 
1132          my $start = time();          my $start = time();
1133          # The output document goes in here.          # The output document goes in here.
1134          my $document;          my $document;
         # The sapling database goes in here.  
         my $sapling;  
1135          # Protect from errors.          # Protect from errors.
1136          eval {          eval {
1137              # Here we parse the arguments. This is affected by the encoding parameter.              # Here we parse the arguments. This is affected by the encoding parameter.
# Line 1124  Line 1157 
1157          } elsif (! $function) {          } elsif (! $function) {
1158              SendError("No function specified.", "No function specified.");              SendError("No function specified.", "No function specified.");
1159          } else {          } else {
1160                # Insure we're connected to the correct database.
1161                my $dbName = $cgi->param('dbName');
1162                ChangeDB($serverThing, $dbName);
1163                # Run the request.
1164              $document = eval { $serverThing->$function($args) };              $document = eval { $serverThing->$function($args) };
1165              # If we have an error, create an error document.              # If we have an error, create an error document.
1166              if ($@) {              if ($@) {

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3