Bug 13669: (alternative) use DBIx::RunSQL
Alternative POC solution, on top of
previous patches, feel free to obsolte.
This patch use DBIx::RunSQL->run_sql_file
to procees each sql file.
To test:
1) Apply all patches
2) Same test plan of patch 1
Timing test running web installer, marc21,
all sample data, time in seconds
a) without patch
structure data
59.7 66.5
58.6 66.0
b) SQL::SplitStatement (patch 1+2)
59.4 101
59.7 102
c) DBIx::RunSQL (patch 3)
60.7 66.8
59.4 66.2
Tomas' version is a bit slower loading sample data,
all give similar results processing kohastructure.
New dependency to package: DBIx::RunSQL
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e64f01ce0d)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
parent
24373a1745
commit
e8a703b076
|
|
@ -21,8 +21,7 @@ use Modern::Perl;
|
|||
|
||||
use Encode qw( encode is_utf8 );
|
||||
our $VERSION = 3.07.00.049;
|
||||
use File::Slurp;
|
||||
use SQL::SplitStatement;
|
||||
use DBIx::RunSQL;
|
||||
use C4::Context;
|
||||
use C4::Installer::PerlModules;
|
||||
use DBI;
|
||||
|
|
@ -436,17 +435,12 @@ sub load_sql {
|
|||
|
||||
my $dbh = $self->{ dbh };
|
||||
|
||||
my $sql = read_file( $filename, binmode => ':utf8');
|
||||
my $sql_splitter = SQL::SplitStatement->new;
|
||||
my @statements = $sql_splitter->split($sql);
|
||||
my $error = "";
|
||||
my $error = DBIx::RunSQL->run_sql_file(
|
||||
dbh => $dbh,
|
||||
sql => $filename,
|
||||
);
|
||||
|
||||
foreach my $statement ( @statements ) {
|
||||
$dbh->do($statement);
|
||||
if( $dbh->err) {
|
||||
$error .= "$filename (" . $dbh->errstr . "): $statement\n";
|
||||
}
|
||||
}
|
||||
$error = ( $error ) ? "ERROR: $filename" : "";
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
-- Refer to http://www.niso.org/standards/index.html
|
||||
|
||||
-- General Holdings: Type of Unit Designator
|
||||
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','0','Information not available; Not applicable');INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','a','Basic bibliographic unit');
|
||||
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','0','Information not available; Not applicable');
|
||||
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','a','Basic bibliographic unit');
|
||||
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','c','Secondary bibliographic unit: supplements, special issues, accompanying material, other secondary bibliographic units');
|
||||
INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('HINGS_UT','d','Indexes');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue