- Timestamp:
- 2018-10-23T15:33:31+13:00 (6 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/gssql.pm
r32530 r32531 63 63 # the GSDL_LIBRARY_URL env var is useful when running cmdline buildcol.pl in the linux package manager versions of GS3 64 64 65 # https://stackoverflow.com/questions/7083453/copying-a-hashref-in-perl 66 #my $self = {'db_driver' => $params_map{'db_driver'}, 67 #... 68 #}; 69 # Making a shallow copy 70 my $self = $params_map; 65 # https://stackoverflow.com/questions/7083453/copying-a-hashref-in-perl 66 # Making a shallow copy works, and can handle unknown params: 67 #my $self = $params_map; 68 69 # but being explicit for class params needed for MySQL: 70 my $self = { 71 'collection_name' => $params_map->{'collection_name'}, 72 'db_encoding' => $params_map->{'db_encoding'} 73 }; 74 75 # (My)SQL doesn't like tables with - (hyphens) in their names 76 my $coll_name = $params_map->{'collection_name'}; 77 $coll_name =~ s/-/_/g; 78 $self->{'tablename_prefix'} = $coll_name; 71 79 72 80 return bless($self, $class); … … 350 358 sub get_metadata_table_name { 351 359 my $self= shift (@_); 352 my $table_name = $self->{' collection_name'} . "_metadata";360 my $table_name = $self->{'tablename_prefix'} . "_metadata"; 353 361 return $table_name; 354 362 } … … 358 366 sub get_fulltext_table_name { 359 367 my $self= shift (@_); 360 my $table_name = $self->{' collection_name'} . "_fulltxt";368 my $table_name = $self->{'tablename_prefix'} . "_fulltxt"; 361 369 return $table_name; 362 370 } 371 363 372 364 373 # I can get my version of table_exists to work, but it's not so ideal -
main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm
r32530 r32531 245 245 my $self = shift (@_); 246 246 my ($doc_obj) = @_; 247 my $doc_oid = $doc_obj->get_OID(); # this method processes a single doc at a time, so it uses the same OID throughout 247 248 my $root_section = $doc_obj->get_top_section(); 248 my $doc_oid = $doc_obj->get_OID(); # we're processing a single doc at a time, so single OID249 249 250 250 # load the prepared INSERT statement handles for both tables (can be undef for any table depending on whether meta_only or txt_only are set) … … 269 269 270 270 my $debug_out = $self->{'debug_outhandle'}; 271 print STDERR "#### Meta stmt: " . $metadata_table_sth->{'Statement'} . "\n";272 print STDERR "#### Full stmt: " . $fulltxt_table_sth->{'Statement'} . "\n";271 # print STDERR "#### Meta stmt: " . $metadata_table_sth->{'Statement'} . "\n"; 272 # print STDERR "#### Full stmt: " . $fulltxt_table_sth->{'Statement'} . "\n"; 273 273 274 274 #my $proc_mode = $self->{'process_mode'}; … … 318 318 # output all subsections: RECURSIVE CALL 319 319 foreach my $subsection (@{$section_ptr->{'subsection_order'}}) { 320 &recursive_write_meta_and_text($doc_obj, $doc_oid, "$section.$subsection", $metadata_table_sth, $fulltxt_table_sth);320 $self->recursive_write_meta_and_text($doc_obj, $doc_oid, "$section.$subsection", $metadata_table_sth, $fulltxt_table_sth); 321 321 } 322 322 }
Note:
See TracChangeset
for help on using the changeset viewer.