⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 heap.java

📁 derby database source code.good for you.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            // add the new column            format_ids[old_format_ids.length] =                 template_column.getTypeFormatId();                       // row in slot 0 of heap page 1 which is just a single column with            // the heap entry.            DataValueDescriptor[] control_row = new DataValueDescriptor[1];            control_row[0] = this;            page =                container.getPage(ContainerHandle.FIRST_PAGE_NUMBER);            page.updateAtSlot(                Page.FIRST_SLOT_NUMBER,                control_row,                (FormatableBitSet) null);            page.unlatch();            page = null;        }        finally        {            if (container != null)                container.close();            if (page !=null)                page.unlatch();        }        return;    }	/**	Drop this heap.	@see Conglomerate#drop	@exception StandardException Standard exception policy.	**/	public void drop(TransactionManager xact_manager)		throws StandardException	{        xact_manager.getRawStoreXact().dropContainer(id);	}    /**     * 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(	TransactionManager      xact_manager,    Transaction             rawtran,    long                    conglomId,    int                     open_mode,    int                     lock_level,    LockingPolicy           locking_policy,    int                     isolation_level,    FormatableBitSet                 scanColumnList,    DataValueDescriptor[]   fetchRow)        throws StandardException    {        // no support for max on a heap table.        throw(StandardException.newException(                SQLState.HEAP_UNIMPLEMENTED_FEATURE));    }    /**     * Get the id of the container of the conglomerate.     * <p>     * Will have to change when a conglomerate could have more than one      * container.  The ContainerKey is a combination of the container id     * and segment id.     *	 * @return The ContainerKey.     **/    public final ContainerKey getId()    {        return(id);    }    public final long getContainerid()    {        return(id.getContainerId());    }    /**     * Return dynamic information about the conglomerate to be dynamically      * reused in repeated execution of a statement.     * <p>     * The dynamic info is a set of variables to be used in a given      * ScanController or ConglomerateController.  It can only be used in one      * controller at a time.  It is up to the caller to insure the correct      * thread access to this info.  The type of info in this is a scratch      * template for btree traversal, other scratch variables for qualifier      * evaluation, ...     * <p>     *	 * @return The dynamic information.     *     * @param conglomId The identifier of the conglomerate to open.     *	 * @exception  StandardException  Standard exception policy.     **/    public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo(    long        conglomId)		throws StandardException    {        return(new OpenConglomerateScratchSpace(format_ids));    }    /**     * Return static information about the conglomerate to be included in a     * a compiled plan.     * <p>     * The static info would be valid until any ddl was executed on the      * conglomid, and would be up to the caller to throw away when that      * happened.  This ties in with what language already does for other      * invalidation of static info.  The type of info in this would be      * containerid and array of format id's from which templates can be created.     * The info in this object is read only and can be shared among as many      * threads as necessary.     * <p>     *	 * @return The static compiled information.     *     * @param conglomId The identifier of the conglomerate to open.     *	 * @exception  StandardException  Standard exception policy.     **/    public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo(    TransactionController   tc,    long                    conglomId)		throws StandardException    {        return(this);    }    /**     * Is this conglomerate temporary?     * <p>     *	 * @return whether conglomerate is temporary or not.     **/    public boolean isTemporary()    {        return(id.getSegmentId() == ContainerHandle.TEMPORARY_SEGMENT);    }    /**     * Bulk load into the conglomerate.     * <p>     *     * @see Conglomerate#load     *	 * @exception  StandardException  Standard exception policy.     **/	public long load(	TransactionManager      xact_manager,	boolean                 createConglom,	RowLocationRetRowSource rowSource)		 throws StandardException	{        long num_rows_loaded = 0;		HeapController heapcontroller = new HeapController();		try		{			num_rows_loaded =                 heapcontroller.load(                    xact_manager,                    this,                     createConglom,                    rowSource);		}		finally		{			// Done with this heap controller.			heapcontroller.close();		}        return(num_rows_loaded);	}    /**     * Open a heap controller.     * <p>     *	 * @see Conglomerate#open     *	 * @exception  StandardException  Standard exception policy.     **/	public ConglomerateController open(    TransactionManager              xact_manager,    Transaction                     rawtran,    boolean                         hold,    int                             open_mode,    int                             lock_level,    LockingPolicy                   locking_policy,    StaticCompiledOpenConglomInfo   static_info,    DynamicCompiledOpenConglomInfo  dynamic_info)		throws StandardException	{        OpenConglomerate open_conglom = new OpenHeap();        if (open_conglom.init(                (ContainerHandle) null,                this,                this.format_ids,                xact_manager,                rawtran,                hold,                open_mode,                lock_level,                locking_policy,                dynamic_info) == null)        {            throw StandardException.newException(                    SQLState.HEAP_CONTAINER_NOT_FOUND,                     new Long(id.getContainerId()).toString());        }		HeapController heapcontroller = new HeapController();        heapcontroller.init(open_conglom);		return(heapcontroller);	}    /**     * Open a heap scan controller.     * <p>     *     * @see Conglomerate#openScan     *	 * @exception  StandardException  Standard exception policy.     **/	public ScanManager openScan(    TransactionManager              xact_manager,    Transaction                     rawtran,    boolean                         hold,    int                             open_mode,    int                             lock_level,    LockingPolicy                   locking_policy,    int                             isolation_level,	FormatableBitSet				scanColumnList,    DataValueDescriptor[]	        startKeyValue,    int                             startSearchOperator,    Qualifier                       qualifier[][],    DataValueDescriptor[]	        stopKeyValue,    int                             stopSearchOperator,    StaticCompiledOpenConglomInfo   static_info,    DynamicCompiledOpenConglomInfo  dynamic_info)		throws StandardException	{        // Heap scans do not suppport start and stop scan positions (these        // only make sense for ordered storage structures).		if (!RowUtil.isRowEmpty(startKeyValue, (FormatableBitSet) null)			|| !RowUtil.isRowEmpty(stopKeyValue, (FormatableBitSet) null))		{            throw StandardException.newException(                    SQLState.HEAP_UNIMPLEMENTED_FEATURE);		}        OpenConglomerate open_conglom = new OpenHeap();        if (open_conglom.init(                (ContainerHandle) null,                this,                this.format_ids,                xact_manager,                rawtran,                hold,                open_mode,                lock_level,                locking_policy,                dynamic_info) == null)        {            throw StandardException.newException(                    SQLState.HEAP_CONTAINER_NOT_FOUND,                     new Long(id.getContainerId()));        }		HeapScan heapscan = new HeapScan();        heapscan.init(            open_conglom,            scanColumnList,            startKeyValue,            startSearchOperator,            qualifier,            stopKeyValue,            stopSearchOperator);		return(heapscan);	}	public void purgeConglomerate(    TransactionManager              xact_manager,    Transaction                     rawtran)        throws StandardException    {        OpenConglomerate        open_for_ddl_lock   = null;        HeapController          heapcontroller      = null;        TransactionManager      nested_xact         = null;        try        {            open_for_ddl_lock = new OpenHeap();            // Open table in intended exclusive mode in the top level             // transaction, this will stop any ddl from happening until             // purge of whole table is finished.            if (open_for_ddl_lock.init(                    (ContainerHandle) null,                    this,                    this.format_ids,                    xact_manager,                    rawtran,                    false,                    TransactionController.OPENMODE_FORUPDATE,                    TransactionController.MODE_RECORD,                    null,                    null) == null)            {                throw StandardException.newException(                        SQLState.HEAP_CONTAINER_NOT_FOUND,                         new Long(id.getContainerId()));            }            // perform all the "real" work in a non-readonly nested user 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -