Difference between revisions of "Documentation/DevGuide/Database/Stored Procedures"
Line 9: | Line 9: | ||
<!--<idltopic>com.sun.star.sdbc.XOutParameters</idltopic>--> | <!--<idltopic>com.sun.star.sdbc.XOutParameters</idltopic>--> | ||
Stored procedures are server-side processes execute several SQL commands in a single step, and can be embedded in a server language for stored procedures with enhanced control capabilities. A procedure call usually has to be parameterized, and the results are result sets and additional out parameters. Stored procedures are handled by the method <code>prepareCall()</code> of the interface <idl>com.sun.star.sdbc.XConnection</idl>. | Stored procedures are server-side processes execute several SQL commands in a single step, and can be embedded in a server language for stored procedures with enhanced control capabilities. A procedure call usually has to be parameterized, and the results are result sets and additional out parameters. Stored procedures are handled by the method <code>prepareCall()</code> of the interface <idl>com.sun.star.sdbc.XConnection</idl>. | ||
− | + | <syntaxhighlight lang="idl"> | |
com::sun::star::sdbc::XPreparedStatement prepareCall( [in] string sql) | com::sun::star::sdbc::XPreparedStatement prepareCall( [in] string sql) | ||
− | + | </syntaxhighlight> | |
The method <code>prepareCall()</code> takes a an SQL statement that may contain one or more '<code>?</code>' in parameter placeholders. It returns a <idl>com.sun.star.sdbc.CallableStatement</idl>. A <code>CallableStatement</code> is a <idl>com.sun.star.sdbcx.PreparedStatement</idl> with two additional interfaces for out parameters: | The method <code>prepareCall()</code> takes a an SQL statement that may contain one or more '<code>?</code>' in parameter placeholders. It returns a <idl>com.sun.star.sdbc.CallableStatement</idl>. A <code>CallableStatement</code> is a <idl>com.sun.star.sdbcx.PreparedStatement</idl> with two additional interfaces for out parameters: | ||
Latest revision as of 15:19, 21 December 2020
Stored procedures are server-side processes execute several SQL commands in a single step, and can be embedded in a server language for stored procedures with enhanced control capabilities. A procedure call usually has to be parameterized, and the results are result sets and additional out parameters. Stored procedures are handled by the method prepareCall()
of the interface com.sun.star.sdbc.XConnection.
com::sun::star::sdbc::XPreparedStatement prepareCall( [in] string sql)
The method prepareCall()
takes a an SQL statement that may contain one or more '?
' in parameter placeholders. It returns a com.sun.star.sdbc.CallableStatement. A CallableStatement
is a com.sun.star.sdbcx.PreparedStatement with two additional interfaces for out parameters:
com.sun.star.sdbc.XOutParameters is used to declare parameters as out parameters. All out parameters must be registered before a stored procedure is executed.
Methods of com.sun.star.sdbc.XOutParameters | |
---|---|
registerOutParameter() | Takes the arguments long parameterIndex, long sqlType, string typeName. Registers an output parameter and should be used for a user-named or REF output parameter. Examples of user-named types include: STRUCT, DISTINCT, OBJECT, and named array types. |
registerNumericOutParameter() | Takes the arguments long parameterIndex, long sqlType, long scale. Registers an out parameter in the ordinal position parameterIndex with the com.sun.star.sdbc.DataType sqlType; scale is the number of digits on the right-hand side of the decimal point. |
The com.sun.star.sdbc.XRow is used to retrieve the values of out parameters. It consists of getXXX() methods and should be well-known from the common result sets.
Content on this page is licensed under the Public Documentation License (PDL). |