Hi all,
I got a question from a customer about the use of By-Reference option in parameters.
"There is a way to know in a procedure to know if a temp-table, prodataset (and their handles) is passed by-reference/bind?"
As far as I know there is not a function/method or property that allows this, also because when passing appServer boundry an object like a temp-table is always passed BY VALUE.
Am I right? Is there something?
thanks
Alex
I believe there's no way of knowing.
Do you know why it's important to the customer?
-- peter
well... they have seen something in other languages,trying to do the same with OE. They were shocked this was not possible!! (I leave you out their reaction when I explained why).
By the way...the reason is because each time they delete passed parameter temp-table and since BY-REF and DELETE object does not match properly, they look for a quick workaround to know which need to be deleted and which not.
Thanks,
Alex
I.e., a brute force programmatic solution to avoid proper analysis ...
in situations where you use either a class or a stored procedure - when the TT is being initialized before the IP is being called - you can save the unique identifier of the TT and then in IP you can compare that with the identifier of the TT being passed at call time, if different then was by-reference.
guess accessing the identifier for the TT will count as a reference in the content of delayed instantiation added in the latest version... just in case you might not want that.
/* tt.i */
def temp-table tt field a as char.
/* pp.p */
{tt.i}
def var i as integer.
i = temp-table tt:unique-id.
procedure test:
define input parameter table for tt.
message i skip temp-table tt:unique-id view-as alert-box.
end./* test pp.p */
{tt.i}
def var h as handle.
run pp.p persistent set h.
run test in h (table tt).
run test in h (table tt by-reference).
delete object h.
Applies to:
|
Buffer object handle, ProDataSet object handle, Temp-table object handle
|
I did a mix of brute force programming and use temp-table attributes/handles to check if it is referenced.
Thanks to all !!!!
Alex