Hello community, here is the log from the commit of package perl-Tie-Hash-DBD for openSUSE:Factory checked in at 2011-11-21 12:49:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Tie-Hash-DBD (Old) and /work/SRC/openSUSE:Factory/.perl-Tie-Hash-DBD.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Tie-Hash-DBD", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Tie-Hash-DBD/perl-Tie-Hash-DBD.changes 2011-09-23 12:39:18.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Tie-Hash-DBD.new/perl-Tie-Hash-DBD.changes 2011-11-21 12:49:22.000000000 +0100 @@ -1,0 +2,12 @@ +Fri Nov 18 13:29:21 UTC 2011 - [email protected] + +- update to 0.10 + - NAME / DISTNAME in Makefile.PL + + - Up copyright to 2011 + - More cross-checks for META data + + - Use Storable's nfreeze () instead of freeze () + - Add transaction support in Tie::Hash::DBD + +------------------------------------------------------------------- Old: ---- Tie-Hash-DBD-0.07.tgz New: ---- Tie-Hash-DBD-0.10.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Tie-Hash-DBD.spec ++++++ --- /var/tmp/diff_new_pack.Uw86B7/_old 2011-11-21 12:49:23.000000000 +0100 +++ /var/tmp/diff_new_pack.Uw86B7/_new 2011-11-21 12:49:23.000000000 +0100 @@ -18,15 +18,14 @@ Name: perl-Tie-Hash-DBD -Version: 0.07 +Version: 0.10 Release: 1 License: GPL+ or Artistic %define cpan_name Tie-Hash-DBD Summary: Tie plain hashes to DBI interface Url: http://search.cpan.org/dist/Tie-Hash-DBD/ Group: Development/Libraries/Perl -#Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/Tie-Hash-DBD-%{version}.tgz -Source: %{cpan_name}-%{version}.tgz +Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/Tie-Hash-DBD-%{version}.tgz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl ++++++ Tie-Hash-DBD-0.07.tgz -> Tie-Hash-DBD-0.10.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/Changes new/Tie-Hash-DBD-0.10/Changes --- old/Tie-Hash-DBD-0.07/Changes 2010-09-06 10:38:02.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/Changes 2011-09-07 18:04:36.000000000 +0200 @@ -1,5 +1,19 @@ Revision history for Tie::DBD +0.10 07 Sep 2011 - H.Merijn Brand + + - NAME / DISTNAME in Makefile.PL + +0.09 07 Sep 2011 - H.Merijn Brand + + - Up copyright to 2011 + - More cross-checks for META data + +0.08 25 Jan 2011 - H.Merijn Brand + + - Use Storable's nfreeze () instead of freeze () + - Add transaction support in Tie::Hash::DBD + 0.07 06 Sep 2010 - H.Merijn Brand - More tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/MANIFEST new/Tie-Hash-DBD-0.10/MANIFEST --- old/Tie-Hash-DBD-0.07/MANIFEST 2010-09-06 10:45:39.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/MANIFEST 2011-09-07 18:17:37.000000000 +0200 @@ -12,11 +12,13 @@ t/22_stream.t t/23_persist.t t/25_SQLite.t +t/26_autoc.t t/30_Pg.t t/31_bulk.t t/32_stream.t t/33_persist.t t/35_Pg.t +t/36_autoc.t t/40_CSV.t t/41_bulk.t t/42_stream.t @@ -27,11 +29,13 @@ t/52_stream.t t/53_persist.t t/55_mysql.t +t/56_autoc.t t/60_Oracle.t t/61_bulk.t t/62_stream.t t/63_persist.t t/65_Oracle.t +t/66_autoc.t t/70_Unify.t t/71_bulk.t t/72_stream.t @@ -39,4 +43,5 @@ t/75_Unify.t t/util.pl examples/copy.pl -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/META.json new/Tie-Hash-DBD-0.10/META.json --- old/Tie-Hash-DBD-0.07/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Hash-DBD-0.10/META.json 2011-09-07 18:17:37.000000000 +0200 @@ -0,0 +1,49 @@ +{ + "resources" : { + "repository" : "http://repo.or.cz/w/Tie-Hash-DBD.git", + "license" : "http://dev.perl.org/licenses/" + }, + "meta-spec" : { + "version" : "2.0", + "url" : "https://metacpan.org/module/CPAN::Meta::Spec?#meta-spec" + }, + "test_requires" : { + "Test::More" : "0.90", + "Test::Harness" : "0", + "Time::HiRes" : "0" + }, + "distribution_type" : "module", + "generated_by" : "Author", + "version" : "0.10", + "name" : "Tie-Hash-DBD", + "author" : [ + "H.Merijn Brand <[email protected]>" + ], + "license" : "perl", + "provides" : { + "Tie::Array::DBD" : { + "version" : "0.10", + "file" : "lib/Tie/Array/DBD.pm" + }, + "Tie::Hash::DBD" : { + "version" : "0.10", + "file" : "lib/Tie/Hash/DBD.pm" + } + }, + "requires" : { + "perl" : "5.008", + "Storable" : "0", + "DBI" : "1.613", + "Carp" : "0" + }, + "recommends" : { + "Test::More" : "0.98", + "perl" : "5.014001", + "DBD::SQLite" : "1.33", + "DBI" : "1.616" + }, + "abstract" : "Tie plain hashes to DBI interface", + "configure_requires" : { + "ExtUtils::MakeMaker" : "0" + } + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/META.yml new/Tie-Hash-DBD-0.10/META.yml --- old/Tie-Hash-DBD-0.07/META.yml 2010-09-06 10:45:39.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/META.yml 2011-09-07 18:17:37.000000000 +0200 @@ -1,6 +1,6 @@ --- #YAML:1.0 -name: Tie::Hash::DBD -version: 0.07 +name: Tie-Hash-DBD +version: 0.10 abstract: Tie plain hashes to DBI interface license: perl author: @@ -10,10 +10,10 @@ provides: Tie::Hash::DBD: file: lib/Tie/Hash/DBD.pm - version: 0.07 + version: 0.10 Tie::Array::DBD: file: lib/Tie/Array/DBD.pm - version: 0.07 + version: 0.10 requires: perl: 5.008 Carp: 0 @@ -21,15 +21,15 @@ Storable: 0 configure_requires: ExtUtils::MakeMaker: 0 -build_requires: - perl: 5.008 +test_requires: Test::Harness: 0 Test::More: 0.90 Time::HiRes: 0 recommends: - perl: 5.012001 - DBD::SQLite: 0.29 - Test::More: 0.96 + perl: 5.014001 + DBI: 1.616 + DBD::SQLite: 1.33 + Test::More: 0.98 resources: license: http://dev.perl.org/licenses/ repository: http://repo.or.cz/w/Tie-Hash-DBD.git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/Makefile.PL new/Tie-Hash-DBD-0.10/Makefile.PL --- old/Tie-Hash-DBD-0.07/Makefile.PL 2010-08-10 15:24:47.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/Makefile.PL 2011-09-07 17:58:27.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright 2010-2010 H.Merijn Brand +# Copyright 2010-2011 H.Merijn Brand require 5.008; use strict; @@ -9,6 +9,7 @@ my %wm = ( NAME => "Tie::Hash::DBD", + DISTNAME => "Tie-Hash-DBD", ABSTRACT => "Tie a hash to a database", AUTHOR => "H.Merijn Brand <h.m.brand\@xs4all.nl>", LICENSE => "perl", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/README new/Tie-Hash-DBD-0.10/README --- old/Tie-Hash-DBD-0.07/README 2010-09-06 10:30:28.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/README 2011-01-25 08:44:09.000000000 +0100 @@ -41,7 +41,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2010-2010 H.Merijn Brand. All rights reserved. +Copyright (C) 2010-2011 H.Merijn Brand. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/lib/Tie/Array/DBD.pm new/Tie-Hash-DBD-0.10/lib/Tie/Array/DBD.pm --- old/Tie-Hash-DBD-0.07/lib/Tie/Array/DBD.pm 2010-09-06 10:37:18.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/lib/Tie/Array/DBD.pm 2011-09-07 13:44:50.000000000 +0200 @@ -1,6 +1,6 @@ package Tie::Array::DBD; -our $VERSION = "0.07"; +our $VERSION = "0.10"; use strict; use warnings; @@ -8,7 +8,7 @@ use Carp; use DBI; -use Storable qw( freeze thaw ); +use Storable qw( nfreeze thaw ); my $dbdx = 0; @@ -173,7 +173,7 @@ defined $val or return undef; $self->{str} or return $val; - $self->{str} eq "Storable" and return freeze ({ val => $val }); + $self->{str} eq "Storable" and return nfreeze ({ val => $val }); } # _stream sub _unstream @@ -452,7 +452,7 @@ tbl => "t_tie_analysis", key => "h_key", fld => "h_value", - str => "Storable, + str => "Storable", }; $array[42] = $value; # INSERT @@ -625,7 +625,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2010-2010 H.Merijn Brand +Copyright (C) 2010-2011 H.Merijn Brand This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/lib/Tie/Hash/DBD.pm new/Tie-Hash-DBD-0.10/lib/Tie/Hash/DBD.pm --- old/Tie-Hash-DBD-0.07/lib/Tie/Hash/DBD.pm 2010-08-20 11:51:42.000000000 +0200 +++ new/Tie-Hash-DBD-0.10/lib/Tie/Hash/DBD.pm 2011-09-07 13:44:36.000000000 +0200 @@ -1,6 +1,6 @@ package Tie::Hash::DBD; -our $VERSION = "0.07"; +our $VERSION = "0.10"; use strict; use warnings; @@ -8,7 +8,7 @@ use Carp; use DBI; -use Storable qw( freeze thaw ); +use Storable qw( nfreeze thaw ); my $dbdx = 0; @@ -124,6 +124,7 @@ tmp => $tmp, str => undef, asc => $cnf->{k_asc} || 0, + trh => 0, }; if ($opt) { @@ -133,12 +134,17 @@ $opt->{fld} and $f_v = $opt->{fld}; $opt->{tbl} and $h->{tbl} = $opt->{tbl}; $opt->{str} and $h->{str} = $opt->{str}; + $opt->{trh} and $h->{trh} = $opt->{trh}; } $h->{f_k} = $f_k; $h->{f_v} = $f_v; + $h->{trh} and $dbh->{AutoCommit} = 0; - unless ($h->{tbl}) { # Create a temporary table + if ($h->{tbl}) { # Used told the table name + $dbh->{AutoCommit} = 1 unless $h->{trh} || $dbt eq "CSV" || $dbt eq "Unify"; + } + else { # Create a temporary table $tmp = ++$dbdx; $h->{tbl} = "t_tie_dbdh_$$" . "_$tmp"; } @@ -176,7 +182,7 @@ defined $val or return undef; $self->{str} or return $val; - $self->{str} eq "Storable" and return freeze ({ val => $val }); + $self->{str} eq "Storable" and return nfreeze ({ val => $val }); } # _stream sub _unstream @@ -193,18 +199,28 @@ my ($self, $key, $value) = @_; my $k = $self->{asc} ? unpack "H*", $key : $key; my $v = $self->_stream ($value); - $self->EXISTS ($key) + $self->{trh} and $self->{dbh}->begin_work; + my $r = $self->EXISTS ($key) ? $self->{upd}->execute ($v, $k) : $self->{ins}->execute ($k, $v); + $self->{trh} and $self->{dbh}->commit; + $r; } # STORE sub DELETE { my ($self, $key) = @_; $self->{asc} and $key = unpack "H*", $key; + $self->{trh} and $self->{dbh}->begin_work; $self->{sel}->execute ($key); - my $r = $self->{sel}->fetch or return; + my $r = $self->{sel}->fetch; + unless ($r) { + $self->{trh} and $self->{dbh}->rollback; + return; + } + $self->{del}->execute ($key); + $self->{trh} and $self->{dbh}->commit; $self->_unstream ($r->[0]); } # DELETE @@ -234,8 +250,13 @@ sub FIRSTKEY { my $self = shift; + $self->{trh} and $self->{dbh}->begin_work; $self->{key} = $self->{dbh}->selectcol_arrayref ("select $self->{f_k} from $self->{tbl}"); - @{$self->{key}} or return; + $self->{trh} and $self->{dbh}->commit; + unless (@{$self->{key}}) { + $self->{trh} and $self->{dbh}->commit; + return; + } if ($self->{asc}) { $_ = pack "H*", $_ for @{$self->{key}}; } @@ -245,7 +266,10 @@ sub NEXTKEY { my $self = shift; - @{$self->{key}} or return; + unless (@{$self->{key}}) { + $self->{trh} and $self->{dbh}->commit; + return; + } pop @{$self->{key}}; } # FIRSTKEY @@ -305,7 +329,8 @@ tbl => "t_tie_analysis", key => "h_key", fld => "h_value", - str => "Storable, + str => "Storable", + trh => 0, }; $hash{key} = $value; # INSERT @@ -373,6 +398,9 @@ be created with C<key> and <fld>, but it will not be dropped at the end of the session. +If a table name is provided, C<AutoCommit> will be "On" for persistence, +unless you provide a true C<trh> attribute. + =item key Defines the name of the key field in the database table. The default is @@ -394,6 +422,13 @@ If you want to preserve Encoding on the hash values, you should use this feature. +=item trh + +Use transaction Handles. By default none of the operations is guarded by +transaction handling for speed reasons. Set C<trh> to a true value cause +all actions to be surrounded by C<begin_work> and C<commit>. Note that +this may have a big impact on speed. + =back =head2 Encoding @@ -456,6 +491,10 @@ alternative streaming modules, like C<Data::Dump::Streamer> or use mixin approaches that enable you to fit in your own. +=item * + +Note that neither DBD::CSV nor DBD::Unify support C<AutoCommit>. + =back =head1 TODO @@ -480,14 +519,14 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2010-2010 H.Merijn Brand +Copyright (C) 2010-2011 H.Merijn Brand This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO -DBI, Tie::DBI, Tie::Hash +DBI, Tie::DBI, Tie::Hash, Redis::Hash =cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/t/26_autoc.t new/Tie-Hash-DBD-0.10/t/26_autoc.t --- old/Tie-Hash-DBD-0.07/t/26_autoc.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Hash-DBD-0.10/t/26_autoc.t 2011-01-25 08:30:01.000000000 +0100 @@ -0,0 +1,30 @@ +#!/pro/bin/perl + +use strict; +use warnings; + +use Test::More; +use Tie::Hash::DBD; + +require "t/util.pl"; + +my %hash; +my $DBD = "SQLite"; +cleanup ($DBD); +my $tbl = "t_tie_$$"."_persist"; +eval { tie %hash, "Tie::Hash::DBD", dsn ($DBD), { tbl => $tbl } }; + +unless (tied %hash) { + my $reason = DBI->errstr; + $reason or ($reason = $@) =~ s/:.*//s; + $reason and substr $reason, 0, 0, " - "; + plan skip_all => "DBD::$DBD$reason"; + } + +ok (tied %hash, "Hash tied"); +ok ((tied %hash)->{dbh}{AutoCommit}, "AutoCommit ON"); + +untie %hash; +cleanup ($DBD); + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/t/36_autoc.t new/Tie-Hash-DBD-0.10/t/36_autoc.t --- old/Tie-Hash-DBD-0.07/t/36_autoc.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Hash-DBD-0.10/t/36_autoc.t 2011-01-25 08:45:56.000000000 +0100 @@ -0,0 +1,30 @@ +#!/pro/bin/perl + +use strict; +use warnings; + +use Test::More; +use Tie::Hash::DBD; + +require "t/util.pl"; + +my %hash; +my $DBD = "Pg"; +cleanup ($DBD); +my $tbl = "t_tie_$$"."_persist"; +eval { tie %hash, "Tie::Hash::DBD", dsn ($DBD), { tbl => $tbl } }; + +unless (tied %hash) { + my $reason = DBI->errstr; + $reason or ($reason = $@) =~ s/:.*//s; + $reason and substr $reason, 0, 0, " - "; + plan skip_all => "DBD::$DBD$reason"; + } + +ok (tied %hash, "Hash tied"); +ok ((tied %hash)->{dbh}{AutoCommit}, "AutoCommit ON"); + +untie %hash; +cleanup ($DBD); + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/t/56_autoc.t new/Tie-Hash-DBD-0.10/t/56_autoc.t --- old/Tie-Hash-DBD-0.07/t/56_autoc.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Hash-DBD-0.10/t/56_autoc.t 2011-01-25 08:47:35.000000000 +0100 @@ -0,0 +1,30 @@ +#!/pro/bin/perl + +use strict; +use warnings; + +use Test::More; +use Tie::Hash::DBD; + +require "t/util.pl"; + +my %hash; +my $DBD = "mysql"; +cleanup ($DBD); +my $tbl = "t_tie_$$"."_persist"; +eval { tie %hash, "Tie::Hash::DBD", dsn ($DBD), { tbl => $tbl } }; + +unless (tied %hash) { + my $reason = DBI->errstr; + $reason or ($reason = $@) =~ s/:.*//s; + $reason and substr $reason, 0, 0, " - "; + plan skip_all => "DBD::$DBD$reason"; + } + +ok (tied %hash, "Hash tied"); +ok ((tied %hash)->{dbh}{AutoCommit}, "AutoCommit ON"); + +untie %hash; +cleanup ($DBD); + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Hash-DBD-0.07/t/66_autoc.t new/Tie-Hash-DBD-0.10/t/66_autoc.t --- old/Tie-Hash-DBD-0.07/t/66_autoc.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Hash-DBD-0.10/t/66_autoc.t 2011-01-25 08:47:40.000000000 +0100 @@ -0,0 +1,30 @@ +#!/pro/bin/perl + +use strict; +use warnings; + +use Test::More; +use Tie::Hash::DBD; + +require "t/util.pl"; + +my %hash; +my $DBD = "Oracle"; +cleanup ($DBD); +my $tbl = "t_tie_$$"."_persist"; +eval { tie %hash, "Tie::Hash::DBD", dsn ($DBD), { tbl => $tbl } }; + +unless (tied %hash) { + my $reason = DBI->errstr; + $reason or ($reason = $@) =~ s/:.*//s; + $reason and substr $reason, 0, 0, " - "; + plan skip_all => "DBD::$DBD$reason"; + } + +ok (tied %hash, "Hash tied"); +ok ((tied %hash)->{dbh}{AutoCommit}, "AutoCommit ON"); + +untie %hash; +cleanup ($DBD); + +done_testing; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
