Ignore:
Timestamp:
2018-11-09T19:13:32+13:00 (5 years ago)
Author:
ak19
Message:

Renamed gssql.pm to gsmysql.pm. Not subclassing the old gssql into gsmysql yet, as there's the complex issue of sighandlers, the static singleton method _get_connection_instance(), the singleton variable _db_instance and its use in the sighandlers and DESTROY, and how all of this can be impacted when making them part of an inheritance chain. Not sure of the best way to structure inheritance around these things. Even if rollback_on_cancel ends up unnecessary, the singleton method _get_connection_instance and singleton object _db_instance still impact decisions around inheritance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/GreenstoneSQLPlugin.pm

    r32591 r32592  
    3535use docprint; # for new unescape_text() subroutine
    3636use GreenstoneXMLPlugin;
    37 use gssql;
     37use gsmysql;
    3838
    3939
    4040# TODO:
    41 # - Run TODOs here, in Plugout and in gssql.pm by Dr Bainbridge.
     41# - Run TODOs here, in Plugout and in gsmysql.pm by Dr Bainbridge.
    4242# - Have not yet tested writing out just meta or just fulltxt to sql db and reading just that
    4343# back in from the sql db while the remainder is to be read back in from the docsql .xml files.
     
    7171# Test doc with meta and text like macron in Maori text.
    7272# + TODO Q: During import, the GS SQL Plugin is called before the GS SQL Plugout with undesirable side
    73 # effect that if the db doesn't exist, gssql::use_db() fails, as it won't create db.
     73# effect that if the db doesn't exist, gsmysql::use_db() fails, as it won't create db.
    7474#   This got fixed when GSSQLPlugin stopped connecting on init().
    7575#
     
    8989# Overriding plugins' remove_one() method is all I needed to do for reindex and deletion
    9090# (incremental and non-incremental) to work.
    91 # but doing all this needed an overhaul of gssql.pm and its use by the GS SQL plugin and plugout.
     91# but doing all this needed an overhaul of gsmysql.pm and its use by the GS SQL plugin and plugout.
    9292# - needed to correct plugin.pm::remove_some() to process all files
    9393# - and needed to correct GreenstoneSQLPlugin::close_document() to setOID() after all
     
    145145        'desc' => "{GreenstoneSQLPlug.rollbacl_on_cancel}" } ];
    146146
    147 # TODO: If subclassing gssql for other supporting databases and if they have different required
     147# TODO: If subclassing gsmysql for other supporting databases and if they have different required
    148148# connection parameters, we can check how WordPlugin, upon detecting Word is installed,
    149149# dynamically loads Word specific configuration options.
     
    229229# as removeold, which should drop the collection tables, happens during the import phase,
    230230# calling GreenstoneSQLPlugin::and therefore also requires a db connection.
    231 # + TODO: Eventually can try moving get_gssql_instance into gssql.pm? That way both GS SQL Plugin
     231# + TODO: Eventually can try moving get_gssql_instance into gsmysql.pm? That way both GS SQL Plugin
    232232# and Plugout would be using one connection during import.pl phase when both plugs exist.
    233233
     
    252252    ####################
    253253
    254     # create gssql object.
     254    # create gsmysql object.
    255255    # collection name will be used for naming tables (site name will be used for naming database)
    256     my $gs_sql = new gssql({
     256    my $gs_sql = new gsmysql({
    257257    'collection_name' => $ENV{'GSDLCOLLECTION'},
    258258    'verbosity' => $self->{'verbosity'} || 0
     
    286286    # This is fatal for the plugout, let's terminate here after disconnecting again
    287287    # PrintError would already have displayed the warning message on load fail
    288     # And on die() perl will call gssql destroy which will ensure a disconnect() from db
     288    # And on die() perl will call gsmysql destroy which will ensure a disconnect() from db
    289289    #$gs_sql->force_disconnect_from_db();
    290290    die("Could not use db $db_name. Can't proceed.\n");
     
    310310
    311311    # Important to call finished():
    312     # it will disconnect from db if this is the last gssql instance,
     312    # it will disconnect from db if this is the last gsmysql instance,
    313313    # and it will commit to db before disconnecting if rollbback_on_cancel turned on
    314314    $self->{'gs_sql'}->finished();
Note: See TracChangeset for help on using the changeset viewer.