Java Doc for BTreeScan.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » access » btree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.access.btree 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.store.access.btree.OpenBTree
      org.apache.derby.impl.store.access.btree.BTreeScan

All known Subclasses:   org.apache.derby.impl.store.access.btree.BTreeMaxScan,  org.apache.derby.impl.store.access.btree.BTreeForwardScan,
BTreeScan
abstract public class BTreeScan extends OpenBTree implements ScanManager(Code)
A b-tree scan controller corresponds to an instance of an open b-tree scan.

Concurrency Notes<\B>

The concurrency rules are derived from OpenBTree.


See Also:   OpenBTree



Field Summary
final protected static  intSCAN_DONE
    
final protected static  intSCAN_HOLD_INIT
    
final protected static  intSCAN_HOLD_INPROGRESS
    
final protected static  intSCAN_INIT
    
final protected static  intSCAN_INPROGRESS
    
protected  DataValueDescriptor[][]fetchNext_one_slot_array
     A 1 element array to turn fetchNext and fetch calls into fetchNextGroup calls.
protected  FetchDescriptorinit_fetchDesc
     The fetch descriptor which describes the row to be returned by the scan.
protected  booleaninit_forUpdate
    
protected  booleaninit_hold
    
protected  FetchDescriptorinit_lock_fetch_desc
     A constant FetchDescriptor which describes the position of the RowLocation field within the btree, currently always the last column).
protected  Qualifierinit_qualifier
    
protected  Transactioninit_rawtran
     init_startKeyValue, init_qualifier, and init_stopKeyValue all are used to store * references to the values passed in when ScanController.init() is called.
protected  FormatableBitSetinit_scanColumnList
    
protected  DataValueDescriptor[]init_startKeyValue
    
protected  intinit_startSearchOperator
    
protected  DataValueDescriptor[]init_stopKeyValue
    
protected  intinit_stopSearchOperator
    
protected  DataValueDescriptor[]init_template
    
protected  booleaninit_useUpdateLocks
     Whether the scan should requests UPDATE locks which then will be converted to X locks when the actual operation is performed.
protected  intlock_operation
     What kind of row locks to get during the scan.
 BTreeRowPositionscan_position
    
protected  intscan_state
     Delay positioning the table at the start position until the first next() call.
protected  intstat_numdeleted_rows_visited
    
protected  intstat_numpages_visited
     Performance counters ...
protected  intstat_numrows_qualified
    
protected  intstat_numrows_visited
    

Constructor Summary
public  BTreeScan()
    

Method Summary
public  voidclose()
     Close the scan.
public  booleancloseForEndTransaction(boolean closeHeldScan)
     Close the scan, a commit or abort is about to happen.
public  booleandelete()
     Delete the row at the current position of the scan.
public  voiddidNotQualify()
     A call to allow client to indicate that current row does not qualify.

Indicates to the ScanController that the current row does not qualify for the scan.

public  booleandoesCurrentPositionQualify()
     Returns true if the current position of the scan still qualifies under the set of qualifiers passed to the openScan().
public  voidfetch(DataValueDescriptor[] row)
     Fetch the row at the current position of the Scan.
public  voidfetchLocation(RowLocation templateLocation)
     Fetch the location of the current position in the scan.
public  booleanfetchNext(DataValueDescriptor[] row)
     Fetch the row at the next position of the Scan. If there is a valid next position in the scan then the value in the template storable row is replaced with the value of the row at the current scan position.
public  intfetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array)
     Fetch the next N rows from the table.

The client allocates an array of N rows and passes it into the fetchNextSet() call.

public  intfetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] old_rowloc_array, RowLocation[] new_rowloc_array)
    
abstract protected  intfetchRows(BTreeRowPosition pos, DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers)
     Fetch the next N rows from the table.
public  voidfetchSet(long max_rowcnt, int[] key_column_numbers, BackingStoreHashtable hash_table)
     Insert all rows that qualify for the current scan into the input Hash table.
public  voidfetchWithoutQualify(DataValueDescriptor[] row)
     Fetch the row at the current position of the Scan without applying the qualifiers.
public  RecordHandlegetCurrentRecordHandleForDebugging()
    
public  ScanInfogetScanInfo()
     Return ScanInfo object which describes performance of scan.
public  voidinit(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, BTreeLockingPolicy btree_locking_policy, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, BTree conglomerate, LogicalUndo undo, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info)
     Initialize the scan for use.

Any changes to this method may have to be reflected in close as well.

The btree init opens the container (super.init), and stores away the state of the qualifiers.

public  booleanisCurrentPositionDeleted()
     Returns true if the current position of the scan is at a deleted row.
public  booleanisKeyed()
     Return whether this is a keyed conglomerate.
public  RowLocationnewRowLocationTemplate()
     Return a row location object of the correct type to be used in calls to fetchLocation.
public  booleannext()
     Move to the next position in the scan.
protected  voidpositionAtDoneScan(BTreeRowPosition pos)
     Do work necessary to close a scan.

This routine can only be called "inline" from other btree routines, as it counts on the state of the pos to be correct.

Closing a scan from close() must handle long jumps from exceptions where the state of pos may not be correct.

protected  voidpositionAtDoneScanFromClose(BTreeRowPosition pos)
     Do any necessary work to complete the scan.
protected  voidpositionAtNextPage(BTreeRowPosition pos)
     Position scan to 0 slot on next page.

Position to next page, keeping latch on previous page until we have latch on next page.

public  booleanpositionAtRowLocation(RowLocation rLoc)
    
protected  voidpositionAtStartForBackwardScan(BTreeRowPosition pos)
     Position scan at "start" position for a backward scan.

Positions the scan to the slot just after the first record to be returned from the backward scan.

protected  voidpositionAtStartForForwardScan(BTreeRowPosition pos)
     Position scan at "start" position for a forward scan.

Positions the scan to the slot just before the first record to be returned from the scan.

abstract  voidpositionAtStartPosition(BTreeRowPosition pos)
     Position scan at "start" position.

Positions the scan to the slot just before the first record to be returned from the scan.

protected  booleanprocess_qualifier(DataValueDescriptor[] row)
     process_qualifier - Determine if a row meets all qualifier conditions.

Check all qualifiers in the qualifier array against row.

final public  voidreopenScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator)
     Reposition the current scan.
public  voidreopenScanByRowLocation(RowLocation startRowLocation, Qualifier qualifier)
     Reposition the current scan.
public  booleanreplace(DataValueDescriptor[] row, FormatableBitSet validColumns)
     Replace the entire row at the current position of the scan.
protected  booleanreposition(BTreeRowPosition pos, boolean missing_row_for_key_ok)
     Reposition the scan leaving and reentering the access layer.

When a scan leaves access it saves the RecordHandle of the record on the page.

public  voidsavePosition(Conglomerate conglom, Page page)
     Do work necessary to maintain the current position in the scan.
public  StringtoString()
    

Field Detail
SCAN_DONE
final protected static int SCAN_DONE(Code)



SCAN_HOLD_INIT
final protected static int SCAN_HOLD_INIT(Code)



SCAN_HOLD_INPROGRESS
final protected static int SCAN_HOLD_INPROGRESS(Code)



SCAN_INIT
final protected static int SCAN_INIT(Code)



SCAN_INPROGRESS
final protected static int SCAN_INPROGRESS(Code)



fetchNext_one_slot_array
protected DataValueDescriptor[][] fetchNext_one_slot_array(Code)
A 1 element array to turn fetchNext and fetch calls into fetchNextGroup calls.



init_fetchDesc
protected FetchDescriptor init_fetchDesc(Code)
The fetch descriptor which describes the row to be returned by the scan.



init_forUpdate
protected boolean init_forUpdate(Code)



init_hold
protected boolean init_hold(Code)



init_lock_fetch_desc
protected FetchDescriptor init_lock_fetch_desc(Code)
A constant FetchDescriptor which describes the position of the RowLocation field within the btree, currently always the last column). Used by lock/unlock to fetch the RowLocation. Only needs to be allocated once per scan.



init_qualifier
protected Qualifier init_qualifier(Code)



init_rawtran
protected Transaction init_rawtran(Code)
init_startKeyValue, init_qualifier, and init_stopKeyValue all are used to store * references to the values passed in when ScanController.init() is called. It is assumed that these are not altered by the client while the scan is active.



init_scanColumnList
protected FormatableBitSet init_scanColumnList(Code)



init_startKeyValue
protected DataValueDescriptor[] init_startKeyValue(Code)



init_startSearchOperator
protected int init_startSearchOperator(Code)



init_stopKeyValue
protected DataValueDescriptor[] init_stopKeyValue(Code)



init_stopSearchOperator
protected int init_stopSearchOperator(Code)



init_template
protected DataValueDescriptor[] init_template(Code)



init_useUpdateLocks
protected boolean init_useUpdateLocks(Code)
Whether the scan should requests UPDATE locks which then will be converted to X locks when the actual operation is performed.



lock_operation
protected int lock_operation(Code)
What kind of row locks to get during the scan.



scan_position
BTreeRowPosition scan_position(Code)



scan_state
protected int scan_state(Code)
Delay positioning the table at the start position until the first next() call. The initial position is done in positionAtStartPosition().



stat_numdeleted_rows_visited
protected int stat_numdeleted_rows_visited(Code)



stat_numpages_visited
protected int stat_numpages_visited(Code)
Performance counters ...



stat_numrows_qualified
protected int stat_numrows_qualified(Code)



stat_numrows_visited
protected int stat_numrows_visited(Code)




Constructor Detail
BTreeScan
public BTreeScan()(Code)




Method Detail
close
public void close() throws StandardException(Code)
Close the scan.



closeForEndTransaction
public boolean closeForEndTransaction(boolean closeHeldScan) throws StandardException(Code)
Close the scan, a commit or abort is about to happen.



delete
public boolean delete() throws StandardException(Code)
Delete the row at the current position of the scan.
See Also:   ScanController.delete
exception:
  StandardException - Standard exception policy.



didNotQualify
public void didNotQualify() throws StandardException(Code)
A call to allow client to indicate that current row does not qualify.

Indicates to the ScanController that the current row does not qualify for the scan. If the isolation level of the scan allows, this may result in the scan releasing the lock on this row.

Note that some scan implimentations may not support releasing locks on non-qualifying rows, or may delay releasing the lock until sometime later in the scan (ie. it may be necessary to keep the lock until either the scan is repositioned on the next row or page).

This call should only be made while the scan is positioned on a current valid row.
exception:
  StandardException - Standard exception policy.




doesCurrentPositionQualify
public boolean doesCurrentPositionQualify() throws StandardException(Code)
Returns true if the current position of the scan still qualifies under the set of qualifiers passed to the openScan(). When called this routine will reapply all qualifiers against the row currently positioned and return true if the row still qualifies. If the row has been deleted or no longer passes the qualifiers then this routine will return false.

This case can come about if the current scan or another scan on the same table in the same transaction deleted the row or changed columns referenced by the qualifier after the next() call which positioned the scan at this row.

Note that for comglomerates which don't support update, like btree's, there is no need to recheck the qualifiers.

The results of a fetch() performed on a scan positioned on a deleted row are undefined.


exception:
  StandardException - Standard exception policy.




fetch
public void fetch(DataValueDescriptor[] row) throws StandardException(Code)
Fetch the row at the current position of the Scan.
See Also:   ScanController.fetch
exception:
  StandardException - Standard exception policy.



fetchLocation
public void fetchLocation(RowLocation templateLocation) throws StandardException(Code)
Fetch the location of the current position in the scan.
See Also:   ScanController.fetchLocation
exception:
  StandardException - Standard exception policy.



fetchNext
public boolean fetchNext(DataValueDescriptor[] row) throws StandardException(Code)
Fetch the row at the next position of the Scan. If there is a valid next position in the scan then the value in the template storable row is replaced with the value of the row at the current scan position. The columns of the template row must be of the same type as the actual columns in the underlying conglomerate. The resulting contents of templateRow after a fetchNext() which returns false is undefined. The result of calling fetchNext(row) is exactly logically equivalent to making a next() call followed by a fetch(row) call. This interface allows implementations to optimize the 2 calls if possible.
Parameters:
  row - The template row into which the valueof the next position in the scan is to be stored. True if there is a next position in the scan,false if there isn't.
exception:
  StandardException - Standard exception policy.



fetchNextGroup
public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] rowloc_array) throws StandardException(Code)
Fetch the next N rows from the table.

The client allocates an array of N rows and passes it into the fetchNextSet() call. This routine does the equivalent of N fetchNext() calls, filling in each of the rows in the array. Locking is performed exactly as if the N fetchNext() calls had been made.

It is up to Access how many rows to return. fetchNextSet() will return how many rows were filled in. If fetchNextSet() returns 0 then the scan is complete, (ie. the scan is in the same state as if fetchNext() had returned false). If the scan is not complete then fetchNext() will return (1 <= row_count <= N).

The current position of the scan is undefined if fetchNextSet() is used (ie. mixing fetch()/fetchNext() and fetchNextSet() calls in a single scan does not work). This is because a fetchNextSet() request for 5 rows from a heap where the first 2 rows qualify, but no other rows qualify will result in the scan being positioned at the end of the table, while if 5 rows did qualify the scan will be positioned on the 5th row.

Qualifiers, start and stop positioning of the openscan are applied just as in a normal scan.

The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description.

Expected usage: // allocate an array of 5 empty row templates DataValueDescriptor[][] row_array = allocate_row_array(5); int row_cnt = 0; scan = openScan(); while ((row_cnt = scan.fetchNextSet(row_array) != 0) { // I got "row_cnt" rows from the scan. These rows will be // found in row_array[0] through row_array[row_cnt - 1] }

RESOLVE - This interface is being provided so that we can prototype the performance results it can achieve. If it looks like this interface is useful, it is very likely we will look into a better way to tie together the now 4 different fetch interfaces: fetch, fetchNext(), fetchNextGroup(), and fetchSet(). The number of qualifying rows found and copied into the provided array of rows. If 0 then the scan is complete, otherwise the return value will be: 1 <= row_count <= row_array.length
Parameters:
  row_array - The array of rows to copy rows into. row_array[].length must >= 1. This routineassumes that all entries in the array contain complete template rows.
exception:
  StandardException - Standard exception policy.




fetchNextGroup
public int fetchNextGroup(DataValueDescriptor[][] row_array, RowLocation[] old_rowloc_array, RowLocation[] new_rowloc_array) throws StandardException(Code)



fetchRows
abstract protected int fetchRows(BTreeRowPosition pos, DataValueDescriptor[][] row_array, RowLocation[] rowloc_array, BackingStoreHashtable hash_table, long max_rowcnt, int[] key_column_numbers) throws StandardException(Code)
Fetch the next N rows from the table.

Utility routine used by both fetchSet() and fetchNextGroup().
exception:
  StandardException - Standard exception policy.




fetchSet
public void fetchSet(long max_rowcnt, int[] key_column_numbers, BackingStoreHashtable hash_table) throws StandardException(Code)
Insert all rows that qualify for the current scan into the input Hash table.

This routine scans executes the entire scan as described in the openScan call. For every qualifying unique row value an entry is placed into the HashTable. For unique row values the entry in the BackingStoreHashtable has a key value of the object stored in row[key_column_number], and the value of the data is row. For row values with duplicates, the key value is also row[key_column_number], but the value of the data is a Vector of rows. The caller will have to call "instanceof" on the data value object if duplicates are expected, to determine if the data value of the Hashtable entry is a row or is a Vector of rows.

Note, that for this routine to work efficiently the caller must ensure that the object in row[key_column_number] implements the hashCode and equals method as appropriate for it's datatype.

It is expected that this call will be the first and only call made in an openscan. Qualifiers and stop position of the openscan are applied just as in a normal scan. This call is logically equivalent to the caller performing the following: import java.util.Hashtable; hash_table = new Hashtable(); while (next()) { row = create_new_row(); fetch(row); if ((duplicate_value = hash_table.put(row[key_column_number], row)) != null) { Vector row_vec; // inserted a duplicate if ((duplicate_value instanceof vector)) { row_vec = (Vector) duplicate_value; } else { // allocate vector to hold duplicates row_vec = new Vector(2); // insert original row into vector row_vec.addElement(duplicate_value); // put the vector as the data rather than the row hash_table.put(row[key_column_number], row_vec); } // insert new row into vector row_vec.addElement(row); } }

The columns of the row will be the standard columns returned as part of a scan, as described by the validColumns - see openScan for description. RESOLVE - is this ok? or should I hard code somehow the row to be the first column and the row location?

Currently it is only possible to hash on the first column in the conglomerate, in the future we may change the interface to allow hashing either on a different column or maybe on a combination of columns.

No overflow to external storage is provided, so calling this routine on a 1 gigabyte conglomerate will incur at least 1 gigabyte of memory (probably failing with a java out of memory condition). If this routine gets an out of memory condition, or if "max_rowcnt" is exceeded then then the routine will give up, empty the Hashtable, and return "false."

On exit from this routine, whether the fetchSet() succeeded or not the scan is complete, it is positioned just the same as if the scan had been drained by calling "next()" until it returns false (ie. fetchNext() and next() calls will return false). reopenScan() can be called to restart the scan.

RESOLVE - until we get row counts what should we do for sizing the the size, capasity, and load factor of the hash table. For now it is up to the caller to create the Hashtable, Access does not reset any parameters.

RESOLVE - I am not sure if access should be in charge of allocating the new row objects. I know that I can do this in the case of btree's, but I don't think I can do this in heaps. Maybe this is solved by work to be done on the sort interface.
Parameters:
  max_rowcnt - The maximum number of rows to insert into the Hash table. Pass in -1 if there is no maximum.
Parameters:
  key_column_numbers - The column numbers of the columns in thescan result row to be the key to the Hashtable."0" is the first column in the scan resultrow (which may be different than the firstcolumn in the row in the table of the scan).
Parameters:
  hash_table - The java HashTable to load into.
exception:
  StandardException - Standard exception policy.




fetchWithoutQualify
public void fetchWithoutQualify(DataValueDescriptor[] row) throws StandardException(Code)
Fetch the row at the current position of the Scan without applying the qualifiers.
See Also:   ScanController.fetchWithoutQualify
exception:
  StandardException - Standard exception policy.



getCurrentRecordHandleForDebugging
public RecordHandle getCurrentRecordHandleForDebugging()(Code)



getScanInfo
public ScanInfo getScanInfo() throws StandardException(Code)
Return ScanInfo object which describes performance of scan.

Return ScanInfo object which contains information about the current scan.


See Also:   ScanInfo The ScanInfo object which contains info about current scan.
exception:
  StandardException - Standard exception policy.




init
public void init(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, BTreeLockingPolicy btree_locking_policy, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, BTree conglomerate, LogicalUndo undo, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException(Code)
Initialize the scan for use.

Any changes to this method may have to be reflected in close as well.

The btree init opens the container (super.init), and stores away the state of the qualifiers. The actual searching for the first position is delayed until the first next() call.
exception:
  StandardException - Standard exception policy.




isCurrentPositionDeleted
public boolean isCurrentPositionDeleted() throws StandardException(Code)
Returns true if the current position of the scan is at a deleted row. This case can come about if the current scan or another scan on the same table in the same transaction deleted the row after the next() call which positioned the scan at this row. The results of a fetch() performed on a scan positioned on a deleted row are undefined.
exception:
  StandardException - Standard exception policy.



isKeyed
public boolean isKeyed()(Code)
Return whether this is a keyed conglomerate.

whether this is a keyed conglomerate.




newRowLocationTemplate
public RowLocation newRowLocationTemplate() throws StandardException(Code)
Return a row location object of the correct type to be used in calls to fetchLocation.
See Also:   GenericScanController.newRowLocationTemplate
exception:
  StandardException - Standard exception policy.



next
public boolean next() throws StandardException(Code)
Move to the next position in the scan.
See Also:   ScanController.next
exception:
  StandardException - Standard exception policy.



positionAtDoneScan
protected void positionAtDoneScan(BTreeRowPosition pos) throws StandardException(Code)
Do work necessary to close a scan.

This routine can only be called "inline" from other btree routines, as it counts on the state of the pos to be correct.

Closing a scan from close() must handle long jumps from exceptions where the state of pos may not be correct. The easiest case is a lock timeout which has caused us not to have a latch on a page, but pos still thinks there is a latch. This is the easiest but other exceptions can also caused the same state at close() time.




positionAtDoneScanFromClose
protected void positionAtDoneScanFromClose(BTreeRowPosition pos) throws StandardException(Code)
Do any necessary work to complete the scan.
Parameters:
  pos - current row position of the scan.
exception:
  StandardException - Standard exception policy.



positionAtNextPage
protected void positionAtNextPage(BTreeRowPosition pos) throws StandardException(Code)
Position scan to 0 slot on next page.

Position to next page, keeping latch on previous page until we have latch on next page. This routine releases the latch on current_page once it has successfully gotten both the latch on the next page and the scan lock on the next page.
Parameters:
  pos - current row position of the scan.
exception:
  StandardException - Standard exception policy.




positionAtRowLocation
public boolean positionAtRowLocation(RowLocation rLoc) throws StandardException(Code)

See Also:   ScanController.positionAtRowLocation
See Also:   Not implemented for this class



positionAtStartForBackwardScan
protected void positionAtStartForBackwardScan(BTreeRowPosition pos) throws StandardException(Code)
Position scan at "start" position for a backward scan.

Positions the scan to the slot just after the first record to be returned from the backward scan. Returns the start page latched, and sets "current_slot" to the slot number just right of the first slot to return.


exception:
  StandardException - Standard exception policy.




positionAtStartForForwardScan
protected void positionAtStartForForwardScan(BTreeRowPosition pos) throws StandardException(Code)
Position scan at "start" position for a forward scan.

Positions the scan to the slot just before the first record to be returned from the scan. Returns the start page latched, and sets "current_slot" to the slot number.


exception:
  StandardException - Standard exception policy.




positionAtStartPosition
abstract void positionAtStartPosition(BTreeRowPosition pos) throws StandardException(Code)
Position scan at "start" position.

Positions the scan to the slot just before the first record to be returned from the scan. Returns the start page latched, and sets "current_slot" to the slot number.
exception:
  StandardException - Standard exception policy.




process_qualifier
protected boolean process_qualifier(DataValueDescriptor[] row) throws StandardException(Code)
process_qualifier - Determine if a row meets all qualifier conditions.

Check all qualifiers in the qualifier array against row. Return true if all compares specified by the qualifier array return true, else return false.

It is up to caller to make sure qualifier list is non-null.
Parameters:
  row - The row with the same partial column list as therow returned by the current scan.
exception:
  StandardException - Standard exception policy.




reopenScan
final public void reopenScan(DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator) throws StandardException(Code)
Reposition the current scan. This call is semantically the same as if the current scan had been closed and a openScan() had been called instead. The scan is reopened with against the same conglomerate, and the scan is reopened with the same "hold" and "forUpdate" parameters passed in the original openScan. The previous template row continues to be used.
Parameters:
  startKeyValue - An indexable row which holds a(partial) key value which, in combination with thestartSearchOperator, defines the starting position ofthe scan. If null, the starting position of the scanis the first row of the conglomerate.
Parameters:
  startSearchOperator - an operator which defineshow the startKeyValue is to be searched for. IfstartSearchOperation is ScanController.GE, the scan starts onthe first row which is greater than or equal to thestartKeyValue. If startSearchOperation is ScanController.GT,the scan starts on the first row whose key is greater thanstartKeyValue. The startSearchOperation parameter isignored if the startKeyValue parameter is null.
Parameters:
  qualifier - An array of qualifiers which, appliedto each key, restrict the rows returned by the scan. Rowsfor which any one of the qualifiers returns false are notreturned by the scan. If null, all rows are returned.
Parameters:
  stopKeyValue - An indexable row which holds a(partial) key value which, in combination with thestopSearchOperator, defines the ending position ofthe scan. If null, the ending position of the scanis the last row of the conglomerate.
Parameters:
  stopSearchOperator - an operator which defineshow the stopKeyValue is used to determine the scan stoppingposition. If stopSearchOperation is ScanController.GE, the scanstops just before the first row which is greater than orequal to the stopKeyValue. If stopSearchOperation isScanController.GT, the scan stops just before the first row whosekey is greater than startKeyValue. The stopSearchOperationparameter is ignored if the stopKeyValue parameter is null.
exception:
  StandardException - Standard exception policy.



reopenScanByRowLocation
public void reopenScanByRowLocation(RowLocation startRowLocation, Qualifier qualifier) throws StandardException(Code)
Reposition the current scan. This call is semantically the same as if the current scan had been closed and a openScan() had been called instead. The scan is reopened against the same conglomerate, and the scan is reopened with the same "scan column list", "hold" and "forUpdate" parameters passed in the original openScan.

The statistics gathered by the scan are not reset to 0 by a reopenScan(), rather they continue to accumulate.

Note that this operation is currently only supported on Heap conglomerates. Also note that order of rows within are heap are not guaranteed, so for instance positioning at a RowLocation in the "middle" of a heap, then inserting more data, then continuing the scan is not guaranteed to see the new rows - they may be put in the "beginning" of the heap.
Parameters:
  startRowLocation - An existing RowLocation within the conglomerate,at which to position the start of the scan. The scan will begin at thislocation and continue forward until the end of the conglomerate. Positioning at a non-existent RowLocation (ie. an invalid one or one thathad been deleted), will result in an exception being thrown when the first next operation is attempted.
Parameters:
  qualifier - An array of qualifiers which, appliedto each key, restrict the rows returned by the scan. Rowsfor which any one of the qualifiers returns false are notreturned by the scan. If null, all rows are returned.
exception:
  StandardException - Standard exception policy.




replace
public boolean replace(DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException(Code)
Replace the entire row at the current position of the scan. Unimplemented interface by btree, will throw an exception.
See Also:   ScanController.replace
exception:
  StandardException - Standard exception policy.



reposition
protected boolean reposition(BTreeRowPosition pos, boolean missing_row_for_key_ok) throws StandardException(Code)
Reposition the scan leaving and reentering the access layer.

When a scan leaves access it saves the RecordHandle of the record on the page. There are 2 cases to consider when trying to reposition the scan when re-entering access: o ROW has not moved off the page. If the row has not moved then the RecordHandle we have saved away is valid, and we just call RawStore to reposition on that RecordHandle (RawStore takes care of the row moving within the page). o ROW has moved off the page. This can only happen in the case of a btree split. In that case the splitter will have caused all scans positioned on this page within the same transaction to save a copy of the row that the scan was positioned on. Then to reposition the scan it is necessary to research the tree from the top using the copy of the row. If the scan has saved it's position by key (and thus has given up the scan lock on the page), there are a few cases where it is possible that the key no longer exists in the table. In the case of a scan held open across commit it is easy to imagine that the row the scan was positioned on could be deleted and subsequently purged from the table all before the scan resumes. Also in the case of read uncommitted the scan holds no lock on the current row, so it could be purged - in the following scenario for instance: read uncommitted transaction 1 opens scan and positions on row (1,2), transaction 2 deletes (1,2) and commits, transaction 1 inserts (1,3) which goes to same page as (1,2) and is going to cause a split, transaction 1 saves scan position as key, gives up scan lock and then purges row (1, 2), when transaction 1 resumes scan (1, 2) no longer exists. missing_row_for_key_ok parameter is added as a sanity check to make sure it ok that repositioning does not go to same row that we were repositioned on.
Parameters:
  pos - position to set the scan to.
Parameters:
  missing_row_for_key_ok - if true and exact key is not found thenscan is just set to key just left ofthe key (thus a next will move to thekey just after "pos") returns true if scan has been repositioned successfully, elsereturns false if the position key could not be found andmissing_row_for_key_ok was false indicating that scan couldonly be positioned on the exact key match.
exception:
  StandardException - Standard exception policy.




savePosition
public void savePosition(Conglomerate conglom, Page page) throws StandardException(Code)
Do work necessary to maintain the current position in the scan.

The latched page in the conglomerate "congomid" is changing, do whatever is necessary to maintain the current position of the scan. For some conglomerates this may be a no-op.


Parameters:
  conglom - Conglomerate object of the conglomerate being changed.
Parameters:
  page - Page in the conglomerate being changed.
exception:
  StandardException - Standard exception policy.




toString
public String toString()(Code)



Fields inherited from org.apache.derby.impl.store.access.btree.OpenBTree
protected LogicalUndo btree_undo(Code)(Java Doc)
protected ContainerHandle container(Code)(Java Doc)
protected long err_containerid(Code)(Java Doc)
protected int init_lock_level(Code)(Java Doc)
protected TransactionManager init_open_user_scans(Code)(Java Doc)
protected OpenConglomerateScratchSpace runtime_mem(Code)(Java Doc)

Methods inherited from org.apache.derby.impl.store.access.btree.OpenBTree
public void checkConsistency() throws StandardException(Code)(Java Doc)
public void close() throws StandardException(Code)(Java Doc)
public void debugConglomerate() throws StandardException(Code)(Java Doc)
public boolean[] getColumnSortOrderInfo() throws StandardException(Code)(Java Doc)
final public BTree getConglomerate()(Code)(Java Doc)
final public ContainerHandle getContainer()(Code)(Java Doc)
public ContainerHandle getContainerHandle()(Code)(Java Doc)
public long getEstimatedRowCount() throws StandardException(Code)(Java Doc)
public int getHeight() throws StandardException(Code)(Java Doc)
final public boolean getHold()(Code)(Java Doc)
final public int getLockLevel()(Code)(Java Doc)
final public BTreeLockingPolicy getLockingPolicy()(Code)(Java Doc)
final public int getOpenMode()(Code)(Java Doc)
final public Transaction getRawTran()(Code)(Java Doc)
final public OpenConglomerateScratchSpace getRuntimeMem()(Code)(Java Doc)
public SpaceInfo getSpaceInfo() throws StandardException(Code)(Java Doc)
final public TransactionManager getXactMgr()(Code)(Java Doc)
public void init(TransactionManager open_user_scans, TransactionManager xact_manager, ContainerHandle input_container, Transaction rawtran, boolean hold, int open_mode, int lock_level, BTreeLockingPolicy btree_locking_policy, BTree conglomerate, LogicalUndo undo, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException(Code)(Java Doc)
final public boolean isClosed()(Code)(Java Doc)
void isIndexableRowConsistent(DataValueDescriptor[] row) throws StandardException(Code)(Java Doc)
public boolean isTableLocked()(Code)(Java Doc)
public RecordHandle makeRecordHandle(long page_number, int rec_id) throws StandardException(Code)(Java Doc)
public ContainerHandle reopen() throws StandardException(Code)(Java Doc)
public void setEstimatedRowCount(long count) throws StandardException(Code)(Java Doc)
final public void setLockingPolicy(BTreeLockingPolicy policy)(Code)(Java Doc)
public static boolean test_errors(OpenBTree open_btree, String debug_string, boolean release_scan_lock, BTreeLockingPolicy btree_locking_policy, LeafControlRow leaf, boolean input_latch_released) throws StandardException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

w___w__w.___j_a_v__a_2s__.__c__om_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.