org.datanucleus.store.rdbms.fieldmanager.ParameterSetter Maven / Gradle / Ivy
/**********************************************************************
Copyright (c) 2002 Mike Martin (TJDO) and others. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Contributors:
2003 Andy Jefferson - coding standards
...
**********************************************************************/
package org.datanucleus.store.rdbms.fieldmanager;
import java.sql.PreparedStatement;
import org.datanucleus.ExecutionContext;
import org.datanucleus.exceptions.NotYetFlushedException;
import org.datanucleus.exceptions.NucleusUserException;
import org.datanucleus.metadata.AbstractMemberMetaData;
import org.datanucleus.metadata.NullValue;
import org.datanucleus.metadata.RelationType;
import org.datanucleus.state.DNStateManager;
import org.datanucleus.store.fieldmanager.AbstractFieldManager;
import org.datanucleus.store.rdbms.mapping.java.EmbeddedPCMapping;
import org.datanucleus.store.rdbms.mapping.java.InterfaceMapping;
import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
import org.datanucleus.store.rdbms.mapping.java.PersistableMapping;
import org.datanucleus.store.rdbms.mapping.java.SerialisedPCMapping;
import org.datanucleus.store.rdbms.mapping.java.SerialisedReferenceMapping;
import org.datanucleus.store.rdbms.query.StatementClassMapping;
import org.datanucleus.store.rdbms.query.StatementMappingIndex;
import org.datanucleus.store.types.SCOUtils;
import org.datanucleus.util.Localiser;
/**
* Parameter setter implementation of a field manager.
*/
public class ParameterSetter extends AbstractFieldManager
{
protected final DNStateManager sm;
protected final ExecutionContext ec;
protected final PreparedStatement statement;
protected final StatementClassMapping stmtMappings;
/**
* Constructor.
* @param sm StateManager for the object.
* @param stmt The Statement to set values on.
* @param stmtMappings mappings for parameters in the statement.
*/
public ParameterSetter(DNStateManager sm, PreparedStatement stmt, StatementClassMapping stmtMappings)
{
this.sm = sm;
this.ec = sm.getExecutionContext();
this.statement = stmt;
this.stmtMappings = stmtMappings;
}
public void storeBooleanField(int fieldNumber, boolean value)
{
StatementMappingIndex mapIdx = stmtMappings.getMappingForMemberPosition(fieldNumber);
for (int i=0;i 0)
{
for (int i=0;i