Ignore:
Timestamp:
2018-10-26T20:12:14+13:00 (5 years ago)
Author:
ak19
Message:
  1. GreenstoneSQLPlugin: now sub read() calls the new lazy_get_gssql() method to only connect the first time and only if buildcol (when the processor var is a buildproc), so we don't connect in init() anymore as that got called during import.pl as well buildcol, whereas we only want to do connect/disconnet from DB stuff in this plugIN during buildcol.pl. 2. GSSQLPlugin and gssql now can delete entries from the SQL database. This can't be tested to work properly until GS SQL PlugOUT doesn't always assume removeold. At present it always does removeold: clearing the db even when incremental-import.pl is called. When there are no NEW docs in inc-import, the tables are cleared and nothing new is added, so can't test incremental behaviour during buildcol.pl/GS SQL PlugIN then either.
File:
1 edited

Legend:

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

    r32543 r32544  
    401401}
    402402
     403# delete all records in metatable with specified docid
     404# https://www.tutorialspoint.com/mysql/mysql-delete-query.htm
     405# DELETE FROM table_name [WHERE Clause]
     406# see example under 'do' at https://metacpan.org/pod/release/TIMB/DBI-1.634_50/DBI.pm
     407sub delete_recs_from_metatable_with_docid {
     408    my $self= shift (@_);
     409    my ($oid) = @_;
     410   
     411    my $dbh = $self->{'db_handle'};
     412    my $meta_table = $self->get_metadata_table_name();
     413   
     414    #my $rows_deleted =
     415    $dbh->do(qq{DELETE FROM $meta_table WHERE did = ?}, undef, $oid)
     416    or warn $dbh->errstr;
     417}
     418
     419# delete all records in metatable with specified docid
     420sub delete_recs_from_texttable_with_docid {
     421    my $self= shift (@_);
     422    my ($oid) = @_;
     423   
     424    my $dbh = $self->{'db_handle'};   
     425    my $fulltxt_table = $self->get_fulltext_table_name();
     426   
     427    $dbh->do(qq{DELETE FROM $fulltxt_table WHERE did = ?}, undef, $oid)
     428    or warn $dbh->errstr;
     429}
    403430
    404431# Can call this after connection succeeded to get the database handle, dbh,
Note: See TracChangeset for help on using the changeset viewer.