Skip Menu |

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

Report information
The Basics
Id: 61467
Status: resolved
Priority: 0/
Queue: DBD-CSV

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.31
Fixed in: 0.31



Subject: same select second time returns no data
While helping on IRC with a problem I found a bug in DBD::CSV. Attached is simplified version of program that had this problem. Second time no rows are returned. -- Alexandr Ciornii, http://chorny.net
Subject: dbd_csv_bug.pl
#!/usr/bin/perl use warnings; use strict; use DBI; require DBD::CSV; my $csv_file = 'test_data.csv'; unless (-r $csv_file) { die "ERROR:\tCannot read $csv_file:$!\n"; } my $csv = init_csv($csv_file); my @courses = get_courses(); print @courses, "\n\n"; my @courses2 = get_courses(); print @courses2, "\n\n"; sub get_courses { my @names; my $sth = $csv->prepare("SELECT DISTINCT colnm from golfdata"); $sth->execute; while (my @row = $sth->fetchrow_array) { push(@names, $row[0]); } $sth->finish(); return @names; } sub init_csv { my $file = shift @_; my $dbh = DBI->connect("dbi:CSV:f_dir=.;csv_eol=\n;") or die "Cannot connect to CSV files: $DBI::errstr\n"; $dbh->{'csv_tables'}->{'golfdata'} = {'file' => $file}; # Give the CSV (used a table name) a friendly name $dbh->{RaiseError} = 1; return $dbh; }
Subject: test_data.csv
colnm bbb ccc
On Sun Sep 19 20:14:11 2010, CHORNY wrote: Show quoted text
> While helping on IRC with a problem I found a bug in DBD::CSV. > Attached is simplified version of program that had this problem. > > Second time no rows are returned. >
And by looking how RT displays this file, I found where problem is - csv_eol should be "\r". Strange that first SELECT returned correct data. -- Alexandr Ciornii, http://chorny.net
Subject: Re: [rt.cpan.org #61467] same select second time returns no data
Date: Thu, 7 Jul 2011 08:36:08 +0200
To: bug-DBD-CSV [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
On Sun, 19 Sep 2010 20:18:42 -0400, "Alexandr Ciornii via RT" <bug-DBD-CSV@rt.cpan.org> wrote: Show quoted text
> And by looking how RT displays this file, I found where problem is - > csv_eol should be "\r". Strange that first SELECT returned correct data.
Does this mean this ticket can be closed? -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00, 11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
On Thu Jul 07 02:36:19 2011, h.m.brand@xs4all.nl wrote: Show quoted text
> On Sun, 19 Sep 2010 20:18:42 -0400, "Alexandr Ciornii via RT" > <bug-DBD-CSV@rt.cpan.org> wrote: >
> > And by looking how RT displays this file, I found where problem is - > > csv_eol should be "\r". Strange that first SELECT returned correct data.
> > Does this mean this ticket can be closed? >
Of course. -- Alexandr Ciornii, http://chorny.net