Ignore:
Timestamp:
2018-11-07T18:39:13+13:00 (5 years ago)
Author:
ak19
Message:
  1. support for port param when connecting to SQL DB. 2. GS SQL Plugout now also uses the verbosity member variable when instantiating the gssql object. 3. Since the DBI object has PrintError set to 1 on connection (and ShowErrorStatement set to 1 to for more verbosity), which means an informative message is always printed on error or warning, there's no need for me to right warning statements everywhere when a db statement/call fails. Removed these redundant warnings. 4. Don't want GS XML Plugout's debug outhandle passed to the two gssql::insert methods, as we don't want them to write debug information to the debug handle. That should only be for the XML stuff (whether groups on or not), and the debug outhandle can moreover be set to the XSLT writer, concerning which makes it makes even less sense for gssql to output info and error debug statements into there. gssql now sticks to STDERR for debug information.
File:
1 edited

Legend:

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

    r32578 r32580  
    4242# TODO Q: what about verbosity for debugging, instead of current situation of printing out upon debug set at the expense of writing to db
    4343# TODO Q: introduced site_name param to plugins and plugouts. Did I do it right? And should they have hiddengli = "yes"
     44# Did I do the pass by ref in docprint's escape and unescape textref functions correctly, and how they're called here?
     45#   Any more optimisation I can do around this?
    4446
    4547# this plugout does not output the metadata and/or fulltxt xml to a file,
     
    4951}
    5052
    51 # NOTTODO: die() statements need to be replaced with premature_termination
     53# + NOTTODO: die() statements need to be replaced with premature_termination
    5254# which should ensure the GreenstoneXMLPlugin (group)'s stuff is closed and cleaned up SOMEHOW
    5355# It's fine: the die() stmts all take place before setting up the super class' begin
    5456
    55 # TODO Q: about build_mode: how to detect removeold. Now handled by
     57# + TODO Q: about build_mode: how to detect removeold. Now handled by
    5658#   GreenstoneSQLPlugout::remove_all(), which is inherited from a base plugin.
    57 # TODO: deal with -removeold and everything? Or type out instructions for user
    58 
    59 # TODO Q: what is "group" in GreenstoneXMLPlugout?
     59# + TODO: deal with -removeold and everything? Or type out instructions for user
     60
     61# + TODO Q: what is "group" in GreenstoneXMLPlugout?
    6062
    6163my $process_mode_list =
     
    127129
    128130    my $self= shift (@_);
    129 
     131   
    130132    # The saveas.options
    131133    #print STDERR "@@@@ PLUGOUT db_pwd: " . $self->{'db_client_pwd'} . "\n";
     
    143145    my $db_params = {
    144146    'collection_name' => $ENV{'GSDLCOLLECTION'},
    145     'verbosity' => 1
     147    'verbosity' => $self->{'verbosity'} || 0
    146148    };
    147149
     
    226228}
    227229 
    228 # TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed?
     230# + X TODO: check arc-inf.db for whether each entry is to be deleted/indexed/reindexed/been indexed?
    229231# That's only for indexing, not for this step which only generates the content in archives dir
    230232sub saveas {
     
    315317        # from db (unlike for reading back in from doc.xml)
    316318        my $escaped_meta_value = &docprint::escape_text($data->[1]);
    317 
     319       
    318320        # Write out the current section's meta to collection db's METADATA table       
    319321       
     
    322324        # filling in the values
    323325        # OR if debugging, then it will print the SQL insert statement but not execute it
    324 
    325         $gs_sql->insert_row_into_metadata_table($doc_oid, $section_name, $meta_name, $escaped_meta_value, $self->{'debug'}, $debug_out);       
    326 
    327         }
     326       
     327        $gs_sql->insert_row_into_metadata_table($doc_oid, $section_name, $meta_name, $escaped_meta_value, $self->{'debug'});
     328    }
    328329    }
    329330   
     
    337338    # The following will do the SQL insertion
    338339    # or if debug, the following will print the SQL insert stmt without executing it
    339     $gs_sql->insert_row_into_fulltxt_table($doc_oid, $section_name, $section_textref, $self->{'debug'}, $debug_out);
     340    $gs_sql->insert_row_into_fulltxt_table($doc_oid, $section_name, $section_textref, $self->{'debug'});
    340341   
    341342    }
Note: See TracChangeset for help on using the changeset viewer.