📄 ramtransaction.java
字号:
{ // in the current implementation, only Conglomerate's are passed around // as StaticCompiledOpenConglomInfo. if (SanityManager.DEBUG) { SanityManager.ASSERT(static_info != null); SanityManager.ASSERT(dynamic_info != null); SanityManager.ASSERT( static_info instanceof StaticCompiledOpenConglomInfo); SanityManager.ASSERT( dynamic_info instanceof DynamicCompiledOpenConglomInfo); } return( openScan( ((Conglomerate) static_info.getConglom()), hold, open_mode, lock_level, isolation_level, scanColumnList, startKeyValue, startSearchOperator, qualifier, stopKeyValue, stopSearchOperator, static_info, dynamic_info)); } /** * Return an open StoreCostController for the given conglomid. * <p> * Return an open StoreCostController which can be used to ask about * the estimated row counts and costs of ScanController and * ConglomerateController operations, on the given conglomerate. * <p> * * @return The open StoreCostController. * * @param conglomId The identifier of the conglomerate to open. * * @exception StandardException Standard exception policy. * * @see StoreCostController **/ public StoreCostController openStoreCost( long conglomId) throws StandardException { // Find the conglomerate. Conglomerate conglom = findExistingConglomerate(conglomId); // Get a scan controller. StoreCostController scc = conglom.openStoreCost(this, rawtran); return(scc); } /** @see TransactionController#createSort @exception StandardException Standard error policy. **/ public long createSort( Properties implParameters, DataValueDescriptor[] template, ColumnOrdering columnOrdering[], SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int estimatedRowSize) throws StandardException { // Get the implementation type from the parameters. // XXX (nat) need to figure out how to select sort implementation. String implementation = null; if (implParameters != null) implementation = implParameters.getProperty(AccessFactoryGlobals.IMPL_TYPE); if (implementation == null) implementation = AccessFactoryGlobals.SORT_EXTERNAL; // Find the appropriate factory for the desired implementation. MethodFactory mfactory; mfactory = accessmanager.findMethodFactoryByImpl(implementation); if (mfactory == null || !(mfactory instanceof SortFactory)) { throw( StandardException.newException( SQLState.AM_NO_FACTORY_FOR_IMPLEMENTATION, implementation)); } SortFactory sfactory = (SortFactory) mfactory; // Decide what segment the sort should use. int segment = 0; // XXX (nat) sorts always in segment 0 // Create the sort. Sort sort = sfactory.createSort(this, segment, implParameters, template, columnOrdering, sortObserver, alreadyInOrder, estimatedRows, estimatedRowSize); // Add the sort to the sorts vector if (sorts == null) sorts = new Vector(); long sortid = sorts.size(); sorts.addElement(sort); return sortid; } /** Drop a sort. <p> Drop a sort created by a call to createSort() within the current transaction (sorts are automatically "dropped" at the end of a transaction. This call should only be made after all openSortScan()'s and openSort()'s have been closed. <p> @param sortid The identifier of the sort to drop, as returned from createSort. @exception StandardException From a lower-level exception. **/ public void dropSort(long sortid) throws StandardException { // should call close on the sort. Sort sort = (Sort) sorts.elementAt((int) sortid); if (sort != null) { sort.drop(this); sorts.setElementAt(null, (int) sortid); } } /** @see TransactionController#getProperty @exception StandardException Standard exception policy. **/ public Serializable getProperty( String key) throws StandardException { return (accessmanager.getTransactionalProperties().getProperty(this, key)); } /** @see TransactionController#getPropertyDefault @exception StandardException Standard exception policy. **/ public Serializable getPropertyDefault( String key) throws StandardException { return (accessmanager.getTransactionalProperties().getPropertyDefault(this, key)); } /** @see TransactionController#setProperty @exception StandardException Standard exception policy. **/ public void setProperty( String key, Serializable value, boolean dbOnlyProperty) throws StandardException { accessmanager.getTransactionalProperties().setProperty( this, key, value, dbOnlyProperty); } /** @see TransactionController#setProperty @exception StandardException Standard exception policy. **/ public void setPropertyDefault( String key, Serializable value) throws StandardException { accessmanager.getTransactionalProperties().setPropertyDefault( this, key, value); } /** @see TransactionController#propertyDefaultIsVisible @exception StandardException Standard exception policy. **/ public boolean propertyDefaultIsVisible(String key) throws StandardException { return accessmanager.getTransactionalProperties().propertyDefaultIsVisible(this,key); } /** @see TransactionController#getProperties @exception StandardException Standard exception policy. **/ public Properties getProperties() throws StandardException { return accessmanager.getTransactionalProperties().getProperties(this); } /** @see TransactionController#openSort @exception StandardException Standard error policy. **/ public SortController openSort(long id) throws StandardException { Sort sort; // Find the sort in the sorts list, throw an error // if it doesn't exist. if (sorts == null || id >= sorts.size() || (sort = ((Sort) sorts.elementAt((int) id))) == null) { throw StandardException.newException( SQLState.AM_NO_SUCH_SORT, new Long(id)); } // Open it. SortController sc = sort.open(this); // Keep track of it so we can release on close. if (sortControllers == null) sortControllers = new Vector(); sortControllers.addElement(sc); return sc; } /** * Return an open SortCostController. * <p> * Return an open SortCostController which can be used to ask about * the estimated costs of SortController() operations. * <p> * * @return The open StoreCostController. * * @exception StandardException Standard exception policy. * * @see StoreCostController **/ public SortCostController openSortCostController( Properties implParameters) throws StandardException { // Get the implementation type from the parameters. // RESOLVE (mikem) need to figure out how to select sort implementation. String implementation = null; if (implementation == null) implementation = AccessFactoryGlobals.SORT_EXTERNAL; // Find the appropriate factory for the desired implementation. MethodFactory mfactory; mfactory = accessmanager.findMethodFactoryByImpl(implementation); if (mfactory == null || !(mfactory instanceof SortFactory)) { throw( StandardException.newException( SQLState.AM_NO_FACTORY_FOR_IMPLEMENTATION, implementation)); } SortFactory sfactory = (SortFactory) mfactory; // open sort cost controller return(sfactory.openSortCostController()); } /** @see TransactionController#openSortScan @exception StandardException Standard error policy. **/ public ScanController openSortScan( long id, boolean hold) throws StandardException { Sort sort; // Find the sort in the sorts list, throw an error // if it doesn't exist. if (sorts == null || id >= sorts.size() || (sort = ((Sort) sorts.elementAt((int) id))) == null) { throw StandardException.newException( SQLState.AM_NO_SUCH_SORT, new Long(id)); } // Open a scan on it. ScanController sc = sort.openSortScan(this, hold); // Keep track of it so we can release on close. scanControllers.addElement(sc); return sc; } /** @see TransactionController#openSortRowSource @exception StandardException Standard error policy. **/ public RowLocationRetRowSource openSortRowSource(long id) throws StandardException { Sort sort; // Find the sort in the sorts list, throw an error // if it doesn't exist. if (sorts == null || id >= sorts.size() || (sort = ((Sort) sorts.elementAt((int) id))) == null) { throw StandardException.newException( SQLState.AM_NO_SUCH_SORT, new Long(id)); } // Open a scan row source on it. ScanControllerRowSource sc = sort.openSortRowSource(this); // Keep track of it so we can release on close. scanControllers.addElement(sc); return sc; } public void commit() throws StandardException { this.closeControllers(false /* don't close held controllers */ ); rawtran.commit(); alterTableCallMade = false; return; } public DatabaseInstant commitNoSync(int commitflag) throws StandardException { this.closeControllers(false /* don't close held controllers */ ); return rawtran.commitNoSync(commitflag); } public void abort() throws StandardException { if (alterTableCallMade) { accessmanager.conglomCacheInvalidate(); alterTableCallMade = false; } this.closeControllers(true /* close all controllers */ ); rawtran.abort(); if (parent_tran != null) parent_tran.abort(); } /** * Get the context manager that the transaction was created with. * <p> * * @return The context manager that the transaction was created with. * **/ public ContextManager getContextManager() { return(context.getContextManager()); } public int setSavePoint(String name, Object kindOfSavepoint) throws StandardException { return rawtran.setSavePoint(name, kindOfSavepoint); } public int releaseSavePoint(String name, Object kindOfSavepoint) throws StandardException { return rawtran.releaseSavePoint(name, kindOfSavepoint); } public int rollbackToSavePoint(String name, boolean close_controllers, Object kindOfSavepoint) throws StandardException { if (close_controllers) this.closeControllers(true /* close all controllers */ ); return rawt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -