1 package org.apache.ojb.broker.accesslayer.sql; 2 3 17 18 import org.apache.ojb.broker.metadata.ProcedureDescriptor; 19 import org.apache.ojb.broker.util.logging.Logger; 20 21 29 30 public class SqlProcedureStatement implements SqlStatement 31 { 32 33 36 private ProcedureDescriptor procedureDescriptor; 37 38 41 private Logger logger; 42 43 49 public SqlProcedureStatement(ProcedureDescriptor procedureDescriptor, Logger logger) 50 { 51 this.procedureDescriptor = procedureDescriptor; 53 this.logger = logger; 54 } 55 56 63 public String getStatement() 64 { 65 StringBuffer sb = new StringBuffer (512); 66 int argumentCount = this.procedureDescriptor.getArgumentCount(); 67 if (this.procedureDescriptor.hasReturnValue()) 68 { 69 sb.append("{ ?= call "); 70 } 71 else 72 { 73 sb.append("{ call "); 74 } 75 sb.append(this.procedureDescriptor.getName()); 76 sb.append("("); 77 for (int i = 0; i < argumentCount; i++) 78 { 79 if (i == 0) 80 { 81 sb.append("?"); 82 } 83 else 84 { 85 sb.append(",?"); 86 } 87 } 88 sb.append(") }"); 89 return sb.toString(); 90 } 91 } 92 | Popular Tags |