On 7/10/07, Alexander Foken <[EMAIL PROTECTED]> wrote:
Great, exactly what I needed. I did not see the wood for the trees .... ;-)
Remember that procedures might return values, and might therefore be confused with SELECT statements (eg Informix with EXECUTE PROCEDURE - sometimes; sometimes Informix procedures don't return values). There again, maybe that wouldn't matter to you. And some SELECT statements start with WITH these days (DB2, ISO SQL). On 09.07.2007 10:29, Martin Evans wrote:
> Alexander Foken wrote: >> is there a smart way to detect if a prepared statement is a SELECT or >> a non-SELECT statement? > > Examine NUM_OF_FIELDS on the statement which will be 0 for non-select > statements. > > From DBI: > > Statements that don't return rows of data, like "DELETE" and > "CREATE" set "NUM_OF_FIELDS" to 0 (though it may be undef in some > drivers).
-- Jonathan Leffler <[EMAIL PROTECTED]> #include <disclaimer.h> Guardian of DBD::Informix - v2007.0226 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."