Dear Wiki user, You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.
The following page has been changed by KevinWilliams: http://wiki.apache.org/ws/Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_Java_User_Guide/Stored_Procedures ------------------------------------------------------------------------------ DataObject root = read.executeQuery(); }}} - The predefined stored procedure "GETALLCOMPANIES" returnes a result just like "select * from company" would. There are of course stored procedures that do not return result sets and these call also be executed with the same programming model. Any arbitrary stored procedure can invoked in this way. The follwing example calls proc that deletes an identified company: + The predefined stored procedure "GETALLCOMPANIES" returnes a result just like "select * from company" would. There are, however, procedures that do not return results and these call also be executed with the same programming model. In fact any arbitrary stored procedure can invoked in this way. The follwing example calls a proc that deletes an identified company: {{{ DAS das = DAS.FACTORY.createDAS(getConnection()); Command delete = das.createCommand("{call DELETECUSTOMER(?)}"); - delete.setParameter(1, Integer.valueOf(1)); + delete.setParameter(1, 1234); delete.execute(); }}} + Stored procedure may also provide IN/OUT and OUT parameters. The following illustrates the use of a stored procedure that returns a result set as well as an OUT parameter: + + {{{ + DAS das = DAS.FACTORY.createDAS(getConfig("storedProcTest.xml"), getConnection()); + Command read = das.getCommand("getNamedCustomers"); + read.setParameter(1, "Williams"); + DataObject root = read.executeQuery(); + + Integer customersRead = (Integer) read.getParameter(2); + }}} + + This example makes use of a configuration file to define the command including the OUT parameter: + {{{ + <Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <Command name="getNamedCustomers" SQL="{call GETNAMEDCUSTOMERS(?,?)}" kind="procedure"> + <Parameter direction="IN" columnType="commonj.sdo.String"/> + <Parameter direction="OUT" columnType="commonj.sdo.IntObject"/> + </Command> + + </Config> + }}} + This proc is defined such that the first argument provides the name to match when looking for customers. The second argument is an OUT parameter and provides the number of customers found. The proc also returns the Customers. + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
