Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.sql.execute
Class RIBulkChecker  view RIBulkChecker download RIBulkChecker.java

java.lang.Object
  extended byorg.apache.derby.impl.sql.execute.RIBulkChecker

public class RIBulkChecker
extends java.lang.Object

Do a merge run comparing all the foreign keys from the foreign key conglomerate against the referenced keys from the primary key conglomerate. The scanControllers are passed in by the caller (caller controls locking on said conglomerates).

The comparision is done via a merge. Consequently, it is imperative that the scans are on keyed conglomerates (indexes) and that the referencedKeyScan is a unique scan.

Performance is no worse than N + M where N is foreign key rows and M is primary key rows.

Bulk fetch is used to further speed performance. The fetch size is LanguageProperties.BULK_FETCH_DEFAULT


Field Summary
private  int currFKRowIndex
           
private  int currRefRowIndex
           
private static int EQUAL
           
private  int failedCounter
           
private  org.apache.derby.iapi.sql.execute.ExecRow firstRowToFail
           
private  FKInfo fkInfo
           
private  org.apache.derby.iapi.types.DataValueDescriptor[][] foreignKeyRowArray
           
private  org.apache.derby.iapi.store.access.GroupFetchScanController foreignKeyScan
           
private static int GREATER_THAN
           
private  int lastFKRowIndex
           
private  int lastRefRowIndex
           
private static int LESS_THAN
           
private  int numColumns
           
private  boolean quitOnFirstFailure
           
private  org.apache.derby.iapi.types.DataValueDescriptor[][] referencedKeyRowArray
           
private  org.apache.derby.iapi.store.access.GroupFetchScanController referencedKeyScan
           
private  org.apache.derby.iapi.store.access.ConglomerateController unreferencedCC
           
 
Constructor Summary
RIBulkChecker(org.apache.derby.iapi.store.access.GroupFetchScanController referencedKeyScan, org.apache.derby.iapi.store.access.GroupFetchScanController foreignKeyScan, org.apache.derby.iapi.sql.execute.ExecRow templateRow, boolean quitOnFirstFailure, org.apache.derby.iapi.store.access.ConglomerateController unreferencedCC, org.apache.derby.iapi.sql.execute.ExecRow firstRowToFail)
          Create a RIBulkChecker
 
Method Summary
private  boolean anyNull(org.apache.derby.iapi.types.DataValueDescriptor[] fkRowArray)
           
 int doCheck()
          Perform the check.
private  void failure(org.apache.derby.iapi.types.DataValueDescriptor[] foreignKeyRow)
           
private  org.apache.derby.iapi.types.DataValueDescriptor[] getNextFK()
           
private  org.apache.derby.iapi.types.DataValueDescriptor[] getNextRef()
           
private  int greaterThan(org.apache.derby.iapi.types.DataValueDescriptor[] fkRowArray, org.apache.derby.iapi.types.DataValueDescriptor[] refRowArray)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EQUAL

private static final int EQUAL
See Also:
Constant Field Values

GREATER_THAN

private static final int GREATER_THAN
See Also:
Constant Field Values

LESS_THAN

private static final int LESS_THAN
See Also:
Constant Field Values

fkInfo

private FKInfo fkInfo

referencedKeyScan

private org.apache.derby.iapi.store.access.GroupFetchScanController referencedKeyScan

referencedKeyRowArray

private org.apache.derby.iapi.types.DataValueDescriptor[][] referencedKeyRowArray

foreignKeyScan

private org.apache.derby.iapi.store.access.GroupFetchScanController foreignKeyScan

foreignKeyRowArray

private org.apache.derby.iapi.types.DataValueDescriptor[][] foreignKeyRowArray

unreferencedCC

private org.apache.derby.iapi.store.access.ConglomerateController unreferencedCC

failedCounter

private int failedCounter

quitOnFirstFailure

private boolean quitOnFirstFailure

numColumns

private int numColumns

currRefRowIndex

private int currRefRowIndex

currFKRowIndex

private int currFKRowIndex

lastRefRowIndex

private int lastRefRowIndex

lastFKRowIndex

private int lastFKRowIndex

firstRowToFail

private org.apache.derby.iapi.sql.execute.ExecRow firstRowToFail
Constructor Detail

RIBulkChecker

public RIBulkChecker(org.apache.derby.iapi.store.access.GroupFetchScanController referencedKeyScan,
                     org.apache.derby.iapi.store.access.GroupFetchScanController foreignKeyScan,
                     org.apache.derby.iapi.sql.execute.ExecRow templateRow,
                     boolean quitOnFirstFailure,
                     org.apache.derby.iapi.store.access.ConglomerateController unreferencedCC,
                     org.apache.derby.iapi.sql.execute.ExecRow firstRowToFail)
Create a RIBulkChecker

Method Detail

doCheck

public int doCheck()
            throws org.apache.derby.iapi.error.StandardException
Perform the check.


getNextFK

private org.apache.derby.iapi.types.DataValueDescriptor[] getNextFK()
                                                             throws org.apache.derby.iapi.error.StandardException

getNextRef

private org.apache.derby.iapi.types.DataValueDescriptor[] getNextRef()
                                                              throws org.apache.derby.iapi.error.StandardException

failure

private void failure(org.apache.derby.iapi.types.DataValueDescriptor[] foreignKeyRow)
              throws org.apache.derby.iapi.error.StandardException

anyNull

private boolean anyNull(org.apache.derby.iapi.types.DataValueDescriptor[] fkRowArray)
                 throws org.apache.derby.iapi.error.StandardException

greaterThan

private int greaterThan(org.apache.derby.iapi.types.DataValueDescriptor[] fkRowArray,
                        org.apache.derby.iapi.types.DataValueDescriptor[] refRowArray)
                 throws org.apache.derby.iapi.error.StandardException