Bugzilla – Attachment 63460 Details for
Bug 18601
OAI/Sets.t mangles data due to truncate in ModOAISetsBiblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18601: OAI/Sets.t mangles data due to truncate in ModOAISetsBiblios
Bug-18601-OAISetst-mangles-data-due-to-truncate-in.patch (text/plain), 3.03 KB, created by
Marcel de Rooy
on 2017-05-15 08:11:23 UTC
(
hide
)
Description:
Bug 18601: OAI/Sets.t mangles data due to truncate in ModOAISetsBiblios
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-05-15 08:11:23 UTC
Size:
3.03 KB
patch
obsolete
>From a8911227fc7ffba2be91f0217427d2268d307c5f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 15 May 2017 09:58:04 +0200 >Subject: [PATCH] Bug 18601: OAI/Sets.t mangles data due to truncate in > ModOAISetsBiblios >Content-Type: text/plain; charset=utf-8 > >This patch replaces the TRUNCATE statement in ModOAISetsBiblios by a >DELETE statement. A truncate will cause an implicit commit and will >therefore commit the transaction started in the test script. > >Also simplifying the module load in the test script. > >Test plan: >Do not apply this patch and observe that biblio records are added to your >database by running t/db_dependent/OAI/Sets.t. >Apply this patch, run the test again and verify that it does no longer >add records to your biblio table. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/OAI/Sets.pm | 4 ++-- > t/db_dependent/OAI/Sets.t | 40 ++++++++++------------------------------ > 2 files changed, 12 insertions(+), 32 deletions(-) > >diff --git a/C4/OAI/Sets.pm b/C4/OAI/Sets.pm >index e2d8586..62c98d8 100644 >--- a/C4/OAI/Sets.pm >+++ b/C4/OAI/Sets.pm >@@ -525,7 +525,7 @@ sub CalcOAISetsBiblio { > }; > ModOAISetsBiblios($oai_sets_biblios); > >-ModOAISetsBiblios truncate oai_sets_biblios table and call AddOAISetsBiblios. >+ModOAISetsBiblios deletes all records from oai_sets_biblios table and calls AddOAISetsBiblios. > This table is then used in opac/oai.pl. > > =cut >@@ -537,7 +537,7 @@ sub ModOAISetsBiblios { > > my $dbh = C4::Context->dbh; > my $query = qq{ >- TRUNCATE TABLE oai_sets_biblios >+ DELETE FROM oai_sets_biblios > }; > my $sth = $dbh->prepare($query); > $sth->execute; >diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t >index b1ce6ab..33b12e0 100644 >--- a/t/db_dependent/OAI/Sets.t >+++ b/t/db_dependent/OAI/Sets.t >@@ -17,40 +17,20 @@ > # with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use C4::Context; >-use Test::More tests => 148; >+ >+use Test::More tests => 144; > use Test::MockModule; > use Test::Warn; >+use MARC::Record; > >+use Koha::Database; >+use C4::Biblio; >+use C4::OAI::Sets; > >-BEGIN { >- use_ok('C4::OAI::Sets'); >- use_ok('MARC::Record'); >- use_ok('C4::Biblio'); >-} >-can_ok( >- 'C4::OAI::Sets', qw( >- GetOAISets >- GetOAISet >- GetOAISetBySpec >- ModOAISet >- DelOAISet >- AddOAISet >- GetOAISetsMappings >- GetOAISetMappings >- ModOAISetMappings >- GetOAISetsBiblio >- DelOAISetsBiblio >- CalcOAISetsBiblio >- ModOAISetsBiblios >- UpdateOAISetsBiblio >- AddOAISetsBiblios ) >-); >- >- >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; > my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >+ > $dbh->do('DELETE FROM oai_sets'); > $dbh->do('DELETE FROM oai_sets_descriptions'); > $dbh->do('DELETE FROM oai_sets_mappings'); >@@ -632,4 +612,4 @@ sub create_helper_biblio { > return $biblionumber; > } > >-$dbh->rollback; >\ No newline at end of file >+$schema->storage->txn_rollback; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18601
:
63460
|
63670
|
64269