kmadduri
6th January 2011, 20:45
Is there a way to bypass DAL code "method.is.allowed" from a 4 gl program when the table is used as a main table?

Thanks,
Kumar Madduri

amitmmokashi
7th January 2011, 08:30
Hi,

DAL function "method.is.allowed" is called only if the database operation is done using DAM i.e. DAL Access Methods. If the function "method.is.allowed" is not to be called, then instead of using the DAM, you can use the functions without DAL intervention i.e. db.insert, db.update or db.delete.

Regards,
Amit Mokashi

kmadduri
7th January 2011, 16:51
The scenario here is that I am using a 4gl session with main table as tdsls401. As such, it won't enable the modify option because by default the DAL method.is.allowed is applied. I was wondering if there is any type of context that can be set up that will by pass the method.is.allowed code. It looks like it may not be possible. Thanks.

ulrich.fuchs
8th January 2011, 22:49
That's the whole idea of the DAL. It's always applicable in ANY session.

Do you have source code? If so, you can modify the DAL to not do the checks if called from your particular session (of course you're risking data corruptioin then so you should know what you're doing).

The trick is to use a global variable in the DAL (I usually call them operation.mode.for.something), and an external funktion to set that variable to true (it will be false by default, so for all standard sessions). Then use the global variable in the DAL to bypass the checks you want to bypass, and call the external funktion from your particular session to activate this behaviour.

Uli

kmadduri
9th January 2011, 17:54
No, we don't have the source code. Yes, I have implemented this type of bypassing the DAL for the DAL's I wrote, but this is a standard DAL. I was just curious if anyone came up with an ingenious idea. Thanks for your response.

Regards,
Kumar Madduri

Leerkes
12th January 2011, 12:01
Hi there,

You can set in the before.program section the following function: disable.dal().
Now the dal of the main table will not be used at all.
The function disable.dal() was only introduced to be able to gradually implement a dal on a certain table. The end goal of course is to have every session which is having a certain table as main table to use the dal. So, be carefull while using the disable.dal() function, because all checks and updating of related objects are not executed any more!
If you only want to switch off certain functions in the DAL, then the only way to go is the way Ulrich is proposing.
Regards,
Michiel

ulrich.fuchs
12th January 2011, 16:34
@leerkes: Wow, that's in fact a nice (and of course, undocumented, unsupported etc.) function that's new to me. Thanks for sharing, having this available is certainly useful when building simple data correction input sessions for IT use etc.

kmadduri
13th January 2011, 01:09
Thanks Michiel. This is great. You are the man. :-)

Kumar