As it's been a couple weeks and I don't think that I've seen any
response to this, I'd like to either refresh the question or ask if
there's someone who could at least say "Sorry, no way to do that with
DBD::ODBC."
The use of the Sybase-specific attributes is either telling me that
ODBC has to have the same kind of thing, or DBI just can't give you
this information generally.
-Rob
On May 24, 2006, at 3:36 PM, Rob Biedenharn wrote:
I hope someone has run into the specific problem or at least knows
how DBD::ODBC holds the status of a stored procedure. The
particular database is Microsoft Sql Server.
With Sybase and DBD::Sybase, the status from a stored procedure was
returned as a result of type CS_STATUS_RESULT() (i.e., 4043 from
the perldoc)
You can get the type of the current result set with
$sth->{syb_result_type}. This returns a numerical value, as
defined in
$SYBASE/include/cspublic.h:
#define CS_ROW_RESULT (CS_INT)4040
#define CS_CURSOR_RESULT (CS_INT)4041
#define CS_PARAM_RESULT (CS_INT)4042
#define CS_STATUS_RESULT (CS_INT)4043
#define CS_MSG_RESULT (CS_INT)4044
#define CS_COMPUTE_RESULT (CS_INT)4045
In particular, the return status of a stored procedure is
returned as
CS_STATUS_RESULT (4043), and is normally the last result set
that is
returned in a stored proc execution.
The docs for DBD::ODBC don't seem to deal with stored procedures at
all. There's something that might be a hint under
odbc_force_rebind, but only in that a procedure might produce
multiple result sets and you "shouldn't have to worry about this."
I'm thinking that a generic DBI way of obtaining this information
would have been mentioned in the DBD::Sybase documentation rather
than the syb_result_type. However, I'm holding out hope for a way
to determine this information.
If you made it this far and are thinking "Too bad he didn't ask
about OUTPUT parameters", I'll throw that one out too: How do I
get the OUTPUT parameters from a stored procedure via ODBC to Sql
Server? (Under DBD::Sybase, I'd see $sth->{syb_result_type} ==
CS_PARAM_RESULT (), but no such luck with Sql Server, yet.)
-Rob
Rob Biedenharn http://agileconsultingllc.com
[EMAIL PROTECTED]
+1 513-295-4739