📄 genericconglomeratecontroller.java
字号:
if (!open_conglom.latchPage(pos)) { return(false); } // Do not get U row lock - only get X or S. There is no good point // currently to convert the U lock to an S lock, we don't know when // the calling code is through with the lock. // RESOLVE (mikem) - talk to language and see if it is worth it to // get U lock and have language call back when we should take // appropriate action on the U lock. if (open_conglom.isForUpdate()) { open_conglom.lockPositionForWrite( pos, false /* not an insert */, true); } else { open_conglom.lockPositionForRead( pos, (RowPosition) null, false, true); } // Fetch the row. // RESOLVE (STO061) - don't know whether the fetch is for update or not. // // RESOLVE (mikem) - get rid of new here. boolean ret_val = (pos.current_page.fetchFromSlot( pos.current_rh, pos.current_slot, row, new FetchDescriptor( row.length, validColumns, (Qualifier[][]) null), false) != null); // RESOLVE (mikem) - should be some way to hide this in the unlock call, // and just always make the unlock call. if (!open_conglom.isForUpdate()) open_conglom.unlockPositionAfterRead(pos); pos.current_page.unlatch(); return(ret_val); } /** * @see ConglomerateController#fetch **/ public boolean fetch( RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns, boolean waitForLock) throws StandardException { if (open_conglom.isClosed()) { if (open_conglom.getHold()) { if (open_conglom.isClosed()) open_conglom.reopen(); } else { throw( StandardException.newException( SQLState.HEAP_IS_CLOSED, open_conglom.getConglomerate().getId())); } } if (SanityManager.DEBUG) { // Make sure valid columns are in the list. The RowUtil // call is too expensive to make in a released system for // every fetch. int invalidColumn = RowUtil.columnOutOfRange( row, validColumns, open_conglom.getFormatIds().length); if (invalidColumn >= 0) { throw(StandardException.newException( SQLState.HEAP_TEMPLATE_MISMATCH, new Long(invalidColumn), new Long(open_conglom.getFormatIds().length))); } } // Get the record handle out of its wrapper. RowPosition pos = new RowPosition(); getRowPositionFromRowLocation(loc, pos); open_conglom.latchPage(pos); // Do not get U row lock - only get X or S. There is not good point // currently to convert the U lock to an S lock, we don't know when // the calling code is through with the lock. // RESOLVE (mikem) - talk to language and see if it is worth it to // get U lock and have language call back when we should take // appropriate action on the U lock. if (open_conglom.isForUpdate()) { open_conglom.lockPositionForWrite( pos, false /* not an insert */, waitForLock); } else { open_conglom.lockPositionForRead( pos, (RowPosition) null, false, waitForLock); } // Fetch the row. // RESOLVE (STO061) - don't know whether the fetch is for update or not. // // // RESOLVE (mikem) - get rid of new here. boolean ret_val = (pos.current_page.fetchFromSlot( pos.current_rh, pos.current_slot, row, new FetchDescriptor( row.length, validColumns, (Qualifier[][]) null), false) != null); // RESOLVE (mikem) - should be some way to hide this in the unlock call, // and just always make the unlock call. if (!open_conglom.isForUpdate()) open_conglom.unlockPositionAfterRead(pos); pos.current_page.unlatch(); return(ret_val); } /** * @see ConglomerateController#replace **/ public boolean replace( RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException { if (open_conglom.isClosed()) { if (open_conglom.getHold()) { if (open_conglom.isClosed()) open_conglom.reopen(); } else { throw( StandardException.newException( SQLState.HEAP_IS_CLOSED, open_conglom.getConglomerate().getId())); } } if (SanityManager.DEBUG) { // Make sure valid columns are in the list. The RowUtil // call is too expensive to make in a released system for // every fetch. int invalidColumn = RowUtil.columnOutOfRange( row, validColumns, open_conglom.getFormatIds().length); if (invalidColumn >= 0) { throw(StandardException.newException( SQLState.HEAP_TEMPLATE_MISMATCH, new Long(invalidColumn), new Long(open_conglom.getFormatIds().length))); } } RowPosition pos = new RowPosition(); getRowPositionFromRowLocation(loc, pos); open_conglom.latchPage(pos); open_conglom.lockPositionForWrite(pos, false, true); boolean ret_val = true; if (pos.current_page.isDeletedAtSlot(pos.current_slot)) { ret_val = false; } else { // Update the record. pos.current_page.updateAtSlot(pos.current_slot, row, validColumns); } pos.current_page.unlatch(); return(ret_val); } /************************************************************************** * Public Methods implementing ConglomerateController - not implemented: ************************************************************************** */ public int insert(DataValueDescriptor[] row) throws StandardException { throw(StandardException.newException( SQLState.HEAP_UNIMPLEMENTED_FEATURE)); } public void insertAndFetchLocation( DataValueDescriptor[] row, RowLocation templateRowLocation) throws StandardException { throw(StandardException.newException( SQLState.HEAP_UNIMPLEMENTED_FEATURE)); } public boolean lockRow( RowLocation loc, int lock_operation, boolean wait, int lock_duration) throws StandardException { throw(StandardException.newException( SQLState.HEAP_UNIMPLEMENTED_FEATURE)); } public boolean lockRow( long page_num, int record_id, int lock_operation, boolean wait, int lock_duration) throws StandardException { throw(StandardException.newException( SQLState.HEAP_UNIMPLEMENTED_FEATURE)); } public void unlockRowAfterRead( RowLocation loc, boolean forUpdate, boolean row_qualifies) throws StandardException { throw(StandardException.newException( SQLState.HEAP_UNIMPLEMENTED_FEATURE)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -