1 package com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.constraintsystem; 2 3 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 4 import com.daffodilwoods.daffodildb.server.serversystem.*; 5 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 6 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 7 import com.daffodilwoods.daffodildb.utils.field.*; 8 import com.daffodilwoods.database.general.*; 9 import com.daffodilwoods.database.resource.*; 10 11 16 public class UpdateSFCascadeReferencedExecuter extends ReferencedExecuter { 17 18 26 public UpdateSFCascadeReferencedExecuter( _ReferentialConstraint referencedConstraint, _ServerSession globalSess ) throws DException { 27 globalSession = globalSess; 28 setVariables( referencedConstraint ); 29 } 30 31 36 public void checkReferencedConstraints( _StatementExecutionContext sec ) throws DException { 37 populateMatchingIterator(); 38 for( int i=0; i< matchingRowsPool.size(); i++ ) 39 update_SimpleFull_CASCADE( i , sec ); 40 } 41 42 49 private void update_SimpleFull_CASCADE( int tableIndex , _StatementExecutionContext statementExecutionContext ) throws DException { 50 ConstraintStore constraintStore = (ConstraintStore)matchingRowsPool.get(tableIndex); 51 _Iterator iterator = constraintStore.getIterator(); 52 booleanvalueexpression bve = constraintStore.getCondition(); 53 setParameterValues( iterator , bve , statementExecutionContext.getRecordVersion().getPreviousRecord() ); 54 if(iterator.last()) { 55 _ServerTable serverTable = statementExecutionContext.getServerTable( (QualifiedIdentifier)sub_superTable.get(tableIndex) ); 56 _StatementExecutionContext sss = getNewSEC( statementExecutionContext ); 57 do { 58 int[] column = new int[referencingColumns.length]; 59 Object [] value = new Object [referencingColumns.length]; 60 for( int i=0; i<referencingColumns.length ; i++ ){ 61 column[i] = referencingColumns[i]; 62 value[i] = ( (FieldBase) statementExecutionContext.getRecordVersion().getCurrentRecord().getObject(referencedColumns[i])).getObject(); 63 } 64 serverTable.update( iterator , column, value , sss ); 65 } while( iterator.previous() ) ; 66 } 67 } 68 } 69 | Popular Tags |