Is it ever legal (should be supported) to issue a non select in selectall_arrayref?

Obviously I think not but I'd like to know what other people think. I'm getting a few rts from the same person who I believe is moving existing code from DBD::Sybase to DBD::ODBC. The recent one is that he is doing:

$h->selectall_arrayref(q/create table #foo (fooint int)/);

and it currently fails with:

DBD::ODBC::db selectall_arrayref failed: Unable to fetch information about the error at rt68720.pl line 11.

However, in DBD::ODBC some versions ago this completed without error. The reason was DBD::ODBC does:

   if ( !DBIc_ACTIVE(imp_sth) ) {
      dbd_error(sth, SQL_ERROR, "no select statement currently executing");
      return Nullav;
   }

in dbd_st_fetch. In an older version DBD::ODBC's dbd_error function would attempt to get an error from the driver and if no error was available it did nothing. I changed dbd_error a while ago to report it had been called (because DBD::ODBC thought there was an error) but cannot retrieve the error. Obviously, this now means if there is not an ODBC error (as in this case) but you call dbd_error it reports it cannot retrieve an error. Obviously, the above call to dbd_error is wrong and should be a direct call to DBI's set_err but this will mean this persons code won't run. Before I do that I'd like to be sure DBI/DBD should not support non-select statements in selectall_*.

Martin

Reply via email to