Re: semi-panic? WTF

"H.Merijn Brand" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
On Tue, 11 Aug 2009 09:23:32 +0200, "H.Merijn Brand"
<[email protected]> wrote:

> $DBI_DSN = "dbi:CSV:f_dir=.;f_ext=.csv/r;f_schema=undef"
> 
> select    PROVINCIE_VEST, count (*)
> from      cfischolen
> group by  PROVINCIE_VEST
> semi-panic: attempt to dup freed string at /pro/lib/perl5/site_perl/5.10.0/i686-linux-64int/DBD/File.pm line 629.
> Segmentation fault

I think it is indirectly caused by SQL::Statement:

--8<--- foo.pl
#!/pro/bin/perl

use strict;
use warnings;

use Data::Peek;
use DBI;

open my $fh, ">", "foo.csv";
print $fh "c_foo,foo,bar\n";
for (1 .. 40000) {
    print $fh join ",", $_, ("a".."f")[int rand 6], int rand 10, "\n";
    }
close $fh;

my $dbh = DBI->connect ("dbi:CSV:", undef, undef, {
    f_dir	=> ".",
    f_ext	=> ".csv/r",
    f_schema	=> "undef",

    RaiseError	=> 1,
    PrintError	=> 1,
    });

my ($foo, $cnt);
my $sth = $dbh->prepare (qq;
    select   foo, count (*)
    from     foo
    group by foo;);
$sth->execute;
DDumper $sth->{NAME_lc};
-->8---

$VAR1 = [
    'foo',
    '*',
    undef,
    undef
    ];

That returns me *4* fields, but it should be *2*

If I bind 4 variables like
--8<---
my ($foo, $cnt, $x1, $x2);
my $sth = $dbh->prepare (qq;
    select   foo, count (*)
    from     foo
    group by foo;);
$sth->execute;
DDumper $sth->{NAME_lc};
$sth->bind_columns (\$foo, \$cnt, \$x1, \$x2);
while ($sth->fetch) {
    printf "%-5s %6d %20s %20s\n", $foo, $cnt, $x1, $x2;
    }
-->8---

$VAR1 = [
    'foo',
    '*',
    undef,
    undef
    ];
a       6592                    a                    a
d       6669                    d                    d
f       6572                    f                    f
b       6807                    b                    b
c       6730                    c                    c
e       6630                    e                    e


-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.