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 moved

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/gsmysql.pm

    r32591 r32592  
    11###########################################################################
    22#
    3 # gssql.pm -- DBI for SQL related utility functions used by
     3# gsmysql.pm -- Uses DBI for MySQL related utility functions used by
    44# GreenstoneSQLPlugout and GreenstoneSQLPlugin too.
    55# A component of the Greenstone digital library software
     
    2525###########################################################################
    2626
    27 package gssql;
     27package gsmysql;
    2828
    2929use strict;
     
    4343# TODO Q: If disconnect is automatically called when object destroyed, what does that mean
    4444# for our file-global handle object, is disconnect only called at end of perl process?
    45 # Does that mean we don't need to explicitly call disconnect in gssql object's destroy during
     45# Does that mean we don't need to explicitly call disconnect in gsmysql object's destroy during
    4646# the GLOBAL destruction phase?
    4747# https://perldoc.perl.org/perlobj.html#Destructors
     
    345345}
    346346
    347 # Will disconnect if this instance of gssql holds the last reference to the db connection
     347# Will disconnect if this instance of gsmysql holds the last reference to the db connection
    348348# If disconnecting and autocommit is off, then this will commit before disconnecting
    349349sub finished {
     
    385385    # NO: "When all the data has been fetched from a SELECT statement, the driver will automatically call finish for you. So you should not call it explicitly except when you know that you've not fetched all the data from a statement handle and the handle won't be destroyed soon."
    386386   
    387     print STDERR "    GSSQL disconnecting from database\n" if $self->{'verbosity'};
     387    print STDERR "    GSMySQL disconnecting from database\n" if $self->{'verbosity'};
    388388    # Just go through the singleton db handle to disconnect
    389389    $_dbh_instance->disconnect or warn $_dbh_instance->errstr;
    390390    $_dbh_instance = undef;
    391391    }
    392     # Number of gssql objects that share a live connection is now 0, as the connection's dead
    393     # either because the last gssql object finished() or because connection was killed (force)
     392    # Number of gsmysql objects that share a live connection is now 0, as the connection's dead
     393    # either because the last gsmysql object finished() or because connection was killed (force)
    394394    $ref_count = 0;
    395395}
Note: See TracChangeset for help on using the changeset viewer.