1 21 22 package org.apache.derby.impl.store.access.btree; 23 24 import org.apache.derby.iapi.store.access.ScanInfo; 25 26 import org.apache.derby.iapi.error.StandardException; 27 28 import org.apache.derby.iapi.reference.SQLState; 29 30 import org.apache.derby.iapi.services.io.FormatableBitSet; 31 import org.apache.derby.iapi.services.i18n.MessageService; 32 import java.util.Properties ; 33 34 43 class BTreeScanInfo implements ScanInfo 44 { 45 48 private int stat_numpages_visited = 0; 49 private int stat_numrows_visited = 0; 50 private int stat_numrows_qualified = 0; 51 private int stat_numdeleted_rows_visited = 0; 52 private int stat_numColumnsFetched = 0; 53 private int stat_treeHeight = 0; 54 private FormatableBitSet stat_validColumns = null; 55 56 57 BTreeScanInfo(BTreeScan scan) 58 { 59 stat_numpages_visited = scan.stat_numpages_visited; 61 stat_numrows_visited = scan.stat_numrows_visited; 62 stat_numrows_qualified = scan.stat_numrows_qualified; 63 stat_numdeleted_rows_visited = scan.stat_numdeleted_rows_visited; 64 65 stat_validColumns = 66 (scan.init_scanColumnList == null ? 67 null : ((FormatableBitSet) scan.init_scanColumnList.clone())); 68 69 if (stat_validColumns == null) 70 { 71 stat_numColumnsFetched = scan.init_template.length; 72 } 73 else 74 { 75 for (int i = 0; i < stat_validColumns.size(); i++) 76 { 77 if (stat_validColumns.get(i)) 78 stat_numColumnsFetched++; 79 } 80 } 81 82 try 83 { 84 stat_treeHeight = scan.getHeight(); 85 } 86 catch (Throwable t) 87 { 88 stat_treeHeight = -1; 89 } 90 } 91 92 131 public Properties getAllScanInfo(Properties prop) 132 throws StandardException 133 { 134 if (prop == null) 135 prop = new Properties (); 136 137 prop.put( 138 MessageService.getTextMessage(SQLState.STORE_RTS_SCAN_TYPE), 139 MessageService.getTextMessage(SQLState.STORE_RTS_BTREE)); 140 prop.put( 141 MessageService.getTextMessage(SQLState.STORE_RTS_NUM_PAGES_VISITED), 142 Integer.toString(stat_numpages_visited)); 143 prop.put( 144 MessageService.getTextMessage(SQLState.STORE_RTS_NUM_ROWS_VISITED), 145 Integer.toString(stat_numrows_visited)); 146 prop.put( 147 MessageService.getTextMessage( 148 SQLState.STORE_RTS_NUM_DELETED_ROWS_VISITED), 149 Integer.toString(stat_numdeleted_rows_visited)); 150 prop.put( 151 MessageService.getTextMessage( 152 SQLState.STORE_RTS_NUM_ROWS_QUALIFIED), 153 Integer.toString(stat_numrows_qualified)); 154 prop.put( 155 MessageService.getTextMessage( 156 SQLState.STORE_RTS_TREE_HEIGHT), 157 Integer.toString(stat_treeHeight)); 158 prop.put( 159 MessageService.getTextMessage( 160 SQLState.STORE_RTS_NUM_COLUMNS_FETCHED), 161 Integer.toString(stat_numColumnsFetched)); 162 prop.put( 163 MessageService.getTextMessage( 164 SQLState.STORE_RTS_COLUMNS_FETCHED_BIT_SET), 165 (stat_validColumns == null ? 166 MessageService.getTextMessage( 167 SQLState.STORE_RTS_ALL) : 168 stat_validColumns.toString())); 169 170 return(prop); 171 } 172 } 173 | Popular Tags |