Re: dbih_get_attr_k: assertion failed

Tim Bunce <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>
I've committed a change (r14444) that'll issue a warning instead of an
assertion failure. Can you try:

    svn co http://svn.perl.org/modules/dbi/trunk/ dbi-trunk
    cd dbi-trunk
    perl Makefile.PL
    make && make test && make install

Tim.

On Thu, Sep 23, 2010 at 10:23:49AM +0200, Mara wrote:
> On Wed, Sep 22, 2010 at 11:02 PM, Tim Bunce <[email protected]> wrote:
> > On Wed, Sep 22, 2010 at 04:56:31PM +0200, Mara wrote:
> >> Hi Tim,
> >>
> >> On Wed, Sep 22, 2010 at 11:24 AM, Tim Bunce <[email protected]> wrote:
> >> > On Tue, Sep 21, 2010 at 06:01:20AM -0700, Mara wrote:
> >> >>
> >> > I agree. It should be an error not an assertion.
> >> >
> >> > The relevant code is:
> >> >
> >> >    if (DBIc_TRACE_LEVEL(imp_sth) >= 10)
> >> >        PerlIO_printf(DBILOGFP,"       FETCH $h->{%s} from $h->{NAME} with $h->{NUM_OF_FIELDS} = %d"
> >> >                                " and %ld entries in $h->{NAME}\n",
> >> >                neatsvpv(keysv,0), i, AvFILL(name_av)+1);
> >> >    assert((i == -1 && 0 == AvFILL(name_av)+1) || (i == AvFILL(name_av)+1));
> >>
> >> Ok. Essentially I did
> >>
> >>    $sth->trace( 10, 'dbi_trace.log' );
> >>    $sth->execute() or die DBI::errstr;
> >>    my $hash_ref = $sth->fetchrow_hashref("NAME_lc");
> >>
> >> Then trace file reads
> >> --- snip ---
> >>     <- execute= ( 1 ) [1 items] at test_dbi.pl line 91
> >>     -> fetchrow_hashref in DBD::_::st for DBD::Oracle::st (DBI::st=HASH(0x19e8300)~0xcec630 'NAME_lc') thr#8ab010
> >>     >> FETCH       DISPATCH (DBI::st=HASH(0xcec630) rc2/1 @2 g2 ima404 pid#14833) at test_dbi.pl line 94
> >> 1   -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xcec630)~INNER 'NAME_lc') thr#8ab010
> >>     >> FETCH       DISPATCH (DBI::st=HASH(0xcec630) rc3/1 @2 g2 ima404 pid#14833) at test_dbi.pl line 94
> >> 2   -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xcec630)~INNER 'NAME') thr#8ab010
> >> 2   <- FETCH= ( [ ] ) [1 items] at test_dbi.pl line 94
> >> --- snip ---
> >
> > I don't see the message I'm looking for.
> > Did the assertion fail that time?
> 
> Yes, it did fail.
> 
> > If so, perhaps it didn't get flushed. Try using $sth->trace(10); to
> > write the log to stderr.
> 
> Tried that, but the output is still the same. I also tried a higher
> trace level, but to no avail. Complete output is:
> 
> --- snip ---
> ~> /usr/bin/env perl "test_dbi.pl" 20090110518 A0000000000
>     DBI::st=HASH(0xcec7c8) trace level set to 0x0/11 (DBI @ 0x0/0) in
> DBI 1.609-ithread (pid 19121)
>     -> execute for DBD::Oracle::st (DBI::st=HASH(0x19d0448)~0xcec7c8) thr#8ab010
>    dbd_st_execute UPDATE (out0, lob0)...
> Statement Execute Mode is 32 (COMMIT_ON_SUCCESS)
> 		in  ':a' [0,0]: len 11, ind 0, value='A0000...'
> 		in  ':b' [0,0]: len 11, ind 0, value='20090...'
> 	OCIStmtExecute(1b28538,1b35538,1b28618,1,0,0,0,mode=COMMIT_ON_SUCCESS,32)=SUCCESS
> 	OCIAttrGet(1b35538,OCI_HTYPE_STMT,7ffff25fb3d8,0,OCI_ATTR_ROW_COUNT,1b28618)=SUCCESS
> 	OCIAttrGet(1b35538,OCI_HTYPE_STMT,7ffff25fb3de,0,OCI_ATTR_SQLFNCODE,1b28618)=SUCCESS
> 	dbd_st_execute UPDATE returned (SUCCESS, rpc1, fn5, out0)
>     <- execute= ( 1 ) [1 items] at test_dbi.pl line 97
>     -> fetchrow_hashref in DBD::_::st for DBD::Oracle::st
> (DBI::st=HASH(0x19d0448)~0xcec7c8 'NAME_lc') thr#8ab010
>     >> FETCH       DISPATCH (DBI::st=HASH(0xcec7c8) rc2/1 @2 g2 ima404
> pid#19121) at test_dbi.pl line 100
> 1   -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xcec7c8)~INNER
> 'NAME_lc') thr#8ab010
>     >> FETCH       DISPATCH (DBI::st=HASH(0xcec7c8) rc3/1 @2 g2 ima404
> pid#19121) at test_dbi.pl line 100
> 2   -> FETCH for DBD::Oracle::st (DBI::st=HASH(0xcec7c8)~INNER 'NAME')
> thr#8ab010
> 2   <- FETCH= ( [ ] ) [1 items] at test_dbi.pl line 100
> perl: DBI.xs:2001: dbih_get_attr_k: Assertion `i == (((((const SV *)
> (name_av))->sv_flags & 0x00800000)) ? Perl_mg_size(my_perl, ((SV *)({
> void *_p = (name_av); _p; }))) : ((XPVAV*)
> (name_av)->sv_any)->xav_fill)+1' failed.
> --- snap ---
> 
> Sadly I know nothing about Perl's assertions. Would it help to eval{}
> the fetchrow to get a better error message?
> 
> Mara
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.