Forum OpenACS Development: Re: Functions in .xql files...

Collapse
Posted by Don Baccus on
The content_item ones fall into the class of methods that follow from thinking that

content_item__get_live_revision(item_id)

is somehow more "abstract" than

content_item.live_revision

(i.e. referencing the column directly)

The queries would all run faster if code just referenced the columns directly.  They're never going away, no meaningful information is being hidden, etc etc.

Now, in C++ one can hide the underlying variable from the user and control access via "get/set_" functions.  If you don't provide a "set_foo" function and "foo" is private, you can guarantee that only your class implementation can change the value of foo.

So there really is some value in this approach in C++ (and certain other languages).

But SQL doesn't support "private" columns in a table so we're really getting nothing but slower queries and needless Oracle/PG specific .xql entries out of this approach.

That's just my somewhat strong opinion, how do others feel?

Collapse
Posted by Tilmann Singer on
I totally agree. Until now I had some doubt that content_item__get_live_revision does something else, e.g. checking for the publish_status and returning null if it's not live, but I just looked it up and it doesn't - it just retrieves the live_revision column value. It's fair enough after all to assume that an item is live as soon as it has an entry in live_revision.