1 24 25 package org.objectweb.cjdbc.scenario.horizontal; 26 27 import java.sql.Connection ; 28 import java.sql.SQLException ; 29 30 import org.objectweb.cjdbc.scenario.templates.HorizontalTemplate; 31 import org.objectweb.cjdbc.scenario.tools.testlet.AbstractTestLet; 32 import org.objectweb.cjdbc.scenario.tools.testlet.ProcedureTestLet; 33 34 40 public class HorizontalStoredProcedureScenario extends HorizontalTemplate 41 { 42 47 public void testStoredProcedureWithStatementQuery() throws Exception 48 { 49 Connection con = getCJDBCConnection(); 50 con.setCatalog("myDB"); 51 ProcedureTestLet let = new ProcedureTestLet(con); 52 let.set(AbstractTestLet.USE_UPDATE_STATEMENT, Boolean.FALSE); 53 let.executeBatch(AbstractTestLet.USE_PREPARED_STATEMENT, new Boolean []{ 54 Boolean.TRUE, Boolean.FALSE}); 55 } 56 57 62 public void testStoredProcedureWithStatementUpdate() throws Exception 63 { 64 String msg = "Expected exception because update do not generate a row count"; 65 Connection con = getCJDBCConnection(); 66 con.setCatalog("myDB"); 67 ProcedureTestLet let = new ProcedureTestLet(con); 68 let.set(AbstractTestLet.USE_UPDATE_STATEMENT, Boolean.TRUE); 69 try 70 { 71 let.executeBatch(AbstractTestLet.USE_PREPARED_STATEMENT, new Boolean []{ 72 Boolean.TRUE, Boolean.FALSE}); 73 } 74 catch (Exception expected) 75 { 76 assertTrue(msg, expected instanceof SQLException ); 77 return; 78 } 79 fail(msg); 80 } 81 } | Popular Tags |