FileDocCategorySizeDatePackage
SQLModifyAllStatementForTempTable.javaAPI DocGlassfish v2 API5292Tue May 22 16:54:32 BST 2007oracle.toplink.essentials.internal.expressions

SQLModifyAllStatementForTempTable

public abstract class SQLModifyAllStatementForTempTable extends SQLModifyStatement
author
Andrei Ilitchev
since
TOPLink/Java 1.0

Fields Summary
public static final int
CREATE_TEMP_TABLE
public static final int
INSERT_INTO_TEMP_TABLE
public static final int
UPDATE_ORIGINAL_TABLE
public static final int
CLEANUP_TEMP_TABLE
protected Collection
allFields
protected Collection
primaryKeyFields
protected SQLCall
selectCall
protected int
mode
Constructors Summary
Methods Summary
public oracle.toplink.essentials.internal.databaseaccess.DatabaseCallbuildCall(oracle.toplink.essentials.internal.sessions.AbstractSession session)
Append the string containing the SQL insert string for the given table.

        SQLCall call = new SQLCall();
        call.returnNothing();
        
        Writer writer = new CharArrayWriter(100);
        
        try {
            if(mode == CREATE_TEMP_TABLE) {
                session.getPlatform().writeCreateTempTableSql(writer, table, session, 
                                                new Vector(getPrimaryKeyFields()),
                                                getUsedFields(),
                                                new Vector(getAllFields()));
            } else if(mode == INSERT_INTO_TEMP_TABLE) {
                session.getPlatform().writeInsertIntoTableSql(writer, table, getUsedFields());

                call.getParameters().addAll(selectCall.getParameters());
                call.getParameterTypes().addAll(selectCall.getParameterTypes());
                
                String selectStr = selectCall.getSQLString();
                writer.write(selectStr);
                
            } else if(mode == UPDATE_ORIGINAL_TABLE) {
                writeUpdateOriginalTable(session, writer);
            } else if(mode == CLEANUP_TEMP_TABLE) {
                session.getPlatform().writeCleanUpTempTableSql(writer, table);
            } else {
                // should never happen
            }

            call.setSQLString(writer.toString());
            
        } catch (IOException exception) {
            throw ValidationException.fileError(exception);
        }
                
        return call;
    
public java.util.CollectiongetAllFields()

        return allFields;
    
public intgetMode()

        return mode;
    
public java.util.CollectiongetPrimaryKeyFields()

        return primaryKeyFields;
    
public oracle.toplink.essentials.queryframework.SQLCallgetSelectCall()

        return selectCall;
    
protected abstract java.util.CollectiongetUsedFields()

public voidsetAllFields(java.util.Collection allFields)

    
       
            

        
        this.allFields = allFields;
    
public voidsetMode(int mode)

        this.mode = mode;
    
public voidsetPrimaryKeyFields(java.util.Collection primaryKeyFields)

        this.primaryKeyFields = primaryKeyFields;
    
public voidsetSelectCall(oracle.toplink.essentials.queryframework.SQLCall selectCall)

        this.selectCall = selectCall;
    
protected abstract voidwriteUpdateOriginalTable(oracle.toplink.essentials.internal.sessions.AbstractSession session, java.io.Writer writer)