SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Only prepare for describe if statement type is 'SELECT' for Oracle backend #1119

Open iqbal-hasprime opened 5 months ago

iqbal-hasprime commented 5 months ago

In my use-case I always call statement::exchange_for_rowset, even if the query for the statement does not return any result, since type of query used to create the statement is unknown beforehand.

OCIStmtExecute call with OCI_DESCRIBE_ONLY in oracle_statement_backend::prepare_for_describe will fail (with "ORA-24333: zero iteration count" error) for non-SELECT queries, since there's nothing to describe.

My proposed change to the library is to the call to OCIStmtExecute if the statement type is OCI_STMT_SELECT.

iqbal-hasprime commented 5 months ago

Oops, sorry, I spoke too soon and didn't notice that a test failed.

It looks like this change breaks some other uses of SOCI, so it can't be applied as is... Sorry for missing it originally.

No worries. I should have checked as well. I'll try and fix the failing tests.