/** * Add the parameter. * If using binding bind the parameter otherwise let the platform print it. * The platform may also decide to bind the value. */ public void appendParameter(Writer writer, Object parameter, AbstractSession session) { if (Boolean.TRUE.equals(usesBinding)) { bindParameter(writer, parameter); } else { session.getPlatform().appendParameter(this, writer, parameter); } }
/** * Add the parameter. * If using binding bind the parameter otherwise let the platform print it. * The platform may also decide to bind the value. */ public void appendParameter(Writer writer, Object parameter, AbstractSession session) { if (Boolean.TRUE.equals(usesBinding)) { bindParameter(writer, parameter); } else { session.getPlatform().appendParameter(this, writer, parameter); } }
/** * Add the parameter. * If using binding bind the parameter otherwise let the platform print it. * The platform may also decide to bind the value. */ public void appendParameter(Writer writer, Object parameter, AbstractSession session) { if (Boolean.TRUE.equals(usesBinding)) { bindParameter(writer, parameter); } else { session.getPlatform().appendParameter(this, writer, parameter); } }
/** * INTERNAL: Given a call, this method produces the stored procedure string * based on the SQL string inside the call. */ protected String buildProcedureString(SQLCall call) { String stringToModify = call.getSQLString(); String replacementToken = getSession().getPlatform().getStoredProcedureParameterPrefix(); StringWriter stringWriter = new StringWriter(); int startIndex = 0; int nextParamIndex = 0; int tokenIndex = stringToModify.indexOf("?"); while (tokenIndex != -1) { stringWriter.write(stringToModify.substring(startIndex, tokenIndex)); startIndex = tokenIndex + 1; Object parameter = call.getParameters().elementAt(nextParamIndex); if (parameter instanceof DatabaseField) { stringWriter.write(replacementToken); stringWriter.write(((DatabaseField)parameter).getName()); } else if (parameter instanceof ParameterExpression) { stringWriter.write(replacementToken); stringWriter.write(((ParameterExpression)parameter).getField().getName()); } else { getSession().getPlatform().appendParameter(call, stringWriter, parameter); } tokenIndex = stringToModify.indexOf("?", startIndex); nextParamIndex++; } stringWriter.write(stringToModify.substring(startIndex)); return stringWriter.toString(); }
/** * INTERNAL: Given a call, this method produces the stored procedure string * based on the SQL string inside the call. */ protected String buildProcedureString(SQLCall call) { String stringToModify = call.getSQLString(); String replacementToken = getSession().getPlatform().getStoredProcedureParameterPrefix(); StringWriter stringWriter = new StringWriter(); int startIndex = 0; int nextParamIndex = 0; int tokenIndex = stringToModify.indexOf("?"); while (tokenIndex != -1) { stringWriter.write(stringToModify.substring(startIndex, tokenIndex)); startIndex = tokenIndex + 1; Object parameter = call.getParameters().get(nextParamIndex); if (parameter instanceof DatabaseField) { stringWriter.write(replacementToken); stringWriter.write(((DatabaseField)parameter).getName()); } else if (parameter instanceof ParameterExpression) { stringWriter.write(replacementToken); stringWriter.write(((ParameterExpression)parameter).getField().getName()); } else { getSession().getPlatform().appendParameter(call, stringWriter, parameter); } tokenIndex = stringToModify.indexOf("?", startIndex); nextParamIndex++; } stringWriter.write(stringToModify.substring(startIndex)); return stringWriter.toString(); }
/** * INTERNAL: Given a call, this method produces the stored procedure string * based on the SQL string inside the call. */ protected String buildProcedureString(SQLCall call) { String stringToModify = call.getSQLString(); String replacementToken = getSession().getPlatform().getStoredProcedureParameterPrefix(); StringWriter stringWriter = new StringWriter(); int startIndex = 0; int nextParamIndex = 0; int tokenIndex = stringToModify.indexOf("?"); while (tokenIndex != -1) { stringWriter.write(stringToModify.substring(startIndex, tokenIndex)); startIndex = tokenIndex + 1; Object parameter = call.getParameters().get(nextParamIndex); if (parameter instanceof DatabaseField) { stringWriter.write(replacementToken); stringWriter.write(((DatabaseField)parameter).getName()); } else if (parameter instanceof ParameterExpression) { stringWriter.write(replacementToken); stringWriter.write(((ParameterExpression)parameter).getField().getName()); } else { getSession().getPlatform().appendParameter(call, stringWriter, parameter); } tokenIndex = stringToModify.indexOf("?", startIndex); nextParamIndex++; } stringWriter.write(stringToModify.substring(startIndex)); return stringWriter.toString(); }