- Timestamp:
- 2018-10-24T20:11:33+13:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugouts/GreenstoneSQLPlugout.pm
r32533 r32536 40 40 41 41 # TODO: SIGTERM rollback and disconnect? 42 42 # TODO Q: what about verbosity for debugging 43 43 44 44 # this plugout does not output xml to a file, but outputs rows into a mysql table … … 146 146 if(!$gs_sql->load_db_and_tables($db_name, $build_mode)) { 147 147 148 # This is fatal for the plugout, let's terminate here 149 # PrintError would already have displayed the warning message on connection fail 150 die("Could not use db or prepare its tables. Can't proceed.\n"); 148 # This is fatal for the plugout, let's terminate here after disconnecting again 149 # PrintError would already have displayed the warning message on load fail 150 $gs_sql->disconnect_from_db() 151 || warn("Unable to disconnect from database " . $self->{'site_name'} . "\n"); 152 die("Could not use db $db_name and/or prepare its tables. Can't proceed.\n"); 151 153 } 152 154 … … 184 186 $self->{'gs_sql'}->disconnect_from_db() || warn("Unable to disconnect from database " . $self->{'site_name'} . "\n"); # disconnect_from_db() will also issue a warning, but this may be clearer 185 187 } 186 187 # produce files called docsql .xml instead of doc.xml188 sub get_ short_doc_file {188 189 # produce files called docsql-<OID>.xml instead of doc.xml 190 sub get_doc_xml_filename { 189 191 my $self = shift (@_); 190 my ($doc_dir) = @_; 191 return &FileUtils::filenameConcatenate($doc_dir, "docsql.xml"); 192 } 193 194 # produce files called docsql.xml instead of doc.xml 195 sub get_output_file { 196 my $self = shift (@_); 197 my ($doc_dir) = @_; 198 return &FileUtils::filenameConcatenate($self->{'output_dir'}, $doc_dir, "docsql.xml"); 192 my ($doc_obj) = @_; 193 194 my $doc_id = $doc_obj->get_OID(); 195 my $filename = $doc_id ? "docsql-".$doc_id.".xml" : "docsql.xml"; 196 return $filename; 199 197 } 200 198 … … 204 202 my ($doc_obj, $doc_dir) = @_; 205 203 206 print STDERR "\n\n@@@ In saveas\n\n";204 # print STDERR "\n\n@@@ In saveas\n\n"; 207 205 208 206 my $proc_mode = $self->{'process_mode'}; … … 291 289 foreach my $data (@{$section_ptr->{'metadata'}}) { 292 290 my $meta_name = $data->[0]; 291 # TODO: does it need to be stored escaped, as it requires unescaping when read back in 292 # from db (unlike for reading back in from doc.xml) 293 293 my $escaped_meta_value = &docprint::escape_text($data->[1]); 294 294
Note:
See TracChangeset
for help on using the changeset viewer.