Skip Menu |

This queue is for tickets about the DBIx-CSV CPAN distribution.

Report information
The Basics
Id: 131101
Status: resolved
Priority: 0/
Queue: DBIx-CSV

People
Owner: Nobody in particular
Requestors: Stephen.Maeder [...] ingrammicro.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: selectall_csv_noheader() *includes* header row on Mac OS X 10.14.4
Date: Thu, 28 Nov 2019 16:42:45 +0000
To: "bug-DBIx-CSV [...] rt.cpan.org" <bug-DBIx-CSV [...] rt.cpan.org>
From: "Maeder, Stephen" <Stephen.Maeder [...] ingrammicro.com>
Hi, I discovered that selectall_csv_noheader() *includes* the header row on Mac OS X 10.14.4 - I am not sure if this is how it behaves on other platforms, too. In other words, the output of selectall_csv and selectall_csv_noheader are identical. Here's a script to reproduce it: #!/usr/bin/perl my $sdm_port = 3409; use DBI; my $dbh = DBI->connect("dbi:mysql:database=default:host=127.0.0.1:port=$sdm_port", "", "", {RaiseError => 1, AutoCommit => 0, FetchHashKeyName => "NAME_lc"}) || die "DB open error: $DBI::errstr"; use DBIx::CSV; my $query = "SELECT NOW() as 'The time is...';"; my $selectall_csv = $dbh->selectall_csv("$query"); my $selectall_csv_noheader = $dbh->selectall_csv_noheader("$query"); print "selectall_csv:\n$selectall_csv\n\n"; print "selectall_csv_noheader:\n$selectall_csv_noheader\n\n"; $dbh->disconnect(); __END__ Output of the above script for me: selectall_csv: "The time is..." "2019-11-28 08:39:47" selectall_csv_noheader: "The time is..." "2019-11-28 08:39:47" I am presently working around this with: my @lines= split(/\n/, $dbh->selectall_csv("$query")); # selectall_csv_noheader doesn't work on Mac OS apparently... shift @lines; # So I just remove the header row here open OUT, ">>$outputCSVfilename" or die $!; print OUT join "\n", @lines; close OUT; — Stephen Maeder Senior Product Manager, Shipwire Commerce & Lifecycle Services [cid46cacb9e-d337-4753-9c83-73216e02971a] If you do not wish to receive promotional materials from Ingram Micro via e-mail, please go to http://www.ingrammicro.com/emailmgmt or reply to this message and type unsubscribe in the subject. Ingram Micro Inc. Corporate Headquarters, 3351 Michelson Drive, Suite 100, Irvine, CA 92612 This email may contain material that is confidential, and proprietary to Ingram Micro, for the sole use of the intended recipient. Any review, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. [Ingram_2818e5de]
Download image001.png
image/png 5.6k
image001.png
It actually happens on all OS :) The reason is that I changed Text::Table::CSV to *not* observe header_row=>0 option, but I don't remember why I did this and didn't note it in the commit log or Changes entry either. I'm now adding back the observing of header_row=0. So all you need to do is update Text::Table::CSV to latest (0.023) as well as Text::Table::Any (0.096). Regards, perlancar
Subject: Re: [rt.cpan.org #131101] selectall_csv_noheader() *includes* header row on Mac OS X 10.14.4
Date: Fri, 29 Nov 2019 01:58:53 +0000
To: "bug-DBIx-CSV [...] rt.cpan.org" <bug-DBIx-CSV [...] rt.cpan.org>
From: "Maeder, Stephen" <Stephen.Maeder [...] ingrammicro.com>
Thanks so much, that resolved it! Script output is now: selectall_csv: "The time is..." "2019-11-28 17:58:14" selectall_csv_noheader: "2019-11-28 17:58:14" — Stephen Maeder Senior Product Manager, Shipwire Commerce & Lifecycle Services [cid46cacb9e-d337-4753-9c83-73216e02971a] From: Perl Ancar via RT <bug-DBIx-CSV@rt.cpan.org> Reply-To: "bug-DBIx-CSV@rt.cpan.org" <bug-DBIx-CSV@rt.cpan.org> Date: Thursday, November 28, 2019 at 5:23 PM To: "Maeder, Stephen" <Stephen.Maeder@ingrammicro.com> Subject: [rt.cpan.org #131101] selectall_csv_noheader() *includes* header row on Mac OS X 10.14.4 <URL: https://urldefense.proofpoint.com/v2/url?u=https-3A__rt.cpan.org_Ticket_Display.html-3Fid-3D131101&d=DwIDaQ&c=--1RjWWBW4Kf6aBAaj53vPItwfT0BR1YjSDV46P5EvE&r=5cMlGe2E1u9TMpot5b98mBkCyOsg4IaeufNk7ECPSwI&m=K9mSvKw7J8hVninG59nLdBaxb9Ip_XqqsyYA4aOAgzo&s=sGlaWLldx8m7YB8t28REJqNgMajVtY7HO021V1i_AZY&e= > It actually happens on all OS :) The reason is that I changed Text::Table::CSV to *not* observe header_row=>0 option, but I don't remember why I did this and didn't note it in the commit log or Changes entry either. I'm now adding back the observing of header_row=0. So all you need to do is update Text::Table::CSV to latest (0.023) as well as Text::Table::Any (0.096). Regards, perlancar If you do not wish to receive promotional materials from Ingram Micro via e-mail, please go to http://www.ingrammicro.com/emailmgmt or reply to this message and type unsubscribe in the subject. Ingram Micro Inc. Corporate Headquarters, 3351 Michelson Drive, Suite 100, Irvine, CA 92612 This email may contain material that is confidential, and proprietary to Ingram Micro, for the sole use of the intended recipient. Any review, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. [Ingram_2818e5de]
Download image001.png
image/png 5.6k
image001.png