[Contents] [Previous] [Next] [Index]

Stproc

Represents a call to a database stored procedure.

Server-side object

Implemented in

Netscape Server 3.0

Created by

The storedProc method of the database object or of a Connection object. You do not call a Stproc constructor.

Description

When finished with a Stproc object, use the close method to close it and release the memory it uses. If you release a connection that has an open stored procedure, the runtime engine waits until the stored procedure is closed before actually releasing the connection.

If you do not explicitly close a stored procedure with the close method, the JavaScript runtime engine on the server automatically tries to close all open stored procedures when the associated database or Connection object goes out of scope. This can tie up system resources unnecessarily. It can also lead to unpredictable results.

You can use the prototype property of the Stproc class to add a property to all Stproc instances. If you do so, that addition applies to all Stproc objects running in all applications on your server, not just in the single application that made the change. This allows you to expand the capabilities of this object for your entire server.

Property Summary

prototype
Allows the addition of properties to a Stproc object.

Method Summary

close
Closes a stored-procedure object.

outParamCount
Returns the number of output parameters returned by a stored procedure.

outParameters
Returns the value of the specified output parameter.

resultSet
Returns a new result set object.

returnValue
Returns the return value for the stored procedure.

Properties

prototype

Represents the prototype for this class. You can use the prototype to add properties or methods to all instances of a class. For information on prototypes, see Function.prototype.

Property of

Stproc

Implemented in

LiveWire 1.0

Methods

close

Closes the stored procedure and frees the allocated memory.

Method of

Stproc

Implemented in

Netscape Server 3.0

Syntax

close()

Parameters

None.

Returns

0 if the call was successful; otherwise, a nonzero status code based on any error message passed by the database. If the method returns a nonzero status code, use the associated majorErrorCode and majorErrorMessage methods to interpret the cause of the error.

Description

The close method closes a stored procedure and releases the memory it uses. If you do not explicitly close a stored procedure with the close method, the JavaScript runtime engine on the server automatically closes it when the corresponding client object goes out of scope.

outParamCount

Returns the number of output parameters returned by a stored procedure.

Method of

Stproc

Implemented in

Netscape Server 3.0

Syntax

outParamCount()

Parameters

None.

Returns

The number of output parameters for the stored procedure. Informix stored procedures do not have output parameters. Therefore for Informix, this method always returns 0. You should always call this method before calling outParameters, to ensure that the stored procedure has output parameters.

outParameters

Returns the value of the specified output parameter.

Method of

Stproc

Implemented in

Netscape Server 3.0

Syntax

outParameters (n)

Parameters

n
Zero-based ordinal for the output parameter to return.

Returns

The value of the specified output parameter. This can be a string, number, double, or object.

Description

Do not use this method for Informix stored procedures, because they do not have output parameters.

You should always call the outParamCount method before you call this method. If outParamCount returns 0, the stored procedure has no output parameters. In this situation, do not call this method.

You must retrieve result set objects before you call this method. Once you call this method, you can't get any more data from a result set, and you can't get any additional result sets.

resultSet

Returns a new result set object.

Method of

Stproc

Implemented in

Netscape Server 3.0

Syntax

resultSet ()

Parameters

None.

Description

Running a stored procedure can create 0 or more result sets. You access the result sets in turn by repeated calls to the resultSet method. See the description of the Resultset for restrictions on when you can use this method access the result sets for a stored procedure.

spobj = connobj.storedProc("getcusts");
// Creates a new result set object
resobj = spobj.resultSet();

returnValue

Returns the return value for the stored procedure.

Method of

Stproc

Implemented in

Netscape Server 3.0

Syntax

returnValue()

Parameters

None.

Returns

For Sybase, this method always returns the return value of the stored procedure.

For Oracle, this method returns null if the stored procedure did not return a value or the return value of the stored procedure.

For Informix, DB2, and ODBC, this method always returns null.

Description

You must retrieve result set objects before you call this method. Once you call this method, you can't get any more data from a result set, and you can't get any additional result sets.


[Contents] [Previous] [Next] [Index]

Last Updated: 10/31/97 16:36:13


Copyright � 1997 Netscape Communications Corporation