DBD::Sybase and $sth->{syb_result_type} v. DBD::ODBC (Sql Server)
- From: Rob@xxxxxxxxxxxxxxxxxxxxxx (Rob Biedenharn)
- Date: Wed, 24 May 2006 15:36:10 -0400
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
Rob@xxxxxxxxxxxxxxxxxxxxxx
+1 513-295-4739
- Prev by Date: Re: (Fwd) Just a quick question on the DBI perl mod
- Next by Date: Re: how to invoke .sql file from dbi
- Previous by thread: slides of "Making DBI/DBD scripts portable"
- Next by thread: Help needed
- Index(es):
Relevant Pages
|
|