develooper Front page | perl.dbi.dev | Postings from June 2011

Re: Is it ever legal (should be supported) to issue a non select inselectall_arrayref?

Thread Previous | Thread Next
From:
Tim Bunce
Date:
June 29, 2011 02:20
Subject:
Re: Is it ever legal (should be supported) to issue a non select inselectall_arrayref?
Message ID:
20110629092035.GJ1518@timac.local
On Wed, Jun 29, 2011 at 09:02:27AM +0100, Martin J. Evans wrote:
> On 24/06/11 16:17, David Nicol wrote:
> 
> perl -le 'use DBI; my $h = DBI->connect(); my $s = $h->prepare("create table fred (a int)"); $s->execute; my $r = $s->fetch;'
> DBD::ODBC::st fetch failed: no select statement currently executing (SQL-HY000) at -e line 1.
> 
> Does this mean DBD::ODBC has a bug?
> 
> If so, and as I said before, I don't think DBD::ODBC knows the difference between a fetch called as part of selectall_* or a fetch called directly and the only way out would be to report no errors in fetch at all if the statement is not active.
> 
> AV *dbd_st_fetch(SV *sth, imp_sth_t *imp_sth)
> {

>     /* Check that execute() was executed sucessfully. This also implies	*/
>     /* that dbd_describe() executed sucessfuly so the memory buffers	*/
>     /* are allocated and bound.						*/
>     if ( !DBIc_ACTIVE(imp_sth) ) {
>         dbd_error(sth, DBDODBC_INTERNAL_ERROR, "no select statement currently executing");
>         return Nullav;
>     }

Perhaps a reasonable approach would be to downgrade that to a warning.

    set_err_char(SvRV(DBIc_MY_H(imp_sth)), (imp_xxh_t*)imp_sth,
        "0", 0, "no select statement currently executing", "", "fetch");

Tim.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About