- Timestamp:
- 2018-11-06T19:26:08+13:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm
r32573 r32578 143 143 my $db_params = { 144 144 'collection_name' => $ENV{'GSDLCOLLECTION'}, 145 'verbosity' => 1 145 'verbosity' => 1 146 146 }; 147 147 148 148 my $gs_sql = new gssql($db_params); 149 149 150 # try connecting to the mysql db, if that fails it will die151 # so don't bother preparing GreenstoneXMLPlugout by calling superclass' begin()150 # try connecting to the mysql db, die if that fails 151 # So don't bother preparing GreenstoneXMLPlugout by calling superclass' begin() yet 152 152 if(!$gs_sql->connect_to_db({ 153 153 'db_driver' => $self->{'db_driver'}, … … 181 181 # This is fatal for the plugout, let's terminate here after disconnecting again 182 182 # PrintError would already have displayed the warning message on load fail 183 $gs_sql->disconnect_from_db() 184 || warn("Unable to disconnect from database.\n"); 183 $gs_sql->force_disconnect_from_db(); # disconnect_from_db() will issue a warning on error 185 184 die("Could not use db $db_name and/or prepare its tables. Can't proceed.\n"); 186 185 } … … 205 204 $self->SUPER::end(@_); 206 205 207 $self->{'gs_sql'}->disconnect_from_db() || warn("Unable to disconnect from database " . $self->{'site_name'} . "\n"); # disconnect_from_db() will also issue a warning, but this may be clearer 206 $self->{'gs_sql'}->finished(); # will disconnect from db if last instance 207 delete $self->{'gs_sql'}; # key gs_sql no longer exists, not just the value being undef 208 208 } 209 209
Note:
See TracChangeset
for help on using the changeset viewer.