PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Tim Bunce <Tim dot Bunce at pobox dot com>
Subject: Re: $sth->{NAME} doesn't work
Date: Jan 15 2004 10:42AM

On Thu, Jan 15, 2004 at 09:54:51AM -0000, Avis, Ed wrote:
> Tim Bunce wrote:
> 
> >>>DBI.xs:1664:        croak("Can't get %s->{%s}: unrecognised 
> >>>attribute",neatsvpv(h,0),key);
> 
> >It's a driver bug. The FETCH of the sth NAME attribute should never
> >reach the DBI's code. The driver should handle it.
> 
> So you're saying that $sth->{NAME} should always be handled by the
> driver, whether or not the column names are available, and that it is
> the driver's responsibility to print a message such as 'you should
> call execute() first' rather than leaving it to DBI to raise an error.

Mostly. The DBI doc says:

: Note that some drivers cannot provide valid values for some or all of
: these attributes until after C<$sth-Eexecute> has been called.

A statement handle should always have NAME, TYPE, NULLABLE etc
attributes.  It should never be an error to ask for them. But the
value returned may be undef, for example, if the statement has not been
executed, the execute failed, or it's not a select statement.

> In that case, this looks like a bug report for DBD::Sybase.  I imagine
> that the other statement attributes NUM_OF_FIELDS should behave in the
> same way.

Yes. I'll clarify the docs.

Tim.