Why dont queries support CAN-FIND ?

Posted by Alon Blich on 18-Jul-2006 09:05

CAN-FIND is a very common, very useful feature, even for basic functionality, like, FOR EACH child WITHOUT parent.

I am aware of the trigger work around though its not a great one (but its not the only workaround).

It cannot really be added dynamically to a where clause, no temp-table triggers, theres the added overhead from invoking triggers etc.

It'd be nice if most of the things, where ever possible, that we can easily do statically in a FOR EACH statement we could do dynamically and in static queries.

Why is that ? do the added buffer/s complicate things, though its probably not exactly the same as query buffers ? TIA

All Replies

Posted by svi on 18-Jul-2006 10:13

The CAN-FIND buffer is unknown to the Query, and the Query can only operate on its own "each" set of buffers.

FOR EACH's cannot be "nexted" outside of the context in which they are compiled, so they get to have WHERE clauses that refer to anything in their compilation context. QUERY's on the other hand, can be "nexted" from some compilation unit far different from their own, so they must be self-contained and cannot reach back to refer to buffers known in their original compilation unit, but not within their own "each" set.

Posted by Alon Blich on 18-Jul-2006 10:47

But queries aren't completely self contained, I mean they don't own the buffers they refer to, right ?

In that same respect a query can be created in one external or even internal procedure thats referencing a buffer scoped to that procedure.

Wouldn't it become invalid when its passed/used outside that procedure ?

Even if I'm completely wrong here and its not as pure, maybe compromising its still such a useful and simple to use feature.

Anyway, thank you for taking the time to answer my question.

Posted by svi on 18-Jul-2006 11:20

It is true that queries can reference buffers with a different scope from the query. Queries have to keep a list of buffers they "each" on, and in turn, those "each" buffers have to keep a list of all queries outstanding on them. When the buffer goes away, the query is automatically notified that its buffers are compromised, and it is unprepared and cleaned up. When the query goes away, it has to get to each of its buffers and let that buffer know that the query no longer cares about it. In the future we may consider an enhancement to get this mutual cross referencing, extending it to include other buffers outside the query.

This thread is closed