1 58 59 61 79 package com.mockobjects.sql; 80 81 import com.mockobjects.ReturnObjectBag; 82 83 import java.sql.Connection ; 84 import java.sql.PreparedStatement ; 85 import java.sql.SQLException ; 86 87 abstract class CommonMockConnection2 extends CommonMockConnection implements Connection { 88 89 private final ReturnObjectBag myPreparedStatements; 90 91 public CommonMockConnection2() { 92 this(CommonMockConnection2.class.getName()); 93 } 94 95 public CommonMockConnection2(String name) { 96 super(name); 97 myPreparedStatements = new ReturnObjectBag(name+".preparedStatements"); 98 } 99 100 103 public void setupAddPreparedStatement(String sql, PreparedStatement prepared) { 104 myPreparedStatements.putObjectToReturn(sql, prepared); 105 } 106 107 113 public PreparedStatement prepareStatement(String sql) throws SQLException { 114 throwStatementExceptionIfAny(); 115 return (PreparedStatement ) myPreparedStatements.getNextReturnObject(sql); 116 } 117 } 118 | Popular Tags |