Hello community, here is the log from the commit of package perl-DBD-CSV for openSUSE:Factory checked in at 2013-08-13 09:50:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-DBD-CSV (Old) and /work/SRC/openSUSE:Factory/.perl-DBD-CSV.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-DBD-CSV" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-DBD-CSV/perl-DBD-CSV.changes 2013-06-28 18:55:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-DBD-CSV.new/perl-DBD-CSV.changes 2013-08-13 09:50:26.000000000 +0200 @@ -1,0 +2,19 @@ +Sat Jul 27 11:58:53 UTC 2013 - [email protected] + +- updated to 0.40 + * Fix version references in doc + * Fix tests for Windows + + * Use f_file in docs. file is deprecated + * DBD::CSV's repository moved to github + * Add test for row-completeness + * Fix UTF-8 tests to better follow Text::CSV_XS auto-encoding + * Require more recent versions of low level modules that fixe + issues reported for DBD::CSV + * Development will also do mosts tests with DBI_SQL_NANO=1 + * Added support for f_dir_search from DBD::File (in fact DBI was + changed to feature this for DBD::CSV :) + * Fix test relying on spell-error in DBI's error message + * Document csv_class (still undertested) + +------------------------------------------------------------------- Old: ---- DBD-CSV-0.38.tgz New: ---- DBD-CSV-0.40.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-DBD-CSV.spec ++++++ --- /var/tmp/diff_new_pack.bgzFAb/_old 2013-08-13 09:50:27.000000000 +0200 +++ /var/tmp/diff_new_pack.bgzFAb/_new 2013-08-13 09:50:27.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-DBD-CSV -Version: 0.38 +Version: 0.40 Release: 0 %define cpan_name DBD-CSV Summary: DBI driver for CSV files @@ -29,17 +29,18 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(DBD::File) >= 0.41 -BuildRequires: perl(DBI) >= 1.623 -BuildRequires: perl(SQL::Statement) >= 1.402 -BuildRequires: perl(Test::More) >= 0.90 -BuildRequires: perl(Text::CSV_XS) >= 0.94 +BuildRequires: perl(DBD::File) >= 0.42 +BuildRequires: perl(DBI) >= 1.628 +BuildRequires: perl(SQL::Statement) >= 1.405 +BuildRequires: perl(Test::More) >= 0.9 +BuildRequires: perl(Text::CSV_XS) >= 1.01 #BuildRequires: perl(DBD::CSV) -Requires: perl(DBD::File) >= 0.41 -Requires: perl(DBI) >= 1.623 -Requires: perl(SQL::Statement) >= 1.402 +#BuildRequires: perl(version) +Requires: perl(DBD::File) >= 0.42 +Requires: perl(DBI) >= 1.628 +Requires: perl(SQL::Statement) >= 1.405 Requires: perl(Test::More) >= 0.9 -Requires: perl(Text::CSV_XS) >= 0.94 +Requires: perl(Text::CSV_XS) >= 1.01 Recommends: perl(Test::More) >= 0.98 %{perl_requires} ++++++ DBD-CSV-0.38.tgz -> DBD-CSV-0.40.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/ChangeLog new/DBD-CSV-0.40/ChangeLog --- old/DBD-CSV-0.38/ChangeLog 2013-01-09 20:30:30.000000000 +0100 +++ new/DBD-CSV-0.40/ChangeLog 2013-07-23 08:47:38.000000000 +0200 @@ -1,5 +1,22 @@ +0.40 - 2013-07-23, H.Merijn Brand + * Fix version references in doc + * Fix tests for Windows + +0.39 - 2013-06-28, H.Merijn Brand + * Use f_file in docs. file is deprecated + * DBD::CSV's repository moved to github + * Add test for row-completeness + * Fix UTF-8 tests to better follow Text::CSV_XS auto-encoding + * Require more recent versions of low level modules that fixe + issues reported for DBD::CSV + * Development will also do mosts tests with DBI_SQL_NANO=1 + * Added support for f_dir_search from DBD::File (in fact DBI was + changed to feature this for DBD::CSV :) + * Fix test relying on spell-error in DBI's error message + * Document csv_class (still undertested) + 0.38 - 2013-01-09, H.Merijn Brand - * + * the tar paxheaders hit again (http://www.perlmonks.org/?node_id=1004571) 0.37 - 2013-01-09, H.Merijn Brand * Fixed RT#80078, resulting in getline calls on undef (Benjamin Booth) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/MANIFEST new/DBD-CSV-0.40/MANIFEST --- old/DBD-CSV-0.38/MANIFEST 2013-01-09 22:06:51.000000000 +0100 +++ new/DBD-CSV-0.40/MANIFEST 2013-07-23 08:49:32.000000000 +0200 @@ -22,7 +22,9 @@ t/48_utf8.t t/50_chopblanks.t t/51_commit.t +t/55_dir_search.t t/60_misc.t +t/61_meta.t t/70_csv.t t/71_csv-ext.t t/72_csv-schema.t @@ -30,6 +32,7 @@ t/80_rt.t t/85_error.t t/lib.pl +t/tmp.csv examples/passwd.pl 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/DBD-CSV-0.38/MANIFEST.SKIP new/DBD-CSV-0.40/MANIFEST.SKIP --- old/DBD-CSV-0.38/MANIFEST.SKIP 2010-06-11 13:19:14.000000000 +0200 +++ new/DBD-CSV-0.40/MANIFEST.SKIP 2013-06-11 18:37:29.000000000 +0200 @@ -17,5 +17,4 @@ ^xx META.yml valgrind.log -xt/00_minimumversion.t -xt/00_pod_spell.t +xt/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/META.json new/DBD-CSV-0.40/META.json --- old/DBD-CSV-0.38/META.json 2013-01-09 22:06:51.000000000 +0100 +++ new/DBD-CSV-0.40/META.json 2013-07-23 08:49:33.000000000 +0200 @@ -1,72 +1,72 @@ { - "resources" : { - "repository" : { - "web" : "http://repo.or.cz/w/DBD-CSV.git", - "url" : "http://repo.or.cz/r/DBD-CSV.git", - "type" : "git" - }, - "license" : [ - "http://dev.perl.org/licenses/" - ] - }, - "meta-spec" : { - "version" : "2", - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" - }, "generated_by" : "Author", - "version" : "0.38", - "name" : "DBD-CSV", - "x_installdirs" : "site", - "author" : [ - "Jochen Wiedmann", - "Jeff Zucker", - "H.Merijn Brand <[email protected]>", - "Jens Rehsack <[email protected]>" - ], + "release_status" : "stable", "dynamic_config" : 1, - "license" : [ - "perl_5" - ], + "x_installdirs" : "site", + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, "prereqs" : { "test" : { "requires" : { - "Test::Harness" : "0", - "Test::More" : "0.90", + "Cwd" : "0", "charnames" : "0", "Encode" : "0", - "Cwd" : "0" + "Test::Harness" : "0", + "Test::More" : "0.90" } }, - "runtime" : { + "build" : { "requires" : { - "perl" : "5.008001", - "Text::CSV_XS" : "0.94", - "SQL::Statement" : "1.402", - "DBI" : "1.623", - "DBD::File" : "0.41" - }, + "Config" : "0" + } + }, + "runtime" : { "recommends" : { - "perl" : "5.016002", + "perl" : "5.016003", "Test::More" : "0.98" + }, + "requires" : { + "SQL::Statement" : "1.405", + "DBD::File" : "0.42", + "perl" : "5.008001", + "DBI" : "1.628", + "Text::CSV_XS" : "1.01" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } - }, - "build" : { - "requires" : { - "Config" : "0" - } } }, + "abstract" : "DBI driver for CSV files", + "author" : [ + "Jochen Wiedmann", + "Jeff Zucker", + "H.Merijn Brand <[email protected]>", + "Jens Rehsack <[email protected]>" + ], + "license" : [ + "perl_5" + ], + "resources" : { + "repository" : { + "type" : "git", + "web" : "https://github.com/perl5-dbi/DBD-CSV.git", + "url" : "https://github.com/perl5-dbi/DBD-CSV.git" + }, + "license" : [ + "http://dev.perl.org/licenses/" + ] + }, + "version" : "0.40", + "name" : "DBD-CSV", "provides" : { "DBD::CSV" : { - "version" : "0.38", - "file" : "lib/DBD/CSV.pm" + "file" : "lib/DBD/CSV.pm", + "version" : "0.40" } - }, - "abstract" : "DBI driver for CSV files", - "release_status" : "stable" + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/META.yml new/DBD-CSV-0.40/META.yml --- old/DBD-CSV-0.38/META.yml 2013-01-09 22:06:51.000000000 +0100 +++ new/DBD-CSV-0.40/META.yml 2013-07-23 08:49:33.000000000 +0200 @@ -7,15 +7,10 @@ - Jens Rehsack <[email protected]> build_requires: Config: 0 - Cwd: 0 - Encode: 0 - Test::Harness: 0 - Test::More: '0.90' - charnames: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 -generated_by: Author +generated_by: Author, CPAN::Meta::Converter version 2.131560 license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -24,18 +19,23 @@ provides: DBD::CSV: file: lib/DBD/CSV.pm - version: '0.38' + version: '0.40' recommends: Test::More: '0.98' - perl: '5.016002' + perl: '5.016003' requires: - DBD::File: '0.41' - DBI: '1.623' - SQL::Statement: '1.402' - Text::CSV_XS: '0.94' + Cwd: 0 + DBD::File: '0.42' + DBI: '1.628' + Encode: 0 + SQL::Statement: '1.405' + Test::Harness: 0 + Test::More: '0.90' + Text::CSV_XS: '1.01' + charnames: 0 perl: '5.008001' resources: license: http://dev.perl.org/licenses/ - repository: http://repo.or.cz/r/DBD-CSV.git -version: '0.38' + repository: https://github.com/perl5-dbi/DBD-CSV.git +version: '0.40' x_installdirs: site diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/Makefile.PL new/DBD-CSV-0.40/Makefile.PL --- old/DBD-CSV-0.38/Makefile.PL 2013-01-09 22:06:32.000000000 +0100 +++ new/DBD-CSV-0.40/Makefile.PL 2013-06-27 09:31:20.000000000 +0200 @@ -33,10 +33,10 @@ AUTHOR => "H.Merijn Brand <h.merijn\@xs4all.nl>", VERSION_FROM => "lib/DBD/CSV.pm", PREREQ_PM => { - "DBI" => 1.623, - "DBD::File" => 0.41, - "Text::CSV_XS" => 0.94, - "SQL::Statement" => 1.402, + "DBI" => 1.628, + "DBD::File" => 0.42, + "Text::CSV_XS" => 1.01, + "SQL::Statement" => 1.405, "Test::More" => 0.90, "Encode" => 0, "charnames" => 0, @@ -65,6 +65,9 @@ my $min_vsn = ($] >= 5.010 && -d "xt" && ($ENV{AUTOMATED_TESTING} || 0) != 1) ? join "\n" => 'test ::', + ' -@env DBI_SQL_NANO=1 TEST_FILES="t/[012367]*.t t/4[038]*.t t/5[05]*.t t/85*.t" make -e test_dynamic', + '', + 'test ::', ' -@env TEST_FILES="xt/*.t" make -e test_dynamic', '' : ""; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/README new/DBD-CSV-0.40/README --- old/DBD-CSV-0.38/README 2013-01-02 23:51:05.000000000 +0100 +++ new/DBD-CSV-0.40/README 2013-05-22 16:28:10.000000000 +0200 @@ -23,15 +23,17 @@ the Perl README file. Recent changes can be (re)viewed in the public GIT repository at - http://repo.or.cz/w/DBD-CSV.git + https://github.com/perl5-dbi/DBD-CSV.git Feel free to clone your own copy: - $ git clone http://repo.or.cz/r/DBD-CSV.git DBD-CSV + $ git clone https://github.com/perl5-dbi/DBD-CSV.git DBD-CSV or get it as a tgz: $ wget --output-document=DBD-CSV-git.tgz \ - 'http://repo.or.cz/w/DBD-CSV.git?a=snapshot;sf=tgz' + 'https://github.com/perl5-dbi/DBD-CSV/archive/master.tar.gz + + which will unpack to DBD-CSV-master Prerequisites: DBI - the DBI (Database independent interface for Perl). @@ -46,10 +48,9 @@ cpan DBD::CSV Or standard build/installation: - gzip -cd DBD-CSV-0.33.tar.gz | tar xf - - cd DBD-CSV-0.33 + gzip -cd DBD-CSV-0.39.tar.gz | tar xf - + cd DBD-CSV-0.39 perl Makefile.PL - make make test make install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/lib/Bundle/DBD/CSV.pm new/DBD-CSV-0.40/lib/Bundle/DBD/CSV.pm --- old/DBD-CSV-0.38/lib/Bundle/DBD/CSV.pm 2013-01-09 20:31:00.000000000 +0100 +++ new/DBD-CSV-0.40/lib/Bundle/DBD/CSV.pm 2013-07-22 17:49:31.000000000 +0200 @@ -5,7 +5,7 @@ use strict; use warnings; -our $VERSION = "1.07"; +our $VERSION = "1.08"; 1; @@ -21,15 +21,15 @@ =head1 CONTENTS -DBI 1.623 +DBI 1.628 -Text::CSV_XS 0.94 +Text::CSV_XS 1.01 -SQL::Statement 1.402 +SQL::Statement 1.405 -DBD::File 0.41 +DBD::File 0.42 -DBD::CSV 0.38 +DBD::CSV 0.40 =head1 DESCRIPTION diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/lib/DBD/CSV.pm new/DBD-CSV-0.40/lib/DBD/CSV.pm --- old/DBD-CSV-0.38/lib/DBD/CSV.pm 2013-01-09 20:30:47.000000000 +0100 +++ new/DBD-CSV-0.40/lib/DBD/CSV.pm 2013-07-23 07:43:04.000000000 +0200 @@ -23,7 +23,7 @@ @ISA = qw( DBD::File ); -$VERSION = "0.38"; +$VERSION = "0.40"; $ATTRIBUTION = "DBD::CSV $DBD::CSV::VERSION by H.Merijn Brand"; $err = 0; # holds error code for DBI::err @@ -411,15 +411,16 @@ =item DBI X<DBI> -The DBI (Database independent interface for Perl), version 1.00 or -a later release +A recent version of the L<DBI> (Database independent interface for Perl). +See below why. =item DBD::File X<DBD::File> This is the base class for DBD::CSV, and it is part of the DBI -distribution. As DBD::CSV requires version 0.38 or newer for DBD::File -it effectively requires DBI version 1.611 or newer. +distribution. As DBD::CSV requires a matching version of L<DBD::File> +which is (partly) developed by the same team that maintains +DBD::CSV. See META.json or Makefile.PL for the minimum versions. =item SQL::Statement X<SQL::Statement> @@ -431,7 +432,8 @@ It is possible to run C<DBD::CSV> without this module if you define the environment variable C<$DBI_SQL_NANO> to 1. This will reduce the SQL support a lot though. See L<DBI::SQL::Nano> for more details. Note -that the test suite does not test in this mode! +that the test suite does only test in this mode in the development +environment. =item Text::CSV_XS X<Text::CSV_XS> @@ -458,12 +460,12 @@ If you cannot, for whatever reason, use cpan, fetch all modules from CPAN, and build with a sequence like: - gzip -d < DBD-CSV-0.28.tgz | tar xf - + gzip -d < DBD-CSV-0.40.tgz | tar xf - (this is for Unix users, Windows users would prefer WinZip or something similar) and then enter the following: - cd DBD-CSV-0.28 + cd DBD-CSV-0.40 perl Makefile.PL make test @@ -518,6 +520,7 @@ $dbh = DBI->connect ("dbi:CSV:", undef, undef, { f_schema => undef, f_dir => "data", + f_dir_search => [], f_ext => ".csv/r", f_lock => 2, f_encoding => "utf8", @@ -529,7 +532,7 @@ csv_class => "Text::CSV_XS", csv_null => 1, csv_tables => { - info => { file => "info.csv" } + info => { f_file => "info.csv" } }, RaiseError => 1, @@ -769,6 +772,19 @@ opened. Usually you set it in the dbh and it defaults to the current directory ("."). However, it may be overridden in statement handles. +=item f_dir_search +X<f_dir_search> + +This attribute optionally defines a list of extra directories to search +when opening existing tables. It should be an anonymous list or an array +reference listing all folders where tables could be found. + + my $dbh = DBI->connect ("dbi:CSV:", "", "", { + f_dir => "data", + f_dir_search => [ "ref/data", "ref/old" ], + f_ext => ".csv/r", + }) or die $DBI::errstr; + =item f_ext X<f_ext> @@ -825,6 +841,20 @@ But see L<DBD::File/"KNOWN BUGS">. +=head2 DBD::CSV specific attributes + +=over 4 + +=item csv_class + +The attribute I<csv_class> controls the CSV parsing engine. This defaults +to C<Text::CSV_XS>, but C<Text::CSV> can be used in some cases, too. +Please be aware that C<Text::CSV> does not care about any edge case as +C<Text::CSV_XS> does and that C<Text::CSV> is probably about 100 times +slower than C<Text::CSV_XS>. + +=back + =head2 Text::CSV_XS specific attributes =over 4 @@ -841,17 +871,15 @@ =item csv_escape_char X<csv_escape_char> -=item csv_class -X<csv_class> - =item csv_csv X<csv_csv> The attributes I<csv_eol>, I<csv_sep_char>, I<csv_quote_char> and I<csv_escape_char> are corresponding to the respective attributes of the -Text::CSV_XS object. You may want to set these attributes if you have unusual -CSV files like F</etc/passwd> or MS Excel generated CSV files with a semicolon -as separator. Defaults are "\015\012", ';', '"' and '"', respectively. +I<csv_class> (usually Text::CSV_CS) object. You may want to set these +attributes if you have unusual CSV files like F</etc/passwd> or MS Excel +generated CSV files with a semicolon as separator. Defaults are +"\015\012", ';', '"' and '"', respectively. The I<csv_eol> attribute defines the end-of-line pattern, which is better known as a record separator pattern since it separates records. The default @@ -927,10 +955,10 @@ =over 4 -=item file -X<file> +=item f_file +X<f_file> -The tables file name; defaults to +The name of the file used for the table; defaults to "$dbh->{f_dir}/$table" @@ -1016,7 +1044,7 @@ sep_char => ":", quote_char => undef, escape_char => undef, - file => "/etc/passwd", + f_file => "/etc/passwd", col_names => [qw( login password uid gid realname directory shell )], }; @@ -1042,7 +1070,7 @@ =item list_tables X<list_tables> -This method returns a list of file names inside $dbh->{directory}. +This method returns a list of file-names inside $dbh->{directory}. Example: my $dbh = DBI->connect ("dbi:CSV:directory=/usr/local/csv_data"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/10_base.t new/DBD-CSV-0.40/t/10_base.t --- old/DBD-CSV-0.38/t/10_base.t 2010-08-06 13:41:56.000000000 +0200 +++ new/DBD-CSV-0.40/t/10_base.t 2013-05-30 14:31:11.000000000 +0200 @@ -15,7 +15,9 @@ do "t/lib.pl"; -diag ("Showing relevant versions"); +my $nano = $ENV{DBI_SQL_NANO}; +defined $nano or $nano = "not set"; +diag ("Showing relevant versions (DBI_SQL_NANO = $nano)"); diag ("Using DBI version $DBI::VERSION"); diag ("Using DBD::File version $DBD::File::VERSION"); diag ("Using SQL::Statement version $SQL::Statement::VERSION"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/30_insertfetch.t new/DBD-CSV-0.40/t/30_insertfetch.t --- old/DBD-CSV-0.38/t/30_insertfetch.t 2010-08-06 13:42:05.000000000 +0200 +++ new/DBD-CSV-0.40/t/30_insertfetch.t 2013-05-30 11:26:35.000000000 +0200 @@ -80,6 +80,16 @@ ok ($sth->finish, "finish"); undef $sth; +ok ($dbh->do ("delete from $tbl"), "delete all"); +ok ($dbh->do ("insert into $tbl (id) values (0)"), "insert just one field"); +{ local (@ARGV) = DbFile ($tbl); + my @csv = <>; + s/\r?\n\Z// for @csv; + is (scalar @csv, 2, "Just two lines"); + is ($csv[0], "id,name,val,txt", "header"); + is ($csv[1], "0,,,", "data"); + } + ok ($dbh->do ("drop table $tbl"), "drop"); ok ($dbh->disconnect, "disconnect"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/43_blobs.t new/DBD-CSV-0.40/t/43_blobs.t --- old/DBD-CSV-0.38/t/43_blobs.t 2010-08-06 13:42:16.000000000 +0200 +++ new/DBD-CSV-0.40/t/43_blobs.t 2013-06-11 18:34:43.000000000 +0200 @@ -23,7 +23,8 @@ qr{^create table $tbl}i, "table definition"); ok ($dbh->do ($def), "create table"); -ok (my $blob = (join "", map { chr $_ } 0 .. 255) x $size, "create blob"); +ok (my $blob = (pack "C*", 0 .. 255) x $size, "create blob"); +is (length $blob, $size * 256, "blob size"); ok (my $qblob = $dbh->quote ($blob), "quote blob"); ok ($dbh->do ("insert into $tbl values (1, ?)", undef, $blob), "insert"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/48_utf8.t new/DBD-CSV-0.40/t/48_utf8.t --- old/DBD-CSV-0.38/t/48_utf8.t 2010-08-06 13:42:21.000000000 +0200 +++ new/DBD-CSV-0.40/t/48_utf8.t 2013-06-11 14:46:49.000000000 +0200 @@ -43,7 +43,9 @@ ok ($sth->execute, "execute"); foreach my $i (1 .. scalar @data) { ok ($row = $sth->fetch, "fetch $i"); - is_deeply ($row, [ $i , encode ("utf8", $data[$i - 1]) ], "unencoded content $i"); + my $v = $data[$i - 1]; + utf8::is_utf8 ($v) or $v = encode ("utf8", $v); + is_deeply ($row, [ $i , $v ], "unencoded content $i"); } ok ($sth->finish, "finish"); undef $sth; @@ -57,7 +59,9 @@ ok ($sth->execute, "execute"); foreach my $i (1 .. scalar @data) { ok ($row = $sth->fetch, "fetch $i"); - is_deeply ($row, [ $i , $data[$i - 1] ], "encoded content $i"); + my $v = $data[$i - 1]; + ok (utf8::is_utf8 ($v), "is encoded"); + is_deeply ($row, [ $i , $v ], "encoded content $i"); } ok ($sth->finish, "finish"); undef $sth; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/55_dir_search.t new/DBD-CSV-0.40/t/55_dir_search.t --- old/DBD-CSV-0.38/t/55_dir_search.t 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.40/t/55_dir_search.t 2013-07-23 08:26:47.000000000 +0200 @@ -0,0 +1,70 @@ +#!/pro/bin/perl + +use strict; +use warnings; + +use Cwd; +use Test::More; + +my $pwd = getcwd; + +BEGIN { use_ok ("DBI") } +require "t/lib.pl"; + +my $root_temp = $^O eq "MSWin32" ? "C:/Temp" : "/tmp"; +my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { + f_schema => undef, + f_dir => DbDir (), + f_dir_search => [ "t", $root_temp ], + f_ext => ".csv/r", + f_lock => 2, + f_encoding => "utf8", + + RaiseError => 1, + PrintError => 1, + FetchHashKeyName => "NAME_lc", + }) or die "$DBI::errstr\n"; + +my @dsn = $dbh->data_sources; +my %dir = map { + m{^dbi:CSV:.*\bf_dir=([^;]+)}i; + my $folder = $1; + # Unixify Windows paths + $folder =~ s{^([A-Z])\\?:}{$1:}; + $folder =~ s{\\+}{/}g; + ($folder => 1); + } @dsn; + +# Use $test_dir +$dbh->do ("create table foo (c_foo integer, foo char (1))"); +$dbh->do ("insert into foo values ($_, $_)") for 1, 2, 3; + +my @test_dirs = ($pwd."/output", "t"); +$^O eq "VMS" or push @test_dirs, $root_temp; +is ($dir{$_}, 1, "DSN for $_") for @test_dirs; + +my %tbl = map { $_ => 1 } $dbh->tables (undef, undef, undef, undef); + +is ($tbl{$_}, 1, "Table $_ found") for qw( tmp foo ); + +my %data = ( + tmp => { # t/tmp.csv + 1 => "ape", + 2 => "monkey", + 3 => "gorilla", + }, + foo => { # output/foo.csv + 1 => 1, + 2 => 2, + 3 => 3, + }, + ); +foreach my $tbl ("tmp", "foo") { + my $sth = $dbh->prepare ("select * from $tbl"); + $sth->execute; + while (my $row = $sth->fetch) { + is ($row->[1], $data{$tbl}{$row->[0]}, "$tbl ($row->[0], ...)"); + } + } + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/60_misc.t new/DBD-CSV-0.40/t/60_misc.t --- old/DBD-CSV-0.38/t/60_misc.t 2010-08-06 13:42:29.000000000 +0200 +++ new/DBD-CSV-0.40/t/60_misc.t 2013-06-19 07:46:43.000000000 +0200 @@ -31,7 +31,7 @@ eval { is ($sth->fetch, undef, "fetch w/o execute"); }; is (scalar @warn, 1, "one error"); like ($warn[0], - qr/fetch row without a preceeding execute/, "error message"); + qr/fetch row without a precee?ding execute/, "error message"); } ok ($sth->execute, "execute"); is ($sth->fetch, undef, "fetch no rows"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/61_meta.t new/DBD-CSV-0.40/t/61_meta.t --- old/DBD-CSV-0.38/t/61_meta.t 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.40/t/61_meta.t 2013-07-23 08:45:45.000000000 +0200 @@ -0,0 +1,131 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use version; + +use Test::More; +use DBI qw(:sql_types); +use Cwd qw(getcwd abs_path); +do "t/lib.pl"; + +my $pwd = getcwd; +my $cnt = join "" => <DATA>; +my $tbl; + +my $expect = [ + [ 1, "Knut", "white" ], + [ 2, "Inge", "black" ], + [ 3, "Beowulf", "CCEE00" ], + ]; + +SKIP: { + open my $data, "<", \$cnt; + my $dbh = Connect (); + ok ($tbl = FindNewTable ($dbh), "find new test table"); + + skip "memory i/o currently unsupported by DBD::File", 1; + + $dbh->{csv_tables}->{data} = { + f_file => $data, + skip_rows => 4, + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - mem-io w/o col_names"); + } + +SKIP: { + open my $data, "<", \$cnt; + my $dbh = Connect (); + + skip "memory i/o currently unsupported by DBD::File", 1; + + $dbh->{csv_tables}->{data} = { + f_file => $data, + skip_rows => 4, + col_names => [qw(id name color)], + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - mem-io w col_names"); + } + +# abs_path () fails under MSWin32 for non-existing files! +my $fn = DbFile ($tbl); + $fn = $^O eq "MSWin32" + ? File::Spec->catdir ($pwd, $fn) + : abs_path ($fn); +open my $fh, ">", $fn or die "Can't open $fn for writing: $!"; +print $fh $cnt; +close $fh; + +END { defined $fn and unlink $fn; } + +{ open my $data, "<", $fn; + my $dbh = Connect (); + $dbh->{csv_tables}->{data} = { + f_file => $data, + skip_rows => 4, + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - file-handle w/o col_names"); + is_deeply ($sth->{NAME_lc}, [qw(id name color)], + "column names - file-handle w/o col_names"); + } + +{ open my $data, "<", $fn; + my $dbh = Connect (); + $dbh->{csv_tables}->{data} = { + f_file => $data, + skip_rows => 4, + col_names => [qw(foo bar baz)], + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - file-handle w col_names"); + is_deeply ($sth->{NAME_lc}, [qw(foo bar baz)], "column names - file-handle w col_names"); + } + +{ my $dbh = Connect (); + $dbh->{csv_tables}->{data} = { + f_file => $fn, + skip_rows => 4, + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - file-name w/o col_names"); + is_deeply ($sth->{NAME_lc}, [qw(id name color)], + "column names - file-name w/o col_names"); + } + +{ my $dbh = Connect ({ RaiseError => 1 }); + $dbh->{csv_tables}->{data} = { + f_file => $fn, + skip_rows => 4, + col_names => [qw(foo bar baz)], + }; + my $sth = $dbh->prepare ("SELECT * FROM data"); + $sth->execute (); + my $rows = $sth->fetchall_arrayref (); + is_deeply ($rows, $expect, "all rows found - file-name w col_names" ); + is_deeply ($sth->{NAME_lc}, [qw(foo bar baz)], + "column names - file-name w col_names" ); + } + +done_testing(); + +__END__ +id,name,color +stupid content +only for skipping +followed by column names +1,Knut,white +2,Inge,black +3,Beowulf,"CCEE00" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/80_rt.t new/DBD-CSV-0.40/t/80_rt.t --- old/DBD-CSV-0.38/t/80_rt.t 2012-10-11 09:18:31.000000000 +0200 +++ new/DBD-CSV-0.40/t/80_rt.t 2013-06-19 07:46:27.000000000 +0200 @@ -75,7 +75,7 @@ like ($dbh->errstr, qr{Error 2034 while reading}, "error message"); is (my $row = $sth->fetch, undef, "fetch"); like ($dbh->errstr, - qr{fetch row without a preceeding execute}, "error message"); + qr{fetch row without a precee?ding execute}, "error message"); }; ok ($sth->finish, "finish"); ok ($dbh->do ("drop table rt$rt"), "drop table"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.38/t/tmp.csv new/DBD-CSV-0.40/t/tmp.csv --- old/DBD-CSV-0.38/t/tmp.csv 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.40/t/tmp.csv 2013-06-11 15:51:47.000000000 +0200 @@ -0,0 +1,4 @@ +c_tmp,tmp +1,ape +2,monkey +3,gorilla -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
