DBD::Sybase and $sth->{syb_result_type} v. DBD::ODBC (Sql Server)



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




Relevant Pages

  • Re: How to get list of EventClasses in MSSQLServer2000
    ... statement inside a stored procedure has completed.') ... SQL Server statement or stored procedure.') ... Plan','Displays the plan tree of the Transact-SQL statement executed.') ... Login','Occurs when a SQL Server login is added or removed; ...
    (microsoft.public.sqlserver.security)
  • Re: Accessing FoxPro Free Table
    ... which the SQL Server service is running. ... account, ... > If you are creating a stored procedure and you want> to make sure that the procedure definition cannot be> viewed by other users, you can use the WITH ENCRYPTION> clause. ... The procedure definition is then stored in an> unreadable form. ...
    (microsoft.public.data.odbc)
  • Stored procedure does not complete until result set is retrieved from ODBC
    ... I have a SQL Server Stored procedure that I am executing via ODBC. ... -- Start Code without cursor ...
    (microsoft.public.sqlserver.odbc)
  • Re: Adding date to parameter
    ... SqlClient provider which is specifically written for SQL Server. ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... I made the assumption that the stored procedure went by the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Problem with the Legacy ASP files and the Sql Server Express
    ... table, if another inserting occurs at the nearly exactly the same moment, ... SQL Server will pass it a default value. ... assume that you do have a connection that can reach SQL Server Express. ... unless your stored procedure has some thing that only works ...
    (microsoft.public.dotnet.framework.aspnet)