Result executeUpdateStatement ( Session session ) { int count = 0 ; Expression [ ] colExpressions = updateExpressions ; HashMappedList rowset = new HashMappedList ( ) ; Type [ ] colTypes = baseTable . getColumnTypes ( ) ; RangeIteratorBase it = RangeVariable . getIterator ( session , targetRangeVariables ) ; Expression checkCondition = null ; if ( targetTable != baseTable ) { checkCondition = ( ( TableDerived ) targetTable ) . getQueryExpression ( ) . getMainSelect ( ) . checkQueryCondition ; } while ( it . next ( ) ) { session . sessionData . startRowProcessing ( ) ; Row row = it . getCurrentRow ( ) ; Object [ ] data = row . getData ( ) ; Object [ ] newData = getUpdatedData ( session , baseTable , updateColumnMap , colExpressions , colTypes , data ) ; if ( checkCondition != null ) { it . currentData = newData ; boolean check = checkCondition . testCondition ( session ) ; if ( ! check ) { throw Error . error ( ErrorCode . X_44000 ) ; } } rowset . add ( row , newData ) ; } /* debug 190 if (rowset.size() == 0) { System.out.println(targetTable.getName().name + " zero update: session " + session.getId()); } else if (rowset.size() >1) { System.out.println("multiple update: session " + session.getId() + ", " + rowset.size()); } //* debug 190 */ count = update ( session , baseTable , rowset ) ; return Result . getUpdateCountResult ( count ) ; }
Executes an UPDATE statement . It is assumed that the argument is of the correct type .