@Override public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind) { Class type = field.getType(); if ((type != null) && PGobject.class.isAssignableFrom(type)) { if(value == null) { return null; } if (INET.equals(type)) { value = convertToInet(value); } else if (CIDR.equals(type)) { value = convertToCidr(value); } else if (MACADDR.equals(type)) { value = convertToMac(value); } return new BindCallCustomParameter(value); } return super.getCustomModifyValueForCall(call, value, field, shouldBind); }
/** * 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); } }
value = session.getDatasourcePlatform().getCustomModifyValueForCall(this, value, field, false); if ((value instanceof BindCallCustomParameter) && ((BindCallCustomParameter)value).shouldUseUnwrappedConnection()){ this.isNativeConnectionRequired=true;
Object element = iter.next(); if (element != null) { element = convert(element, nestedType, session, connection);
value = session.getDatasourcePlatform().getCustomModifyValueForCall(this, value, field, false); if ((value instanceof BindCallCustomParameter) && ((BindCallCustomParameter)value).shouldUseUnwrappedConnection()){ this.isNativeConnectionRequired=true;
Object element = iter.next(); if (element != null) { element = convert(element, nestedType, session, connection);
/** * This method determines if any special processing needs to occur prior to writing a field. * * It does things such as determining if a field must be bound and flagging the parameter as one * that must be bound. */ @Override public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind) { if (typeConverters != null){ StructConverter converter = typeConverters.get(field.getType()); if (converter != null) { Object bindValue = value; if (bindValue == null) { bindValue = new ObjectRelationalDatabaseField(field); ((ObjectRelationalDatabaseField)bindValue).setSqlType(java.sql.Types.STRUCT); ((ObjectRelationalDatabaseField)bindValue).setSqlTypeName(converter.getStructName()); } return new BindCallCustomParameter(bindValue); } } return super.getCustomModifyValueForCall(call, value, field, shouldBind); }
/** * 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); } }
value = session.getDatasourcePlatform().getCustomModifyValueForCall(this, value, field, false); if ((value instanceof BindCallCustomParameter) && ((BindCallCustomParameter)value).shouldUseUnwrappedConnection()){ this.isNativeConnectionRequired=true;
Object element = iter.next(); if (element != null) { element = convert(element, nestedType, session, connection);
/** * This method determines if any special processing needs to occur prior to writing a field. * * It does things such as determining if a field must be bound and flagging the parameter as one * that must be bound. */ public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind) { if (typeConverters != null){ StructConverter converter = typeConverters.get(field.getType()); if (converter != null) { Object bindValue = value; if (bindValue == null) { bindValue = new ObjectRelationalDatabaseField(field); ((ObjectRelationalDatabaseField)bindValue).setSqlType(java.sql.Types.STRUCT); ((ObjectRelationalDatabaseField)bindValue).setSqlTypeName(converter.getStructName()); } return new BindCallCustomParameter(bindValue); } } return super.getCustomModifyValueForCall(call, value, field, shouldBind); }
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());
value = session.getPlatform().getCustomModifyValueForCall(this, value, field, true); if ((value!=null) && (value instanceof BindCallCustomParameter) && (((BindCallCustomParameter)value).shouldUseUnwrappedConnection())){ this.isNativeConnectionRequired=true;
/** * This method determines if any special processing needs to occur prior to writing a field. * * It does things such as determining if a field must be bound and flagging the parameter as one * that must be bound. */ public Object getCustomModifyValueForCall(Call call, Object value, DatabaseField field, boolean shouldBind) { if (typeConverters != null){ StructConverter converter = typeConverters.get(field.getType()); if (converter != null) { Object bindValue = value; if (bindValue == null) { bindValue = new ObjectRelationalDatabaseField(field); ((ObjectRelationalDatabaseField)bindValue).setSqlType(java.sql.Types.STRUCT); ((ObjectRelationalDatabaseField)bindValue).setSqlTypeName(converter.getStructName()); } return new BindCallCustomParameter(bindValue); } } return super.getCustomModifyValueForCall(call, value, field, shouldBind); }
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());
value = session.getPlatform().getCustomModifyValueForCall(this, value, field, true); if ((value!=null) && (value instanceof BindCallCustomParameter) && (((BindCallCustomParameter)value).shouldUseUnwrappedConnection())){ this.isNativeConnectionRequired=true;
nBoundParameters = printValuelist((Collection)dbValue, databaseCall, writer); } else if (typeConverters != null && typeConverters.containsKey(dbValue.getClass())){ dbValue = new BindCallCustomParameter(dbValue);
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());
value = session.getPlatform().getCustomModifyValueForCall(this, value, field, true); if ((value!=null) && (value instanceof BindCallCustomParameter) && (((BindCallCustomParameter)value).shouldUseUnwrappedConnection())){ this.isNativeConnectionRequired=true;
nBoundParameters = printValuelist((Collection)dbValue, databaseCall, writer); } else if (typeConverters != null && typeConverters.containsKey(dbValue.getClass())){ dbValue = new BindCallCustomParameter(dbValue);