I am using OCIAttrGet() to obtain the type of query in my prepared statement/query handle, but it always seems to return 0 (I am doing this so I can modify how I call OCIStmtExecute(), in particular how I use the iters argument).
So, I am executing the code below (Note: the Q_ and E_ is just #define shorthand to handles/properties buried deep in memory structures). I am also doing full error checking in the real code and the statement prepare is successful.
However, this is always returning 0 regardless of the statement.
It occured to me that this may be because the statement has not actually been parsed yet, as this happens during the OCIStmtExecute(), however if this is the case, as I need to know the type of statement to work out how to call OCIStmtExecute() I am in a bit of a catch 22 situation.
Any ideas/suggestions welcome, and if Im doing something wrong, please tell me.
I just had the same issue. However the attribute OCI_ATTR_STMT_TYPE is available right after OCIStmtPrepare and can be used to crudely determine the type of statement. Typical problem is to figure out how many iterations to set up for the OCIStmtExecute call; it can be determined from the OCI_ATTR_STMT_TYPE attribute.