Ignore:
Timestamp:
2018-10-19T20:54:17+13:00 (6 years ago)
Author:
ak19
Message:

Some more tidying up: some params passed by GreenstoneSQLPlugout to gssql should be instance variables, others are connection specific and now restricted to the gssql::connect_to_db() method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm

    r32529 r32530  
    119119
    120120    my $db_params = {
    121     'collection_name' => $ENV{'GSDLCOLLECTION'},
    122     'db_driver' => $self->{'db_driver'},
    123     'db_client_user' => $self->{'db_client_user'},
    124     'db_client_pwd' => $self->{'db_client_pwd'},
    125     'db_host' => $self->{'db_host'},
     121    'collection_name' => $ENV{'GSDLCOLLECTION'},   
    126122    'db_encoding' => $self->{'db_encoding'}
    127123    #'db_name' => $self->{'site_name'},
     
    131127    my $gs_sql = new gssql($db_params);
    132128   
    133     if(!$gs_sql->connect_to_db()) {
     129    # try connecting to the mysql db, if that fails it will die
     130    # so don't bother preparing GreenstoneXMLPlugout by calling superclass' begin()
     131    if(!$gs_sql->connect_to_db({
     132    'db_driver' => $self->{'db_driver'},
     133    'db_client_user' => $self->{'db_client_user'},
     134    'db_client_pwd' => $self->{'db_client_pwd'},
     135    'db_host' => $self->{'db_host'}
     136                   })
     137    )
     138    {
    134139    # This is fatal for the plugout, let's terminate here
    135140    # PrintError would already have displayed the warning message on connection fail   
Note: See TracChangeset for help on using the changeset viewer.