@Test public void testCreate() { PostgresStatementCreator creator = new PostgresStatementCreator(); assertEquals("SELECT mystoredProcedure(?, ?);", creator.createCall("mystoredProcedure", 2)); assertEquals("SELECT mystoredProcedure();", creator.createCall("mystoredProcedure", 0)); }
public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("SELECT ").append(procedureName); sb.append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); }
PostgresStatementCreator { public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("SELECT ").append(procedureName); sb.append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); } }
PostgresStatementCreator { public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("SELECT ").append(procedureName); sb.append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); }  }
PostgresStatementCreator { public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("SELECT ").append(procedureName); sb.append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); }  String createCall(String procedureName, int parameterCount); }
PostgresStatementCreator { public String createCall(String procedureName, int parameterCount) { StringBuffer sb = new StringBuffer("SELECT ").append(procedureName); sb.append("("); for (int i = 0; i < parameterCount; i++) { sb.append("?"); if (i < parameterCount - 1) { sb.append(", "); } } sb.append(");"); return sb.toString(); }  String createCall(String procedureName, int parameterCount);  }