/** * INTERNAL: * Binds the custom parameter (obj) into the passed PreparedStatement * for the passed DatabaseCall. * Note that parameter numeration for PreparedStatement starts with 1, * therefore statement.set...(index + 1, ...) should be used. * DatabaseCall will carry this object as its parameter: call.getParameters().elementAt(index). * The reason for passing DatabaseCall and DatabasePlatform into this method * is that this method may set obj as a new value of index parameter: * call.getParameters().setElementAt(obj, index); * and call again the method which has called it: * platform.setParameterValueInDatabaseCall(call, statement, index); * so obj will be bound. * * Called only by DatabasePlatform.setParameterValueInDatabaseCall method */ @Override public void set(DatabasePlatform platform, PreparedStatement statement, int index, AbstractSession session) throws SQLException { // Binding starts with a 1 not 0. Make sure that index > 0 ((oracle.jdbc.OraclePreparedStatement)statement).setFormOfUse(index, oracle.jdbc.OraclePreparedStatement.FORM_NCHAR); super.set(platform, statement, index, session); } }
/** * INTERNAL: * Binds the custom parameter (obj) into the passed PreparedStatement * for the passed DatabaseCall. * Note that parameter numeration for PreparedStatement starts with 1, * therefore statement.set...(index + 1, ...) should be used. * DatabaseCall will carry this object as its parameter: call.getParameters().elementAt(index). * The reason for passing DatabaseCall and DatabasePlatform into this method * is that this method may set obj as a new value of index parameter: * call.getParameters().setElementAt(obj, index); * and call again the method which has called it: * platform.setParameterValueInDatabaseCall(call, statement, index); * so obj will be bound. * * Called only by DatabasePlatform.setParameterValueInDatabaseCall method */ public void set(DatabasePlatform platform, PreparedStatement statement, int index, AbstractSession session) throws SQLException { // Binding starts with a 1 not 0. Make sure that index > 0 ((oracle.jdbc.OraclePreparedStatement)statement).setFormOfUse(index, oracle.jdbc.OraclePreparedStatement.FORM_NCHAR); super.set(platform, statement, index, session); } }
statement.setBytes(index, (byte[])convertObject(parameter, ClassConstants.APBYTE)); } else if (parameter instanceof BindCallCustomParameter) { ((BindCallCustomParameter)(parameter)).set(this, statement, index, session); } else if (typeConverters != null && typeConverters.containsKey(parameter.getClass())){ StructConverter converter = getTypeConverters().get(parameter.getClass());
statement.setBytes(index, (byte[])convertObject(parameter, ClassConstants.APBYTE)); } else if (parameter instanceof BindCallCustomParameter) { ((BindCallCustomParameter)(parameter)).set(this, statement, index, session); } else if (typeConverters != null && typeConverters.containsKey(parameter.getClass())){ StructConverter converter = typeConverters.get(parameter.getClass());
statement.setSQLXML(index, (SQLXML) parameter); } else if (parameter instanceof BindCallCustomParameter) { ((BindCallCustomParameter)(parameter)).set(this, statement, index, session); } else if (typeConverters != null && typeConverters.containsKey(parameter.getClass())){ StructConverter converter = typeConverters.get(parameter.getClass());
@Override public void set(DatabasePlatform platform, PreparedStatement statement, int index, AbstractSession session) throws SQLException { if (this.obj instanceof String) { //Bug#5200836, unwrap the connection prior to using. Connection con = session.getServerPlatform().unwrapConnection(statement.getConnection()); SQLXML sqlxml = con.createSQLXML(); sqlxml.setString((String) obj); this.obj = sqlxml; } else if (this.obj instanceof Document) { //Bug#5200836, unwrap the connection prior to using. Connection con = session.getServerPlatform().unwrapConnection(statement.getConnection()); SQLXML sqlxml = con.createSQLXML(); DOMResult result = sqlxml.setResult(DOMResult.class); result.setNode((Document) obj); this.obj = sqlxml; } super.set(platform, statement, index, session); } }
public void set(DatabasePlatform platform, PreparedStatement statement, int index, AbstractSession session) throws SQLException { if (this.obj instanceof String) { //Bug#5200836, unwrap the connection prior to using. this.obj = XMLType.createXML(session.getServerPlatform().unwrapConnection(statement.getConnection()), (String)this.obj); } else if (this.obj instanceof Document) { if (this.obj instanceof XDBDocument) { //Bug#5200836, unwrap the connection prior to using. this.obj = XMLType.createXML(session.getServerPlatform().unwrapConnection(statement.getConnection()), (XDBDocument)this.obj); } else { Document doc = (Document)obj; StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); xmlTransformer.transform(doc, result); //Bug#5200836, unwrap the connection prior to using. this.obj = XMLType.createXML(session.getServerPlatform().unwrapConnection(statement.getConnection()), writer.getBuffer().toString()); } } super.set(platform, statement, index, session); } }