Subject | Re: [IBO] Locate - Jason help! |
---|---|
Author | Geoff Worboys |
Post date | 2002-05-22T07:53:47Z |
> I have two fields, ID and Parent ID and the component perfoms callsI think I understand. The TreeView is filling its display from a
> to Locate method to construct on the fly the tree, when expand a
> node and so on. I need that the DBTree component can call to
> Locate('ID', and Locate('Parent_ID', with a good performance but the
> Dataset always has to be sorted by Parent_ID. Paradox do it
> perfectly, use the other index although doesn't change it in the
> table.
> I am sorry, my english is limited... Better ?
single dataset - and that dataset must be based on a self-referential
arrangement using Parent_ID to identify the heirarchical relationship,
but ID to locate a specific record individually. Since there is no
mention so far of parameters I am guessing that the entire dataset
must be fetched into client memory for this component to operate.
As far as I can tell IBO should support this setup efficiently,
provided you have things defined appropriately. Lets try to do this
by example...
Given a table like:
CREATE TABLE MY_TREE_TABLE (
ID INTEGER NOT NULL PRIMARY KEY,
PARENT_ID INTEGER,
CAPTION VARCHAR(60 )
);
CREATE INDEX UNIQUE ASCENDING TREE_BY_PARENT ON
MY_TREE_TABLE( PARENT_ID, CAPTION );
The dataset would be setup something like:
SQL:
SELECT ID, PARENT_ID, CAPTION
FROM MY_TREE_TABLE
KeyLinks:
ID
OrderingItems
By Parent=PARENT_ID,CAPTION
OrderingLinks
PARENT_ID=1
OrderingItemNo = 1
With a setup similar to this it seems that IBO should perform a direct
(primary key/index) based lookup by 'ID' and still support a fast
lookup when searching by 'PARENT_ID'. You may need to set
AutoFetchAll = true in order to get the best possible responses,
without this IBO will try to setup a separate locate cursor which
seems redundant given the circumstances (you need the whole dataset
loaded to support the tree so why bother with separate cursors).
There are some interesting caveats about IBO processing in this
regard. If the protocol is cpLocal and there are more than 20000
records loaded then IBO will use a locate cursor anyway.
Does any of this make sense to your setup? (Its hard to be specific
when I done have DevExp to do any experiments.)
--
Geoff Worboys
Telesis Computing