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.

Reply via email to