Hello community,
here is the log from the commit of package perl-Data-ObjectDriver for
openSUSE:Factory checked in at 2020-03-11 18:50:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Data-ObjectDriver (Old)
and /work/SRC/openSUSE:Factory/.perl-Data-ObjectDriver.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Data-ObjectDriver"
Wed Mar 11 18:50:22 2020 rev:4 rq:783471 version:0.19
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Data-ObjectDriver/perl-Data-ObjectDriver.changes
2019-07-17 14:27:33.315289933 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Data-ObjectDriver.new.3160/perl-Data-ObjectDriver.changes
2020-03-11 18:52:35.471600966 +0100
@@ -1,0 +2,6 @@
+Wed Mar 4 03:07:32 UTC 2020 - <[email protected]>
+
+- updated to 0.19
+ see /usr/share/doc/packages/perl-Data-ObjectDriver/Changes
+
+-------------------------------------------------------------------
Old:
----
Data-ObjectDriver-0.18.tar.gz
New:
----
Data-ObjectDriver-0.19.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Data-ObjectDriver.spec ++++++
--- /var/tmp/diff_new_pack.WvAU1w/_old 2020-03-11 18:52:36.103601249 +0100
+++ /var/tmp/diff_new_pack.WvAU1w/_new 2020-03-11 18:52:36.107601251 +0100
@@ -1,7 +1,7 @@
#
# spec file for package perl-Data-ObjectDriver
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-Data-ObjectDriver
-Version: 0.18
+Version: 0.19
Release: 0
%define cpan_name Data-ObjectDriver
Summary: Simple, transparent data interface, with caching
@@ -57,6 +57,7 @@
%prep
%setup -q -n %{cpan_name}-%{version}
+find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path
"*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Build.PL --installdirs=vendor
++++++ Data-ObjectDriver-0.18.tar.gz -> Data-ObjectDriver-0.19.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/Changes
new/Data-ObjectDriver-0.19/Changes
--- old/Data-ObjectDriver-0.18/Changes 2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/Changes 2020-03-03 16:14:30.000000000 +0100
@@ -1,4 +1,7 @@
-0.18 2019-07-09T08:11:10Z
+0.19 2020-03-03T15:14:21Z
+
+0.19 2020-03-03T15:13:37Z
+ - Parallel testing #33
0.18 2019-07-09T08:10:31Z
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/MANIFEST
new/Data-ObjectDriver-0.19/MANIFEST
--- old/Data-ObjectDriver-0.18/MANIFEST 2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/MANIFEST 2020-03-03 16:14:30.000000000 +0100
@@ -55,6 +55,7 @@
t/42-callbacks-multi-pk.t
t/50-profiling.t
t/lib/Cache/Memory.pm
+t/lib/DodTestUtil.pm
t/lib/ErrorTest.pm
t/lib/PkLess.pm
t/lib/Wine.pm
@@ -63,7 +64,6 @@
t/lib/cached/Ingredient.pm
t/lib/cached/Recipe.pm
t/lib/cached/User.pm
-t/lib/db-common.pl
t/lib/multiplexed/Ingredient2Recipe.pm
t/lib/partitioned/Ingredient.pm
t/lib/partitioned/Recipe.pm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/META.json
new/Data-ObjectDriver-0.19/META.json
--- old/Data-ObjectDriver-0.18/META.json 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/META.json 2020-03-03 16:14:30.000000000
+0100
@@ -4,7 +4,7 @@
"-2006"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v3.1.4",
+ "generated_by" : "Minilla/v3.1.9",
"license" : [
"artistic_2"
],
@@ -42,7 +42,7 @@
"DBD::SQLite" : "0",
"Test::CPAN::Meta" : "0",
"Test::MinimumVersion::Fast" : "0.04",
- "Test::PAUSE::Permissions" : "0.04",
+ "Test::PAUSE::Permissions" : "0.07",
"Test::Pod" : "1.41",
"Test::Spellunker" : "v0.2.7",
"Text::SimpleTable" : "0"
@@ -70,7 +70,7 @@
"provides" : {
"Data::ObjectDriver" : {
"file" : "lib/Data/ObjectDriver.pm",
- "version" : "0.18"
+ "version" : "0.19"
},
"Data::ObjectDriver::BaseObject" : {
"file" : "lib/Data/ObjectDriver/BaseObject.pm"
@@ -159,7 +159,7 @@
"web" : "https://github.com/sixapart/data-objectdriver"
}
},
- "version" : "0.18",
+ "version" : "0.19",
"x_authority" : "cpan:SIXAPART",
"x_contributors" : [
"Adam Thomason <[email protected]>",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/META.yml
new/Data-ObjectDriver-0.19/META.yml
--- old/Data-ObjectDriver-0.18/META.yml 2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/META.yml 2020-03-03 16:14:30.000000000 +0100
@@ -9,7 +9,7 @@
configure_requires:
Module::Build::Tiny: '0.035'
dynamic_config: 0
-generated_by: 'Minilla/v3.1.4, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Minilla/v3.1.9, CPAN::Meta::Converter version 2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,7 +28,7 @@
provides:
Data::ObjectDriver:
file: lib/Data/ObjectDriver.pm
- version: '0.18'
+ version: '0.19'
Data::ObjectDriver::BaseObject:
file: lib/Data/ObjectDriver/BaseObject.pm
Data::ObjectDriver::BaseView:
@@ -92,7 +92,7 @@
bugtracker: https://github.com/sixapart/data-objectdriver/issues
homepage: https://github.com/sixapart/data-objectdriver
repository: git://github.com/sixapart/data-objectdriver.git
-version: '0.18'
+version: '0.19'
x_authority: cpan:SIXAPART
x_contributors:
- 'Adam Thomason <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/README.md
new/Data-ObjectDriver-0.19/README.md
--- old/Data-ObjectDriver-0.18/README.md 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/README.md 2020-03-03 16:14:30.000000000
+0100
@@ -134,7 +134,7 @@
# HOW IS IT DIFFERENT?
_Data::ObjectDriver_ differs from other similar frameworks
-(e.g. [Class::DBI](https://metacpan.org/pod/Class::DBI)) in a couple of ways:
+(e.g. [Class::DBI](https://metacpan.org/pod/Class%3A%3ADBI)) in a couple of
ways:
- It has built-in support for caching.
- It has built-in support for data partitioning.
@@ -206,7 +206,7 @@
...
}
-`$iter` is blessed in
[Data::ObjectDriver::Iterator](https://metacpan.org/pod/Data::ObjectDriver::Iterator)
package, so the above
+`$iter` is blessed in
[Data::ObjectDriver::Iterator](https://metacpan.org/pod/Data%3A%3AObjectDriver%3A%3AIterator)
package, so the above
could also be written:
my $iter = Ingredient->search({ recipe_id => 5 });
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/cpanfile
new/Data-ObjectDriver-0.19/cpanfile
--- old/Data-ObjectDriver-0.18/cpanfile 2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/cpanfile 2020-03-03 16:14:30.000000000 +0100
@@ -6,6 +6,10 @@
requires 'perl', '5.006001';
recommends 'Text::SimpleTable';
+on configure => sub {
+ requires 'Module::Build::Tiny', '0.035';
+};
+
on build => sub {
requires 'ExtUtils::MakeMaker', '6.59';
requires 'Test::Exception';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver/Driver/DBD/Pg.pm
new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver/Driver/DBD/Pg.pm
--- old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver/Driver/DBD/Pg.pm
2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver/Driver/DBD/Pg.pm
2020-03-03 16:14:30.000000000 +0100
@@ -57,9 +57,20 @@
$dbh->do($sql);
foreach my $row (@{$rows_ref}) {
my $line = join("\t", map {$_ || '\N'} @{$row});
- $dbh->pg_putline($line);
+ $dbh->pg_putline("$line\n");
}
return $dbh->pg_endcopy();
}
+sub map_error_code {
+ my $dbd = shift;
+ my($code, $msg) = @_;
+
+ if ($msg && $msg =~ /(?:violates unique constraint)/) {
+ return Data::ObjectDriver::Errors->UNIQUE_CONSTRAINT;
+ } else {
+ return;
+ }
+}
+
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver/Driver/DBI.pm
new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver/Driver/DBI.pm
--- old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver/Driver/DBI.pm
2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver/Driver/DBI.pm
2020-03-03 16:14:30.000000000 +0100
@@ -316,16 +316,17 @@
}
if (! $driver->txn_active) {
$driver->begin_work;
+ my $res;
eval {
$driver->remove(@_);
- $driver->insert(@_);
+ $res = $driver->insert(@_);
};
if ($@) {
$driver->rollback;
Carp::croak("REPLACE transaction error $driver: $@");
}
$driver->commit;
- return;
+ return $res;
}
$driver->remove(@_);
$driver->insert(@_);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver.pm
new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver.pm
--- old/Data-ObjectDriver-0.18/lib/Data/ObjectDriver.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/lib/Data/ObjectDriver.pm 2020-03-03
16:14:30.000000000 +0100
@@ -11,7 +11,7 @@
__PACKAGE__->mk_accessors(qw( pk_generator txn_active ));
-our $VERSION = '0.18';
+our $VERSION = '0.19';
our $DEBUG = $ENV{DOD_DEBUG} || 0;
our $PROFILE = $ENV{DOD_PROFILE} || 0;
our $PROFILER;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/01-col-inheritance.t
new/Data-ObjectDriver-0.19/t/01-col-inheritance.t
--- old/Data-ObjectDriver-0.18/t/01-col-inheritance.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/01-col-inheritance.t 2020-03-03
16:14:30.000000000 +0100
@@ -4,12 +4,11 @@
use lib 't/lib';
-require './t/lib/db-common.pl';
-
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 15;
setup_dbs({
@@ -36,4 +35,7 @@
ok ($wine->has_column("id")) ;
ok ($wine->has_column("rating")) ;
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ Wine->driver->dbh->disconnect;
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/02-basic.t
new/Data-ObjectDriver-0.19/t/02-basic.t
--- old/Data-ObjectDriver-0.18/t/02-basic.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/02-basic.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,16 +5,14 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
use version;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -244,9 +242,12 @@
}
# note sqlite is stupid and doesn't return the number of affected rows
# quick hack because I can't rely on version.pm to be installed everywhere
- my ($sqlite_version) = Wine->driver->rw_handle->{sqlite_version} =~
/(\d+(?:\.\d+))/;
- my $count = version->parse("v$sqlite_version") > version->parse("v3.5") ?
scalar @bad_wines : "0E0";
- is (Wine->remove({}, { nofetch => 1 }), $count, 'removing all bad wine');
+ SKIP: {
+ skip "SQLite only", 1 if DodTestUtil::driver ne 'SQLite';
+ my ($sqlite_version) = Wine->driver->rw_handle->{sqlite_version} =~
/(\d+(?:\.\d+))/;
+ my $count = version->parse("v$sqlite_version") >
version->parse("v3.5") ? scalar @bad_wines : "0E0";
+ is (Wine->remove({}, { nofetch => 1 }), $count, 'removing all bad
wine');
+ }
}
# different utilities
@@ -279,5 +280,10 @@
ok $w2->object_is_stored, "an object fetched from the database is by
definition NOT ephemeral";
}
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Wine Recipe/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/03-primary-keys.t
new/Data-ObjectDriver-0.19/t/03-primary-keys.t
--- old/Data-ObjectDriver-0.18/t/03-primary-keys.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/03-primary-keys.t 2020-03-03
16:14:30.000000000 +0100
@@ -5,14 +5,12 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -92,7 +90,8 @@
}
# 0 might be a valid pk
-{
+SKIP: {
+ skip "primary key 0 has a special meaning for MySQL", 4 if
DodTestUtil::driver eq 'MySQL';
my $rv = Wine->remove({});
# make sure that remove returns the number of records deleted (1)
is($rv, 1, 'correct number of rows deleted');
@@ -106,5 +105,10 @@
is $wine->name, "zero";
}
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Wine Recipe Ingredient PkLess/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/04-clone.t
new/Data-ObjectDriver-0.19/t/04-clone.t
--- old/Data-ObjectDriver-0.18/t/04-clone.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/04-clone.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,14 +5,12 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -89,5 +87,10 @@
is $w->id, $clone->id, q(Full clone's id matches original's id);
}
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Wine Recipe Ingredient/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/05-deflate.t
new/Data-ObjectDriver-0.19/t/05-deflate.t
--- old/Data-ObjectDriver-0.18/t/05-deflate.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/05-deflate.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,14 +5,13 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
+use DodTestUtil;
+
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -93,4 +92,9 @@
is $is->[1]->name, 'Milk';
ok $is->[1]->{__cached};
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Recipe Ingredient/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/06-errors.t
new/Data-ObjectDriver-0.19/t/06-errors.t
--- old/Data-ObjectDriver-0.18/t/06-errors.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/06-errors.t 2020-03-03 16:14:30.000000000
+0100
@@ -3,15 +3,11 @@
use strict;
use lib 't/lib';
-require './t/lib/db-common.pl';
use Test::More;
use Test::Exception;
-BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
-}
+use DodTestUtil;
+BEGIN { DodTestUtil->check_driver }
plan tests => 3;
@@ -33,4 +29,7 @@
Data::ObjectDriver::Errors->UNIQUE_CONSTRAINT,
'Failed because of a unique constraint');
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ ErrorTest->driver->rw_handle->disconnect;
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/07-has-a-cached.t
new/Data-ObjectDriver-0.19/t/07-has-a-cached.t
--- old/Data-ObjectDriver-0.18/t/07-has-a-cached.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/07-has-a-cached.t 2020-03-03
16:14:30.000000000 +0100
@@ -5,15 +5,13 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
use Scalar::Util;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -67,4 +65,9 @@
is $ingredient->{__cache_recipe}, undef, "cache has effectively been
destroyed";
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Recipe Ingredient/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/07-has-a.t
new/Data-ObjectDriver-0.19/t/07-has-a.t
--- old/Data-ObjectDriver-0.18/t/07-has-a.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/07-has-a.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,15 +5,13 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
use Scalar::Util;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -66,4 +64,9 @@
my $r = $ingredient->recipe;
is $r->recipe_id, $recipe->recipe_id, "recipe id back using 'parent_method'";
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Recipe Ingredient/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/08-iterator.t
new/Data-ObjectDriver-0.19/t/08-iterator.t
--- old/Data-ObjectDriver-0.18/t/08-iterator.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/08-iterator.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,15 +5,13 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
use Scalar::Util;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/09-resultset.t
new/Data-ObjectDriver-0.19/t/09-resultset.t
--- old/Data-ObjectDriver-0.18/t/09-resultset.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/09-resultset.t 2020-03-03 16:14:30.000000000
+0100
@@ -4,13 +4,12 @@
use lib 't/lib';
-require './t/lib/db-common.pl';
-
$Data::ObjectDriver::DEBUG = 0;
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 50;
setup_dbs({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/10-resultset-peek.t
new/Data-ObjectDriver-0.19/t/10-resultset-peek.t
--- old/Data-ObjectDriver-0.18/t/10-resultset-peek.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/10-resultset-peek.t 2020-03-03
16:14:30.000000000 +0100
@@ -7,13 +7,12 @@
use lib 't/lib';
-require './t/lib/db-common.pl';
-
$Data::ObjectDriver::DEBUG = 0;
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 65;
setup_dbs({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/12-windows.t
new/Data-ObjectDriver-0.19/t/12-windows.t
--- old/Data-ObjectDriver-0.18/t/12-windows.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/12-windows.t 2020-03-03 16:14:30.000000000
+0100
@@ -6,15 +6,13 @@
use lib 't/lib';
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
use Scalar::Util;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/20-driver-sqlite.t
new/Data-ObjectDriver-0.19/t/20-driver-sqlite.t
--- old/Data-ObjectDriver-0.18/t/20-driver-sqlite.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/20-driver-sqlite.t 2020-03-03
16:14:30.000000000 +0100
@@ -4,13 +4,12 @@
use lib 't/lib';
-require './t/lib/db-common.pl';
-
$Data::ObjectDriver::DEBUG = 0;
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 13;
setup_dbs({
@@ -63,4 +62,7 @@
ok $result, 'Found Stags Leap';
is $result->rating, 3, 'Stags Leap is a 3';
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ Wine->driver->rw_handle->disconnect;
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/31-cached.t
new/Data-ObjectDriver-0.19/t/31-cached.t
--- old/Data-ObjectDriver-0.18/t/31-cached.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/31-cached.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,13 +5,11 @@
use lib 't/lib'; # for Cache::Memory substitute.
use lib 't/lib/cached';
-require './t/lib/db-common.pl';
-
use Test::More;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -189,4 +187,9 @@
require './t/txn-common.pl';
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Recipe Ingredient/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/32-partitioned.t
new/Data-ObjectDriver-0.19/t/32-partitioned.t
--- old/Data-ObjectDriver-0.18/t/32-partitioned.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/32-partitioned.t 2020-03-03
16:14:30.000000000 +0100
@@ -2,14 +2,14 @@
use strict;
+use lib 't/lib';
use lib 't/lib/partitioned';
-require './t/lib/db-common.pl';
-
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 92;
setup_dbs({
@@ -125,4 +125,8 @@
require './t/txn-common.pl';
-sub DESTROY { teardown_dbs(qw( global cluster1 cluster2 )); }
+END {
+ Recipe->driver->rw_handle->disconnect;
+ $_->rw_handle->disconnect for @{ Ingredient->driver->get_driver->(undef,
{multi_partition => 1})->partitions };
+ teardown_dbs(qw( global cluster1 cluster2 ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/33-views.t
new/Data-ObjectDriver-0.19/t/33-views.t
--- old/Data-ObjectDriver-0.18/t/33-views.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/33-views.t 2020-03-03 16:14:30.000000000
+0100
@@ -2,16 +2,13 @@
use strict;
+use lib 't/lib';
use lib 't/lib/views';
-require './t/lib/db-common.pl';
-
use Test::More;
-BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
-}
+use DodTestUtil;
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 6;
setup_dbs({
@@ -56,4 +53,9 @@
is $ingredients[0]->name, 'Vanilla Ice Cream';
}
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ for (qw/Recipe Ingredient Ingredient2Recipe IngredientsWeighted/) {
+ $_->driver->rw_handle->disconnect;
+ }
+ teardown_dbs(qw( global ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/34-both.t
new/Data-ObjectDriver-0.19/t/34-both.t
--- old/Data-ObjectDriver-0.18/t/34-both.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/34-both.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,14 +5,12 @@
use lib 't/lib';
use lib 't/lib/both';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -188,4 +186,8 @@
require './t/txn-common.pl';
-sub DESTROY { teardown_dbs(qw( global cluster1 cluster2 )); }
+END {
+ Recipe->driver->rw_handle->disconnect;
+ $_->rw_handle->disconnect for @{ Ingredient->driver->get_driver->(undef,
{multi_partition => 1})->partitions };
+ teardown_dbs(qw( global cluster1 cluster2 ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/35-multiplexed.t
new/Data-ObjectDriver-0.19/t/35-multiplexed.t
--- old/Data-ObjectDriver-0.18/t/35-multiplexed.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/35-multiplexed.t 2020-03-03
16:14:30.000000000 +0100
@@ -2,15 +2,15 @@
use strict;
+use lib 't/lib';
use lib 't/lib/multiplexed';
-require './t/lib/db-common.pl';
-
use Test::Exception;
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 42;
setup_dbs({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/41-callbacks.t
new/Data-ObjectDriver-0.19/t/41-callbacks.t
--- old/Data-ObjectDriver-0.18/t/41-callbacks.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/41-callbacks.t 2020-03-03 16:14:30.000000000
+0100
@@ -4,12 +4,10 @@
use lib 't/lib';
-require './t/lib/db-common.pl';
-
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
plan tests => 25;
@@ -119,7 +117,10 @@
};
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ Wine->driver->rw_handle->disconnect;
+ teardown_dbs(qw( global ));
+}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/42-callbacks-multi-pk.t
new/Data-ObjectDriver-0.19/t/42-callbacks-multi-pk.t
--- old/Data-ObjectDriver-0.18/t/42-callbacks-multi-pk.t 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/42-callbacks-multi-pk.t 2020-03-03
16:14:30.000000000 +0100
@@ -2,14 +2,14 @@
use strict;
+use lib 't/lib';
use lib 't/lib/partitioned';
-require './t/lib/db-common.pl';
-
use Test::More;
-unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
-}
+use DodTestUtil;
+
+BEGIN { DodTestUtil->check_driver }
+
plan tests => 13;
setup_dbs({
@@ -76,6 +76,10 @@
ok($ingredient->recipe_id, 'Ingredient assigned to a recipe');
};
-sub DESTROY { teardown_dbs(qw( global )); }
+END {
+ Recipe->driver->rw_handle->disconnect;
+ $_->rw_handle->disconnect for @{ Ingredient->driver->get_driver->(undef,
{multi_partition => 1})->partitions };
+ teardown_dbs(qw( global cluster1 cluster2 ));
+}
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/50-profiling.t
new/Data-ObjectDriver-0.19/t/50-profiling.t
--- old/Data-ObjectDriver-0.18/t/50-profiling.t 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/50-profiling.t 2020-03-03 16:14:30.000000000
+0100
@@ -5,14 +5,12 @@
use lib 't/lib';
use lib 't/lib/both';
-require './t/lib/db-common.pl';
-
use Test::More;
use Test::Exception;
+use DodTestUtil;
BEGIN {
- unless (eval { require DBD::SQLite }) {
- plan skip_all => 'Tests require DBD::SQLite';
- }
+ DodTestUtil->check_driver;
+
unless (eval { require Cache::Memory }) {
plan skip_all => 'Tests require Cache::Memory';
}
@@ -124,4 +122,8 @@
like $profiler->report_queries_by_type, qr/SELECT/;
};
-sub DESTROY { teardown_dbs(qw( global cluster1 cluster2 )); }
+END {
+ Recipe->driver->rw_handle->disconnect;
+ $_->rw_handle->disconnect for @{ Ingredient->driver->get_driver->(undef,
{multi_partition => 1})->partitions };
+ teardown_dbs(qw( global cluster1 cluster2 ));
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/DodTestUtil.pm
new/Data-ObjectDriver-0.19/t/lib/DodTestUtil.pm
--- old/Data-ObjectDriver-0.18/t/lib/DodTestUtil.pm 1970-01-01
01:00:00.000000000 +0100
+++ new/Data-ObjectDriver-0.19/t/lib/DodTestUtil.pm 2020-03-03
16:14:30.000000000 +0100
@@ -0,0 +1,121 @@
+package DodTestUtil;
+
+use strict;
+use Exporter qw/import/;
+use File::Spec;
+use Test::More;
+
+our @EXPORT = qw/setup_dbs teardown_dbs/;
+
+my %Requires = (
+ SQLite => 'DBD::SQLite',
+ MySQL => 'Test::mysqld',
+ PostgreSQL => 'Test::PostgreSQL',
+ Oracle => 'DBD::Oracle',
+ SQLServer => 'DBD::ODBC',
+);
+
+my %TestDB;
+
+sub driver { $ENV{DOD_TEST_DRIVER} || 'SQLite' }
+
+sub check_driver {
+ my $driver = driver();
+ my $module = $Requires{$driver} or plan skip_all => "Uknonwn driver:
$driver";
+ unless ( eval "require $module; 1" ) {
+ plan skip_all => "Test requires $module";
+ }
+ if ( $driver ne 'SQLite' and !eval { require SQL::Translator; 1 } ) {
+ plan skip_all => "Test requires SQL::Translator";
+ }
+}
+
+sub env {
+ my ($key, $dbname) = @_;
+ $ENV{$key} || $ENV{$key . "_" . uc $dbname} || '';
+}
+
+sub db_filename {
+ my($dbname) = @_;
+ $dbname . $$ . '.db';
+}
+
+sub dsn {
+ my($dbname) = @_;
+ my $driver = driver();
+ if ( my $dsn = env('DOD_TEST_DSN', $dbname) ) {
+ return "$dsn;dbname=$dbname";
+ }
+ if ( $driver eq 'MySQL' ) {
+ $TestDB{$dbname} ||= Test::mysqld->new(
+ my_cnf => {
+ 'skip-networking' => '', # no TCP socket
+ 'sql-mode' =>
'TRADITIONAL,NO_AUTO_VALUE_ON_ZERO,ONLY_FULL_GROUP_BY',
+ }
+ ) or die $Test::mysqld::errstr;
+ return $TestDB{$dbname}->dsn;
+ }
+ if ( $driver eq 'PostgreSQL' ) {
+ $TestDB{$dbname} ||= Test::PostgreSQL->new(
+ extra_initdb_args => '--locale=C --encoding=UTF-8',
+ pg_config => <<'CONF',
+lc_messages = 'C'
+CONF
+ ) or die $Test::PostgreSQL::errstr;
+ return $TestDB{$dbname}->dsn;
+ }
+ if ( $driver eq 'SQLite' ) {
+ return 'dbi:SQLite:' . db_filename($dbname);
+ }
+}
+
+sub setup_dbs {
+ my($info) = @_;
+ teardown_dbs(keys %$info);
+ for my $dbname (keys %$info) {
+ my $dbh = DBI->connect(
+ dsn($dbname),
+ env('DOD_TEST_USER', $dbname),
+ env('DOD_TEST_PASS', $dbname),
+ { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1 });
+ for my $table (@{ $info->{$dbname} }) {
+ $dbh->do($_) for create_sql($table);
+ }
+ $dbh->disconnect;
+ }
+}
+
+sub teardown_dbs {
+ my(@dbs) = @_;
+ my $driver = driver();
+ for my $db (@dbs) {
+ next unless $driver eq 'SQLite';
+ my $file = db_filename($db);
+ next unless -e $file;
+ unlink $file or die "Can't teardown $db: $!";
+ }
+}
+
+sub create_sql {
+ my($table) = @_;
+ my $driver = driver();
+ my $file = File::Spec->catfile('t', 'schemas', $table . '.sql');
+ open my $fh, $file or die "Can't open $file: $!";
+ my $sql = do { local $/; <$fh> };
+ close $fh;
+ if ( $driver ne 'SQLite' ) {
+ $sql .= ';';
+ my $drop_table = (grep /^DOD_TEST_DSN/, keys %ENV) ? 1 : 0;
+ my $sqlt = SQL::Translator->new(
+ parser => 'SQLite',
+ producer => $driver,
+ no_comments => 1,
+ add_drop_table => $drop_table,
+ );
+ $sql = $sqlt->translate(\$sql) or die $sqlt->error;
+ return split /;\s*/s, $sql;
+ }
+ $sql;
+}
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/ErrorTest.pm
new/Data-ObjectDriver-0.19/t/lib/ErrorTest.pm
--- old/Data-ObjectDriver-0.18/t/lib/ErrorTest.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/ErrorTest.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package ErrorTest;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -11,6 +12,6 @@
datasource => 'error_test',
primary_key => [ ],
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/PkLess.pm
new/Data-ObjectDriver-0.19/t/lib/PkLess.pm
--- old/Data-ObjectDriver-0.18/t/lib/PkLess.pm 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/lib/PkLess.pm 2020-03-03 16:14:30.000000000
+0100
@@ -1,6 +1,7 @@
# $Id: Wine.pm 1050 2005-12-08 13:46:22Z ykerherve $
use strict;
+use DodTestUtil;
package PkLess;
use base qw/Data::ObjectDriver::BaseObject/;
@@ -12,6 +13,6 @@
datasource => 'pkless',
primary_key => [ ], # proper way to skip pk (for now XXX)
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/Wine.pm
new/Data-ObjectDriver-0.19/t/lib/Wine.pm
--- old/Data-ObjectDriver-0.18/t/lib/Wine.pm 2019-07-09 10:11:18.000000000
+0200
+++ new/Data-ObjectDriver-0.19/t/lib/Wine.pm 2020-03-03 16:14:30.000000000
+0100
@@ -1,6 +1,7 @@
# $Id$
use strict;
+use DodTestUtil;
package My::BaseObject;
use base qw/Data::ObjectDriver::BaseObject/;
@@ -24,7 +25,7 @@
primary_key => 'id',
column_defs => { content => 'blob', binchar => 'binchar' },
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/both/Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/both/Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/both/Recipe.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/both/Recipe.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Cache::Memory;
use Data::ObjectDriver::Driver::Cache::Cache;
@@ -15,7 +16,7 @@
driver => Data::ObjectDriver::Driver::Cache::Cache->new(
cache => Cache::Memory->new,
fallback => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
reuse_dbh => 1,
),
),
@@ -28,7 +29,7 @@
my $cluster = shift;
my $driver = $drivers{$cluster} ||=
Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=cluster' . $cluster . '.db',
+ dsn => DodTestUtil::dsn('cluster' . $cluster),
reuse_dbh => 1,
@_,
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/cached/Ingredient.pm
new/Data-ObjectDriver-0.19/t/lib/cached/Ingredient.pm
--- old/Data-ObjectDriver-0.18/t/lib/cached/Ingredient.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/cached/Ingredient.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Ingredient;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Carp ();
use Data::ObjectDriver::Driver::DBI;
@@ -16,7 +17,7 @@
primary_key => [ 'recipe_id', 'id' ],
driver => Data::ObjectDriver::Driver::Cache::RAM->new(
fallback => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
pk_generator => \&generate_pk,
reuse_dbh => 1,
),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/cached/Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/cached/Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/cached/Recipe.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/cached/Recipe.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -11,7 +12,7 @@
datasource => 'recipes',
primary_key => 'recipe_id',
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
reuse_dbh => 1,
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/cached/User.pm
new/Data-ObjectDriver-0.19/t/lib/cached/User.pm
--- old/Data-ObjectDriver-0.18/t/lib/cached/User.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/cached/User.pm 2020-03-03
16:14:30.000000000 +0100
@@ -1,6 +1,7 @@
package User;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -30,7 +31,7 @@
datasource => 'user',
primary_key => 'user_id',
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
reuse_dbh => 1,
),
genereate_pk => sub { ++$LAST_ID },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/db-common.pl
new/Data-ObjectDriver-0.19/t/lib/db-common.pl
--- old/Data-ObjectDriver-0.18/t/lib/db-common.pl 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/db-common.pl 1970-01-01
01:00:00.000000000 +0100
@@ -1,42 +0,0 @@
-# $Id$
-
-use strict;
-use File::Spec;
-
-sub db_filename {
- my($dbname) = @_;
- $dbname . '.db';
-}
-
-sub setup_dbs {
- my($info) = @_;
- teardown_dbs(keys %$info);
- for my $dbname (keys %$info) {
- my $dbh = DBI->connect('dbi:SQLite:dbname=' . db_filename($dbname),
- '', '', { RaiseError => 1, PrintError => 0 });
- for my $table (@{ $info->{$dbname} }) {
- $dbh->do( create_sql($table) );
- }
- $dbh->disconnect;
- }
-}
-
-sub teardown_dbs {
- my(@dbs) = @_;
- for my $db (@dbs) {
- my $file = db_filename($db);
- next unless -e $file;
- unlink $file or die "Can't teardown $db: $!";
- }
-}
-
-sub create_sql {
- my($table) = @_;
- my $file = File::Spec->catfile('t', 'schemas', $table . '.sql');
- open my $fh, $file or die "Can't open $file: $!";
- my $sql = do { local $/; <$fh> };
- close $fh;
- $sql;
-}
-
-1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/t/lib/multiplexed/Ingredient2Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/multiplexed/Ingredient2Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/multiplexed/Ingredient2Recipe.pm
2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/multiplexed/Ingredient2Recipe.pm
2020-03-03 16:14:30.000000000 +0100
@@ -3,16 +3,17 @@
package Ingredient2Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
use Data::ObjectDriver::Driver::Multiplexer;
my $global1_driver = Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global1.db',
+ dsn => DodTestUtil::dsn('global1'),
);
my $global2_driver = Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global2.db',
+ dsn => DodTestUtil::dsn('global2'),
);
__PACKAGE__->install_properties({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/partitioned/Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/partitioned/Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/partitioned/Recipe.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/partitioned/Recipe.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -11,7 +12,7 @@
datasource => 'recipes',
primary_key => 'recipe_id',
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
reuse_dbh => 1,
),
});
@@ -23,7 +24,7 @@
my $cluster = shift;
my $driver = $drivers{$cluster} ||=
Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=cluster' . $cluster . '.db',
+ dsn => DodTestUtil::dsn('cluster' . $cluster),
reuse_dbh => 1,
@_,
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/views/Ingredient.pm
new/Data-ObjectDriver-0.19/t/lib/views/Ingredient.pm
--- old/Data-ObjectDriver-0.18/t/lib/views/Ingredient.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/views/Ingredient.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Ingredient;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -13,7 +14,7 @@
datasource => 'ingredients',
primary_key => 'id',
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
pk_generator => \&generate_pk,
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/t/lib/views/Ingredient2Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/views/Ingredient2Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/views/Ingredient2Recipe.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/views/Ingredient2Recipe.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package Ingredient2Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
@@ -11,7 +12,7 @@
datasource => 'ingredient2recipe',
primary_key => [ 'recipe_id', 'ingredient_id', ],
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
),
});
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/t/lib/views/IngredientsWeighted.pm
new/Data-ObjectDriver-0.19/t/lib/views/IngredientsWeighted.pm
--- old/Data-ObjectDriver-0.18/t/lib/views/IngredientsWeighted.pm
2019-07-09 10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/views/IngredientsWeighted.pm
2020-03-03 16:14:30.000000000 +0100
@@ -3,6 +3,7 @@
package IngredientsWeighted;
use strict;
use base qw( Data::ObjectDriver::BaseView );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
use Data::ObjectDriver::SQL;
@@ -10,7 +11,7 @@
__PACKAGE__->install_properties({
columns => [ 'ingredient_name', 'c' ],
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
pk_generator => \&generate_pk,
),
});
@@ -18,7 +19,7 @@
sub base_statement {
my $class = shift;
my $stmt = Data::ObjectDriver::SQL->new;
- $stmt->add_select('ingredients.name' => 'ingredient_name');
+ $stmt->add_select('MAX(ingredients.name)' => 'ingredient_name');
$stmt->add_select('COUNT(*)' => 'c');
$stmt->from([ 'ingredient2recipe', 'ingredients' ]);
$stmt->add_where('ingredients.id' => \'= ingredient2recipe.ingredient_id');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/lib/views/Recipe.pm
new/Data-ObjectDriver-0.19/t/lib/views/Recipe.pm
--- old/Data-ObjectDriver-0.18/t/lib/views/Recipe.pm 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/lib/views/Recipe.pm 2020-03-03
16:14:30.000000000 +0100
@@ -3,17 +3,18 @@
package Recipe;
use strict;
use base qw( Data::ObjectDriver::BaseObject );
+use DodTestUtil;
use Data::ObjectDriver::Driver::DBI;
use Ingredient;
use Ingredient2Recipe;
__PACKAGE__->install_properties({
- columns => [ 'id', 'title' ],
+ columns => [ 'recipe_id', 'title' ],
datasource => 'recipes',
- primary_key => 'id',
+ primary_key => 'recipe_id',
driver => Data::ObjectDriver::Driver::DBI->new(
- dsn => 'dbi:SQLite:dbname=global.db',
+ dsn => DodTestUtil::dsn('global'),
),
});
@@ -36,7 +37,7 @@
my($ingredient) = @_;
my $map = Ingredient2Recipe->new;
$map->ingredient_id($ingredient->id);
- $map->recipe_id($recipe->id);
+ $map->recipe_id($recipe->recipe_id);
$map->save;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/perf/inflate.pl
new/Data-ObjectDriver-0.19/t/perf/inflate.pl
--- old/Data-ObjectDriver-0.18/t/perf/inflate.pl 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/perf/inflate.pl 2020-03-03
16:14:30.000000000 +0100
@@ -34,4 +34,4 @@
push @users, User->inflate({ columns => $data });
});
-sub DESTROY { teardown_dbs(qw( global )); }
+END { teardown_dbs(qw( global )); }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Data-ObjectDriver-0.18/t/schemas/ingredients-view.sql
new/Data-ObjectDriver-0.19/t/schemas/ingredients-view.sql
--- old/Data-ObjectDriver-0.18/t/schemas/ingredients-view.sql 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/schemas/ingredients-view.sql 2020-03-03
16:14:30.000000000 +0100
@@ -1,6 +1,5 @@
CREATE TABLE ingredients (
- id INTEGER NOT NULL,
+ id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
name VARCHAR(50),
- quantity SMALLINT,
- PRIMARY KEY (id)
+ quantity SMALLINT
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/schemas/recipes.sql
new/Data-ObjectDriver-0.19/t/schemas/recipes.sql
--- old/Data-ObjectDriver-0.18/t/schemas/recipes.sql 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/schemas/recipes.sql 2020-03-03
16:14:30.000000000 +0100
@@ -1,5 +1,5 @@
CREATE TABLE recipes (
- recipe_id INTEGER NOT NULL PRIMARY KEY,
+ recipe_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
partition_id SMALLINT,
title VARCHAR(50)
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Data-ObjectDriver-0.18/t/schemas/wines.sql
new/Data-ObjectDriver-0.19/t/schemas/wines.sql
--- old/Data-ObjectDriver-0.18/t/schemas/wines.sql 2019-07-09
10:11:18.000000000 +0200
+++ new/Data-ObjectDriver-0.19/t/schemas/wines.sql 2020-03-03
16:14:30.000000000 +0100
@@ -1,5 +1,5 @@
CREATE TABLE wines (
- id INTEGER NOT NULL PRIMARY KEY,
+ id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
cluster_id SMALLINT,
name VARCHAR(50),
content MEDIUMBLOB,