Skip to content
Snippets Groups Projects
Commit 49ee4845 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- improved SQLite write

- disabled check_if_dbconform() calls, because if something is not UTF8 ready, the SQLite will report it directly
- improved get_files_ref()
parent dff59cb9
No related branches found
No related tags found
No related merge requests found
......@@ -71,11 +71,19 @@ my $sourcetype="hdd"; #default value
# if IE.xml file found, read its metadata, create SQL add entry
# write SQL add entry
###############################################################################
sub write_database_creation ($fh) {
sub write_database_creation ($dbh) {
# non standard conform SQL keywords
#say $fh "CREATE DATABASE $db_name;";
#say $fh "CREATE SCHEMA $schema_name;";
#say $fh "USE ";
my $sql1=<<"SQL_PRAGMA_WAL";
PRAGMA journal_mode=WAL;
SQL_PRAGMA_WAL
my $sql2=<<"SQL_PRAGMA_ASYNC";
PRAGMA synchronous = OFF;
SQL_PRAGMA_ASYNC
my $sth1 = $dbh->prepare($sql1); $sth1->execute() or die "sql problem detected", $dbh->errstr;
my $sth2 = $dbh->prepare($sql2); $sth2->execute() or die "sql problem detected", $dbh->errstr;
return;
}
......@@ -292,7 +300,7 @@ sub check_if_db_conform ($string, $filename) {
sub get_title ($xp, $filename){
# get title
my $title = $xp->findvalue($compiled_xpath_titles);
check_if_db_conform($title, $filename);
#check_if_db_conform($title, $filename);
return $title;
}
......@@ -301,7 +309,7 @@ sub check_if_db_conform ($string, $filename) {
my @dcrecords = map {
$_->[1]=~ s/\n/ /g;
$_->[1] =~ s/'/\\'/g;
check_if_db_conform($_->[1], $filename);
#check_if_db_conform($_->[1], $filename);
$_;
} grep {
defined $_->[0] &&
......@@ -328,8 +336,8 @@ sub check_if_db_conform ($string, $filename) {
}
sub get_files_ref ($xp, $filename, $repid){
my @files_nodes = $xp->findnodes("mets:mets/mets:fileSec/mets:fileGrp[\@ADMID='$repid']/mets:file/mets:FLocat/\@xlin:href");
my @files = map {s#//#/#g; $_} map { $_->nodeValue } @files_nodes;
my @files_nodes = $xp->findnodes("/mets:mets/mets:fileSec/mets:fileGrp[\@ADMID='$repid']/mets:file/mets:FLocat/\@xlin:href");
my @files = map { my $tmp= $_->nodeValue; $tmp=~ s#//#/#g; $tmp } @files_nodes;
return \@files;
}
......@@ -340,7 +348,6 @@ sub check_if_db_conform ($string, $filename) {
my $dom = XML::LibXML->load_xml(
location => $filename,
recover => $recovery_flag,
no_blanks => 1,
compact => 1,
no_network => 1,
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment