Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Sybase DB Library C 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

  1                       Version 4.0 -- 5/1/89                dbnumrets
  ______________________________________________________________________

  NAME:  dbnumrets

  FUNCTION:
       Determine the number of return parameter values  generated  by  a
       stored procedure.

  SYNTAX:
       int dbnumrets(dbproc)

       DBPROCESS *dbproc;

  COMMENTS:







  dbnumrets               Version 4.0 -- 5/1/89                        2
  ______________________________________________________________________

       o dbnumrets() provides the  number  of  return  parameter  values
         returned  by  the  most recent EXECUTE statement or remote pro-
         cedure call on a stored procedure.
       o Transact-SQL stored procedures can return values for  specified
         "return  parameters."  Changes  made  to  the value of a return
         parameter inside the stored procedure are then available to the
         program  that  called  the procedure.  This is analogous to the
         "pass by reference"  facility  available  in  some  programming
         languages.

         For a parameter to function as a return parameter, it  must  be
         declared  as  such  within  the  stored procedure.  The EXECUTE
         statement or remote procedure call that calls the  stored  pro-
         cedure must also indicate that the parameter should function as
         a return parameter.  In the case of a remote procedure call, it
         is  the dbrpcparam() routine that specifies whether a parameter
         is a return parameter.


  3                       Version 4.0 -- 5/1/89                dbnumrets
  ______________________________________________________________________

       o When executing a  stored  procedure,  the  server  returns  any
         parameter values immediately after returning all other results.
         Therefore, the application can call dbnumrets() only after pro-
         cessing  the stored procedure's results by calling dbresults(),
         as well as dbnextrow() if appropriate.   (Note  that  a  stored
         procedure  can  generate  several  sets of results-one for each
         SELECT  it  contains.   Before   the   application   can   call
         dbnumrets()  or  any other routines that process return parame-
         ters, it must call dbresults() and dbnextrow() as many times as
         necessary to process all the results.)
       o If the stored procedure is  invoked  with  a  remote  procedure
         call,  the  return parameter values are automatically available
         to the application.  If, on the other  hand,  the  stored  pro-
         cedure is invoked with an EXECUTE statement, the return parame-
         ter values are available only if the command  batch  containing
         the  EXECUTE statement uses local variables, not constants, for



  dbnumrets               Version 4.0 -- 5/1/89                        4
  ______________________________________________________________________
         the return parameters.

       o Other  routines  return  additional  information  about  return
         parameter values:
          o dbretdata() returns a pointer to a parameter value.

          o dbretlen() returns the length of a parameter value.
          o dbretname() returns the name of a parameter value.

          o dbrettype() returns the datatype of a parameter value.
       o For an example of this routine, see Example 8 in the DB-Library
         Reference Supplement.

  PARAMETERS:
       dbproc -  A pointer to the DBPROCESS structure that provides  the
           connection for a particular front-end/SQL Server process.  It
           contains all the information that DB-Library uses  to  manage



  5                       Version 4.0 -- 5/1/89                dbnumrets
  ______________________________________________________________________
           communications and data between the front end and SQL Server.

  RETURNS:
       The number of return parameter values associated  with  the  most
       recently-executed stored procedure.

  SEE ALSO:
       dbnextrow, dbresults, dbretdata, dbretlen, dbretname,  dbrettype,
       dbrpcinit, dbrpcparam










Typewritten Software • bear@typewritten.org • Edmonds, WA 98026