Id agree, but as I outlined, there are 2 probs that make it non-trivial:For DBI, if the driver does not provide an attribute until after $sth->execute() then the error should indicate this, for example
NAME attribute not available with this driver until you execute()
rather than 'unrecognised attribute'.
which of these 2 is it ?
DBI.xs:1377: char *msg = "Can't set %s->{%s}: unrecognised attribute or invalid value%s";
DBI.xs:1664: croak("Can't get %s->{%s}: unrecognised attribute",neatsvpv(h,0),key);
The latter.
Ill presume you considered wrapping the $sth->{NAME} in an eval,
and executing if you get that specific error.
Yes, I didn't mean that this change would make DBI more powerful or let programs be written more concisely, only that it would make the error more obvious to a beginner.
1. modification of the SQL after prepare() and ->{NAME} failure,
so that it doesnt do anything when used as a probe.2. cloning to a related_sth, where modified SQL is submitted (so that you dont have to restore original SQL to old handle b4 execute) and copying back the right attrs
The 2nd item sounds related to some of the DBI-2 issues, particularly
On Mon, Jan 12, 2004 at 04:59:38PM +0100, H.Merijn Brand wrote:
>
> > B. What changes you'd like to see in the DBD API > > (that's the DBI<->DBD interface).
> > � All dbh handel offspring (statement handles and such)
> available from the top level handle, for both status
> and cleanup purposes
