Difference between revisions of "Documentation/DevGuide/Database/Stored Procedures"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Database Access)
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/Database/Writing Database Drivers
 
|NextPage=Documentation/DevGuide/Database/Writing Database Drivers
 
}}
 
}}
{{DISPLAYTITLE:Stored Procedures}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Database/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Stored Procedures}}
 
<!--<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>.  
Line 30: Line 31:
 
{{PDL1}}
 
{{PDL1}}
  
[[Category:Documentation/Developers Guide/Database Access]]
+
[[Category:Documentation/Developer's Guide/Database Access]]

Revision as of 01:39, 1 October 2012

  • Stored Procedures



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).
Personal tools
In other languages