📄 ramtransaction.java
字号:
SQLState.AM_NO_SUCH_CONGLOMERATE_TYPE, implementation); } ConglomerateFactory cfactory = (ConglomerateFactory) mfactory; // Create the conglomerate // RESOLVE (mikem) - eventually segmentid's will be passed into here // in the properties. For now just use 0.] int segment; long conglomid; if ((temporaryFlag & TransactionController.IS_TEMPORARY) == TransactionController.IS_TEMPORARY) { segment = ContainerHandle.TEMPORARY_SEGMENT; conglomid = ContainerHandle.DEFAULT_ASSIGN_ID; } else { segment = 0; // RESOLVE - only using segment 0 conglomid = accessmanager.getNextConglomId( cfactory.getConglomerateFactoryId()); } // call the factory to actually create the conglomerate. Conglomerate conglom = cfactory.createConglomerate( this, segment, conglomid, template, columnOrder, properties, temporaryFlag); long conglomId; if ((temporaryFlag & TransactionController.IS_TEMPORARY) == TransactionController.IS_TEMPORARY) { conglomId = nextTempConglomId--; if (tempCongloms == null) tempCongloms = new Hashtable(); tempCongloms.put(new Long(conglomId), conglom); } else { conglomId = conglom.getContainerid(); accessmanager.conglomCacheAddEntry(conglomId, conglom); } return conglomId; } /** Create a conglomerate and populate it with rows from rowSource. @see TransactionController#createAndLoadConglomerate @exception StandardException Standard Cloudscape Error Policy */ public long createAndLoadConglomerate( String implementation, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, Properties properties, int temporaryFlag, RowLocationRetRowSource rowSource, long[] rowCount) throws StandardException { return( recreateAndLoadConglomerate( implementation, true, template, columnOrder, properties, temporaryFlag, 0 /* unused if recreate_ifempty is true */, rowSource, rowCount)); } /** recreate a conglomerate and populate it with rows from rowSource. @see TransactionController#createAndLoadConglomerate @exception StandardException Standard Cloudscape Error Policy */ public long recreateAndLoadConglomerate( String implementation, boolean recreate_ifempty, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, Properties properties, int temporaryFlag, long orig_conglomId, RowLocationRetRowSource rowSource, long[] rowCount) throws StandardException { // RESOLVE: this create the conglom LOGGED, this is slower than // necessary although still correct. long conglomId = createConglomerate( implementation, template, columnOrder, properties, temporaryFlag); long rows_loaded = loadConglomerate( conglomId, true, // conglom is being created rowSource); if (rowCount != null) rowCount[0] = rows_loaded; if (!recreate_ifempty && (rows_loaded == 0)) { dropConglomerate(conglomId); conglomId = orig_conglomId; } return conglomId; } /** * Return a string with debug information about opened congloms/scans/sorts. * <p> * Return a string with debugging information about current opened * congloms/scans/sorts which have not been close()'d. * Calls to this routine are only valid under code which is conditional * on SanityManager.DEBUG. * <p> * * @return String with debugging information. * * @exception StandardException Standard exception policy. **/ public String debugOpened() throws StandardException { String str = null; if (SanityManager.DEBUG) { Enumeration e; str = new String(); e = scanControllers.elements(); while (e.hasMoreElements()) { ScanController sc = (ScanController) e.nextElement(); str += "open scan controller: " + sc + "\n"; } e = conglomerateControllers.elements(); while (e.hasMoreElements()) { ConglomerateController cc = (ConglomerateController) e.nextElement(); str += "open conglomerate controller: " + cc + "\n"; } if (sortControllers != null) { e = sortControllers.elements(); while (e.hasMoreElements()) { SortController sc = (SortController) e.nextElement(); str += "open sort controller: " + sc + "\n"; } } if (sorts != null) { for (int i = 0; i < sorts.size(); i++) { Sort sort = (Sort) sorts.elementAt(i); if (sort != null) { str += "sorts created by createSort() in current xact:" + sort + "\n"; } } } if (tempCongloms != null) { e = tempCongloms.keys(); while (e.hasMoreElements()) { Long conglomId = (Long) e.nextElement(); Conglomerate c = (Conglomerate) tempCongloms.get(conglomId); str += "temp conglomerate id = " + conglomId + ": " + c; } } } return(str); } public boolean conglomerateExists(long conglomId) throws StandardException { Conglomerate conglom = findConglomerate(conglomId); if (conglom == null) return false; return true; } public void dropConglomerate(long conglomId) throws StandardException { Conglomerate conglom = findExistingConglomerate(conglomId); conglom.drop(this); if (conglomId < 0) { if (tempCongloms != null) tempCongloms.remove(new Long(conglomId)); } else { accessmanager.conglomCacheRemoveEntry(conglomId); } } /** * Retrieve the maximum value row in an ordered conglomerate. * <p> * Returns true and fetches the rightmost row of an ordered conglomerate * into "fetchRow" if there is at least one row in the conglomerate. If * there are no rows in the conglomerate it returns false. * <p> * Non-ordered conglomerates will not implement this interface, calls * will generate a StandardException. * <p> * RESOLVE - this interface is temporary, long term equivalent (and more) * functionality will be provided by the openBackwardScan() interface. * * @param conglomId The identifier of the conglomerate * to open the scan for. * * @param open_mode Specifiy flags to control opening of table. * OPENMODE_FORUPDATE - if set open the table for * update otherwise open table shared. * @param lock_level One of (MODE_TABLE, MODE_RECORD, or MODE_NONE). * * @param isolation_level The isolation level to lock the conglomerate at. * One of (ISOLATION_READ_COMMITTED or * ISOLATION_SERIALIZABLE). * * @param scanColumnList A description of which columns to return from * every fetch in the scan. template, * and scanColumnList work together * to describe the row to be returned by the scan - * see RowUtil for description of how these three * parameters work together to describe a "row". * * @param fetchRow The row to retrieve the maximum value into. * * @return boolean indicating if a row was found and retrieved or not. * * @exception StandardException Standard exception policy. **/ public boolean fetchMaxOnBtree( long conglomId, int open_mode, int lock_level, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] fetchRow) throws StandardException { // Find the conglomerate. Conglomerate conglom = findExistingConglomerate(conglomId); // Get a scan controller. return( conglom.fetchMaxOnBTree( this, rawtran, conglomId, open_mode, lock_level, determine_locking_policy(lock_level, isolation_level), isolation_level, scanColumnList, fetchRow)); } /** * A superset of properties that "users" can specify. * <p> * A superset of properties that "users" (ie. from sql) can specify. Store * may implement other properties which should not be specified by users. * Layers above access may implement properties which are not known at * all to Access. * <p> * This list is a superset, as some properties may not be implemented by * certain types of conglomerates. For instant an in-memory store may not * implement a pageSize property. Or some conglomerates may not support * pre-allocation. * <p> * This interface is meant to be used by the SQL parser to do validation * of properties passsed to the create table statement, and also by the * various user interfaces which present table information back to the * user. * <p> * Currently this routine returns the following list: * derby.storage.initialPages * derby.storage.minimumRecordSize * derby.storage.pageReservedSpace * derby.storage.pageSize * * @return The superset of properties that "users" can specify. * **/ public Properties getUserCreateConglomPropList() { Properties ret_properties = ConglomerateUtil.createUserRawStorePropertySet((Properties) null); return(ret_properties); } /** * Reveals whether the transaction has ever read or written data. * * @return true If the transaction has never read or written data. * **/ public boolean isIdle() { return rawtran.isIdle(); } /** * Reveals whether the transaction is a global or local transaction. * * @return true If the transaction was either started by * AccessFactory.startXATransaction() or was morphed to a global * transaction by calling * AccessFactory.createXATransactionFromLocalTransaction(). * * @see AccessFactory#startXATransaction * @see TransactionController#createXATransactionFromLocalTransaction * **/ public boolean isGlobal() { return(rawtran.getGlobalId() != null); } /** * Reveals whether the transaction is currently pristine. * * @return true If the transaction is Pristine. * * @see TransactionController#isPristine **/ public boolean isPristine() { return rawtran.isPristine(); } /** * Convert a local transaction to a global transaction. * <p> * Get a transaction controller with which to manipulate data within * the access manager. Tbis controller allows one to manipulate a * global XA conforming transaction. * <p> * Must only be called a previous local transaction was created and exists * in the context. Can only be called if the current transaction is in * the idle state. Upon return from this call the old tc will be unusable, * and all references to it should be dropped (it will have been implicitly * destroy()'d by this call. * <p> * The (format_id, global_id, branch_id) triplet is meant to come exactly * from a javax.transaction.xa.Xid. We don't use Xid so that the system * can be delivered on a non-1.2 vm system and not require the javax classes * in the path. * * @param format_id the format id part of the Xid - ie. Xid.getFormatId(). * @param global_id the global transaction identifier part of XID - ie. * Xid.getGlobalTransactionId(). * @param branch_id The branch qualifier of the Xid - ie. * Xid.getBranchQaulifier() * * @exception StandardException Standard exception policy. * @see TransactionController **/ public /* XATransactionController */ Object createXATransactionFromLocalTransaction( int format_id, byte[] global_id, byte[] branch_id) throws StandardException { getRawStoreXact().createXATransactionFromLocalTransaction(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -