Hello community, here is the log from the commit of package perl-DBD-CSV for openSUSE:Factory checked in at 2020-07-28 17:28:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-DBD-CSV (Old) and /work/SRC/openSUSE:Factory/.perl-DBD-CSV.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-DBD-CSV" Tue Jul 28 17:28:56 2020 rev:35 rq:823157 version:0.55 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-DBD-CSV/perl-DBD-CSV.changes 2018-11-12 09:41:04.213219474 +0100 +++ /work/SRC/openSUSE:Factory/.perl-DBD-CSV.new.3592/perl-DBD-CSV.changes 2020-07-28 17:29:40.642200113 +0200 @@ -1,0 +2,6 @@ +Tue Jul 28 09:35:58 UTC 2020 - Tina Müller <[email protected]> + +- updated to 0.55 + see /usr/share/doc/packages/perl-DBD-CSV/ChangeLog + +------------------------------------------------------------------- Old: ---- DBD-CSV-0.54.tgz New: ---- DBD-CSV-0.55.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-DBD-CSV.spec ++++++ --- /var/tmp/diff_new_pack.O8j3Zt/_old 2020-07-28 17:29:41.658201265 +0200 +++ /var/tmp/diff_new_pack.O8j3Zt/_new 2020-07-28 17:29:41.658201265 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-DBD-CSV # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,13 @@ Name: perl-DBD-CSV -Version: 0.54 +Version: 0.55 Release: 0 %define cpan_name DBD-CSV Summary: DBI driver for CSV files License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl -Url: http://search.cpan.org/dist/DBD-CSV/ +URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/H/HM/HMBRAND/%{cpan_name}-%{version}.tgz Source1: cpanspec.yml BuildArch: noarch @@ -41,10 +41,10 @@ Requires: perl(Test::More) >= 0.9 Requires: perl(Text::CSV_XS) >= 1.01 Recommends: perl(DBD::File) >= 0.44 -Recommends: perl(DBI) >= 1.641 +Recommends: perl(DBI) >= 1.643 Recommends: perl(SQL::Statement) >= 1.412 -Recommends: perl(Test::More) >= 1.302136 -Recommends: perl(Text::CSV_XS) >= 1.35 +Recommends: perl(Test::More) >= 1.302175 +Recommends: perl(Text::CSV_XS) >= 1.44 %{perl_requires} %description @@ -59,14 +59,14 @@ %prep %setup -q -n %{cpan_name}-%{version} -find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644 +find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor -%{__make} %{?_smp_mflags} +perl Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} %check -%{__make} test +make test %install %perl_make_install ++++++ DBD-CSV-0.54.tgz -> DBD-CSV-0.55.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/CONTRIBUTING.md new/DBD-CSV-0.55/CONTRIBUTING.md --- old/DBD-CSV-0.54/CONTRIBUTING.md 2015-08-07 13:18:06.000000000 +0200 +++ new/DBD-CSV-0.55/CONTRIBUTING.md 2019-08-29 08:48:00.000000000 +0200 @@ -21,6 +21,14 @@ [.perltidy](https://github.com/Tux/Release-Checklist/blob/master/.perltidyrc) and [.perlcritic](https://github.com/Tux/Release-Checklist/blob/master/.perlcriticrc). +# Mail + +Please, please, please, do *NOT* use HTML mail. +[Plain text](https://useplaintext.email) +[without](http://www.goldmark.org/jeff/stupid-disclaimers/) +[disclaimers](https://www.economist.com/business/2011/04/07/spare-us-the-e-mail-yada-yada) +will do fine! + # Requirements The minimum version required to use this module is stated in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/ChangeLog new/DBD-CSV-0.55/ChangeLog --- old/DBD-CSV-0.54/ChangeLog 2018-10-29 12:19:26.000000000 +0100 +++ new/DBD-CSV-0.55/ChangeLog 2020-07-27 14:48:39.000000000 +0200 @@ -1,5 +1,10 @@ -0.54 - 2018-10-29, H.Merijn Brand +0.55 - 2020-07-27, H.Merijn Brand * Free unref scalar test fixed in Text::CSV_XS 1.35 + * It's 2019 + * Provide cpanfile + * Doc enhancements + * It's 2020 + * Make csv_ & f_ aliasses more consistently available (issue #7) 0.53 - 2018-05-20, H.Merijn Brand * No folder scanning during automated tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/MANIFEST new/DBD-CSV-0.55/MANIFEST --- old/DBD-CSV-0.54/MANIFEST 2018-10-29 12:23:31.000000000 +0100 +++ new/DBD-CSV-0.55/MANIFEST 2020-07-27 15:15:31.000000000 +0200 @@ -2,11 +2,14 @@ MANIFEST Makefile.PL CONTRIBUTING.md +cpanfile README lib/Bundle/DBD/CSV.pm lib/DBD/CSV.pm lib/DBD/CSV/TypeInfo.pm lib/DBD/CSV/GetInfo.pm +files/fruit.csv +files/tools.csv t/10_base.t t/11_dsnlist.t t/20_createdrop.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/META.json new/DBD-CSV-0.55/META.json --- old/DBD-CSV-0.54/META.json 2018-10-29 12:23:31.000000000 +0100 +++ new/DBD-CSV-0.55/META.json 2020-07-27 15:15:31.000000000 +0200 @@ -1,78 +1,78 @@ { + "x_installdirs" : "site", + "author" : [ + "Jochen Wiedmann", + "Jeff Zucker", + "H.Merijn Brand <[email protected]>", + "Jens Rehsack <[email protected]>" + ], + "generated_by" : "Author", "provides" : { "DBD::CSV" : { - "version" : "0.54", + "version" : "0.55", "file" : "lib/DBD/CSV.pm" - } - }, + } + }, "abstract" : "DBI driver for CSV files", - "license" : [ - "perl_5" - ], + "dynamic_config" : 1, + "release_status" : "stable", + "version" : "0.55", + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, "prereqs" : { + "configure" : { + "requires" : { + "DBI" : "1.628", + "ExtUtils::MakeMaker" : "0" + } + }, + "build" : { + "requires" : { + "Config" : "0" + } + }, "test" : { "requires" : { "Test::More" : "0.90", - "Test::Harness" : "0", - "Encode" : "0", "Cwd" : "0", - "charnames" : "0" - }, + "Test::Harness" : "0", + "charnames" : "0", + "Encode" : "0" + }, "recommends" : { - "Test::More" : "1.302140" - } - }, - "configure" : { - "requires" : { - "ExtUtils::MakeMaker" : "0", - "DBI" : "1.628" - } - }, + "Test::More" : "1.302175" + } + }, "runtime" : { "requires" : { "perl" : "5.008001", + "SQL::Statement" : "1.405", "DBD::File" : "0.42", "Text::CSV_XS" : "1.01", - "DBI" : "1.628", - "SQL::Statement" : "1.405" - }, + "DBI" : "1.628" + }, "recommends" : { - "Text::CSV_XS" : "1.37", - "DBI" : "1.641", + "DBD::File" : "0.44", "SQL::Statement" : "1.412", - "DBD::File" : "0.44" + "DBI" : "1.643", + "Text::CSV_XS" : "1.44" + } } }, - "build" : { - "requires" : { - "Config" : "0" - } - } - }, - "author" : [ - "Jochen Wiedmann", - "Jeff Zucker", - "H.Merijn Brand <[email protected]>", - "Jens Rehsack <[email protected]>" - ], "name" : "DBD-CSV", - "dynamic_config" : 1, - "meta-spec" : { - "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : 2 - }, - "generated_by" : "Author", - "version" : "0.54", + "license" : [ + "perl_5" + ], "resources" : { "repository" : { "web" : "https://github.com/perl5-dbi/DBD-CSV.git", "url" : "https://github.com/perl5-dbi/DBD-CSV.git", "type" : "git" - }, + }, "license" : [ "http://dev.perl.org/licenses/" - ] - }, - "release_status" : "stable", - "x_installdirs" : "site" -} + ] + } + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/META.yml new/DBD-CSV-0.55/META.yml --- old/DBD-CSV-0.54/META.yml 2018-10-29 12:23:31.000000000 +0100 +++ new/DBD-CSV-0.55/META.yml 2020-07-27 15:15:31.000000000 +0200 @@ -20,13 +20,13 @@ provides: DBD::CSV: file: lib/DBD/CSV.pm - version: '0.54' + version: '0.55' recommends: DBD::File: '0.44' - DBI: '1.641' + DBI: '1.643' SQL::Statement: '1.412' - Test::More: '1.302140' - Text::CSV_XS: '1.37' + Test::More: '1.302175' + Text::CSV_XS: '1.44' requires: Cwd: 0 DBD::File: '0.42' @@ -41,5 +41,5 @@ resources: license: http://dev.perl.org/licenses/ repository: https://github.com/perl5-dbi/DBD-CSV.git -version: '0.54' +version: '0.55' x_installdirs: site diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/Makefile.PL new/DBD-CSV-0.55/Makefile.PL --- old/DBD-CSV-0.54/Makefile.PL 2018-04-05 08:37:58.000000000 +0200 +++ new/DBD-CSV-0.55/Makefile.PL 2020-07-24 11:52:50.000000000 +0200 @@ -1,6 +1,6 @@ # -*- perl -*- -# Copyright (c) 2009-2018 H.Merijn Brand +# Copyright (c) 2009-2020 H.Merijn Brand require 5.008001; @@ -161,5 +161,15 @@ ' -@cpants_lint.pl $(DISTVNAME).tgz', ' -@rm -f Debian_CPANTS.txt', '', + 'doc docs: doc/DBD-CSV.md doc/DBD-CSV.html doc/DBD-CSV.man', + ' -@rm -f pod2html.tmp', + 'doc/DBD-CSV.md: lib/DBD/CSV.pm', + ' pod2markdown < $? > $@', + 'doc/DBD-CSV.html: lib/DBD/CSV.pm', + ' pod2html < $? 2>&1 | grep -v "^Cannot find" > $@', + 'doc/DBD-CSV.3: lib/DBD/CSV.pm', + ' pod2man < $? > $@', + 'doc/DBD-CSV.man: doc/DBD-CSV.3', + ' nroff -mandoc < $? > $@', $min_vsn; } # postamble diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/README new/DBD-CSV-0.55/README --- old/DBD-CSV-0.54/README 2018-01-01 14:15:34.000000000 +0100 +++ new/DBD-CSV-0.55/README 2020-07-09 13:41:56.000000000 +0200 @@ -9,7 +9,7 @@ values). Copying - Copyright (C) 2009-2018 by H.Merijn Brand + Copyright (C) 2009-2020 by H.Merijn Brand Copyright (C) 2004-2009 by Jeff Zucker Copyright (C) 1998-2004 by Jochen Wiedmann diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/cpanfile new/DBD-CSV-0.55/cpanfile --- old/DBD-CSV-0.54/cpanfile 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.55/cpanfile 2020-07-27 15:15:31.000000000 +0200 @@ -0,0 +1,28 @@ +requires "DBD::File" => "0.42"; +requires "DBI" => "1.628"; +requires "SQL::Statement" => "1.405"; +requires "Text::CSV_XS" => "1.01"; + +recommends "DBD::File" => "0.44"; +recommends "DBI" => "1.643"; +recommends "SQL::Statement" => "1.412"; +recommends "Text::CSV_XS" => "1.44"; + +on "configure" => sub { + requires "DBI" => "1.628"; + requires "ExtUtils::MakeMaker"; + }; + +on "build" => sub { + requires "Config"; + }; + +on "test" => sub { + requires "Cwd"; + requires "Encode"; + requires "Test::Harness"; + requires "Test::More" => "0.90"; + requires "charnames"; + + recommends "Test::More" => "1.302175"; + }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/files/fruit.csv new/DBD-CSV-0.55/files/fruit.csv --- old/DBD-CSV-0.54/files/fruit.csv 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.55/files/fruit.csv 2020-07-24 15:51:08.000000000 +0200 @@ -0,0 +1,5 @@ +c_fruit,fruit +1,Apple +2,Blueberry +3,Orange +4,Melon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/files/tools.csv new/DBD-CSV-0.55/files/tools.csv --- old/DBD-CSV-0.54/files/tools.csv 1970-01-01 01:00:00.000000000 +0100 +++ new/DBD-CSV-0.55/files/tools.csv 2020-07-24 15:52:22.000000000 +0200 @@ -0,0 +1,7 @@ +c_tool;tool +1;Hammer +2;Screwdriver +3;Drill +4;Saw +5;Router +6;Hobbyknife diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/lib/Bundle/DBD/CSV.pm new/DBD-CSV-0.55/lib/Bundle/DBD/CSV.pm --- old/DBD-CSV-0.54/lib/Bundle/DBD/CSV.pm 2018-10-29 12:22:44.000000000 +0100 +++ new/DBD-CSV-0.55/lib/Bundle/DBD/CSV.pm 2020-07-27 14:59:17.000000000 +0200 @@ -21,15 +21,15 @@ =head1 CONTENTS -DBI 1.641 +DBI 1.643 -Text::CSV_XS 1.37 +Text::CSV_XS 1.44 SQL::Statement 1.412 DBD::File 0.44 -DBD::CSV 0.54 +DBD::CSV 0.55 =head1 DESCRIPTION @@ -44,7 +44,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2009-2018 by H.Merijn Brand +Copyright (C) 2009-2020 by H.Merijn Brand Copyright (C) 2004-2009 by Jeff Zucker Copyright (C) 1998-2004 by Jochen Wiedmann diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/lib/DBD/CSV.pm new/DBD-CSV-0.55/lib/DBD/CSV.pm --- old/DBD-CSV-0.54/lib/DBD/CSV.pm 2018-05-20 17:52:22.000000000 +0200 +++ new/DBD-CSV-0.55/lib/DBD/CSV.pm 2020-07-27 13:41:51.000000000 +0200 @@ -15,6 +15,14 @@ require DBD::File; require IO::File; +our @f_SHORT = qw( file dir dir_search ext lock lockfile schema encoding ); +our @c_SHORT = qw( class eof + eol sep_char quote_char escape_char binary decode_utf8 auto_diag + diag_verbose blank_is_undef empty_is_undef allow_whitespace + allow_loose_quotes allow_loose_escapes allow_unquoted_escape + always_quote quote_empty quote_space escape_null quote_binary + keep_meta_info callbacks ); + package DBD::CSV; use strict; @@ -23,7 +31,7 @@ @ISA = qw( DBD::File ); -$VERSION = "0.54"; +$VERSION = "0.55"; $ATTRIBUTION = "DBD::CSV $DBD::CSV::VERSION by H.Merijn Brand"; $err = 0; # holds error code for DBI::err @@ -68,6 +76,20 @@ sub connect { my ($drh, $dbname, $user, $auth, $attr) = @_; + if ($attr && ref $attr eq "HASH") { + # Top-level aliasses + foreach my $key (grep { exists $attr->{$_} } @f_SHORT) { + my $f_key = "f_$key"; + exists $attr->{$f_key} and next; + $attr->{$f_key} = delete $attr->{$key}; + } + foreach my $key (grep { exists $attr->{$_} } @c_SHORT) { + my $c_key = "csv_$key"; + exists $attr->{$c_key} and next; + $attr->{$c_key} = delete $attr->{$key}; + } + } + my $dbh = $drh->DBD::File::dr::connect ($dbname, $user, $auth, $attr); $dbh and $dbh->{Active} = 1; $dbh; @@ -94,32 +116,15 @@ my $dbh = shift; # Straight from Text::CSV_XS.pm - my @xs_attr = qw( - eol - sep_char - quote_char - escape_char - binary - decode_utf8 - auto_diag - diag_verbose - blank_is_undef - empty_is_undef - allow_whitespace - allow_loose_quotes - allow_loose_escapes - allow_unquoted_escape - always_quote - quote_empty - quote_space - escape_null - quote_binary - keep_meta_info - verbatim - types - callbacks - ); + my @xs_attr = @c_SHORT; @csv_xs_attr{@xs_attr} = (); + # Dynamically add "new" attributes - available in Text::CSV_XS-1.20 + if (my @ka = eval { Text::CSV_XS->known_attributes }) { + for (grep { m/^[a-su-z]/ && !exists $csv_xs_attr{$_} } @ka) { + push @xs_attr => $_; + $csv_xs_attr{$_} = undef; + } + }; $dbh->{csv_xs_valid_attrs} = [ @xs_attr ]; @@ -191,6 +196,31 @@ our @ISA = qw( DBD::File::Table ); +my %compat_map; + +{ my %class_mapped; + + sub _register_compat_map { + my $class = shift; + + my $x = 0; + if (!%compat_map) { + $compat_map{$_} = "f_$_" for @f_SHORT; + $compat_map{$_} = "csv_$_" for @c_SHORT; + $x++; + } + if ($class and !$class_mapped{$class}++ and + my @ka = eval { $class->known_attributes }) { + # exclude types + $compat_map{$_} = "csv_$_" for grep m/^[a-su-z]/ => @ka; + $x++; + } + if ($x) { + __PACKAGE__->register_compat_map (\%compat_map); + } + } # _register_compat_map + } + #sub DESTROY { # my $self = shift or return; # @@ -201,6 +231,9 @@ my ($self, $dbh, $meta, $table) = @_; $meta->{csv_class} ||= $dbh->{csv_class} || "Text::CSV_XS"; $meta->{csv_eol} ||= $dbh->{csv_eol} || "\r\n"; + + _register_compat_map ($meta->{csv_class}); + exists $meta->{csv_skip_first_row} or $meta->{csv_skip_first_row} = $dbh->{csv_skip_first_row}; exists $meta->{csv_bom} or @@ -211,6 +244,8 @@ sub init_table_meta { my ($self, $dbh, $meta, $table) = @_; + _register_compat_map ($meta->{csv_class}); + $self->SUPER::init_table_meta ($dbh, $table, $meta); my $csv_in = $meta->{csv_in} || $dbh->{csv_csv_in}; @@ -246,14 +281,11 @@ } } # init_table_meta -my %compat_map = map { $_ => "csv_$_" } - qw( class eof eol quote_char sep_char escape_char ); - -__PACKAGE__->register_compat_map (\%compat_map); - sub table_meta_attr_changed { my ($class, $meta, $attr, $value) = @_; + _register_compat_map ($meta->{csv_class}); + (my $csv_attr = $attr) =~ s/^csv_//; if (exists $csv_xs_attr{$csv_attr}) { for ("csv_in", "csv_out") { @@ -1007,7 +1039,7 @@ =item o -All valid attributes to the CSV parsing module. Any of the can optionally +All valid attributes to the CSV parsing module. Any of them can optionally be prefixed with C<csv_>. =item o @@ -1019,6 +1051,18 @@ If you pass it C<f_file> or its alias C<file>, C<f_ext> has no effect, but C<f_dir> and C<f_encoding> still have. + csv_tables => { + syspwd => { # Table name + csv_sep_char => ":", # Text::CSV_XS + quote_char => undef, # Text::CSV_XS + escape_char => undef, # Text::CSV_XS + f_dir => "/etc", # DBD::File + f_file => "passwd", # DBD::File + col_names => # DBD::File + [qw( login password uid gid realname directory shell )], + }, + }, + =item csv_* X<csv_*> @@ -1293,7 +1337,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 2009-2018 by H.Merijn Brand +Copyright (C) 2009-2020 by H.Merijn Brand Copyright (C) 2004-2009 by Jeff Zucker Copyright (C) 1998-2004 by Jochen Wiedmann diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/DBD-CSV-0.54/t/61_meta.t new/DBD-CSV-0.55/t/61_meta.t --- old/DBD-CSV-0.54/t/61_meta.t 2018-03-24 11:19:42.000000000 +0100 +++ new/DBD-CSV-0.55/t/61_meta.t 2020-07-27 14:47:45.000000000 +0200 @@ -124,6 +124,70 @@ unlink $fn; +note ("Attribute prefixes"); +$fn = "test.csv"; +foreach my $x (0, 1) { + my ($fpfx, $cpfx) = $x ? ("f_", "csv_") : ("", ""); + my $dbh = DBI->connect ("dbi:CSV:", undef, undef, { + "${fpfx}schema" => undef, # schema / f_schema + "${fpfx}dir" => "files", # .. f_dir + "${fpfx}ext" => ".csv/r", # .. f_ext + + "${cpfx}eol" => "\n", # eol / csv_eol + "${cpfx}always_quote" => 1, # .. csv_always_quote + "${cpfx}sep_char" => ";", # .. csv_sep_char + + RaiseError => 1, + PrintError => 1, + }) or die "$DBI::errstr\n" || $DBI::errstr; + + my $ffn = "files/$fn"; + unlink $ffn; + $dbh->{csv_tables}{tst} = { + "${fpfx}file" => $fn, # file / f_file + col_names => [qw( c_tst s_tst )], + }; + + is_deeply ( + [ sort $dbh->tables (undef, undef, undef, undef) ], + [qw( fruit tools )], "Tables"); + is_deeply ( + [ sort keys %{$dbh->{csv_tables}} ], + [qw( fruit tools tst )], "Mixed tables"); + + $dbh->{csv_tables}{fruit}{sep_char} = ","; # should work + + is_deeply ($dbh->selectall_arrayref ("select * from tools order by c_tool"), + [ [ 1, "Hammer" ], + [ 2, "Screwdriver" ], + [ 3, "Drill" ], + [ 4, "Saw" ], + [ 5, "Router" ], + [ 6, "Hobbyknife" ], + ], "Sorted tools"); + is_deeply ($dbh->selectall_arrayref ("select * from fruit order by c_fruit"), + [ [ 1, "Apple" ], + [ 2, "Blueberry" ], + [ 3, "Orange" ], + [ 4, "Melon" ], + ], "Sorted fruit"); + + # TODO: Ideally, insert should create the file if empty or non-existent + # and insert "c_tst";"s_tst" as header line + open my $fh, ">", $ffn; close $fh; + + $dbh->do ("insert into tst values (42, 'Test')"); # "42";"Test" + $dbh->do ("update tst set s_tst = 'Done' where c_tst = 42"); # "42";"Done" + + $dbh->disconnect; + + open $fh, "<", $ffn or die "$ffn: $!\n"; + my @dta = <$fh>; + close $fh; + is ($dta[-1], qq{"42";"Done"\n}, "Table tst written to $fn"); + unlink $ffn; + } + done_testing (); __END__
