RefIntegrity enum values in Toad 5.3 - 5.4 / Get Toad version from Macro

It seems that the RefIntegrity enum values changed from version 5.3 to 5.4.

In Toad 5.3 I discovered that:

0 -None
1 -Restrict
2 -Cascade
3 -Set Null
4 -Set Default

In Toad 5.4, due to the new per-database-filtered RefIntegrity management,
the enum seems to be 1-based:

1 -No action
2 -Restrict
3 -Cascade
4 -Set Null
5 -Set Default

Note that this is what I discovered by changing a relation and printing values… I found no documentation on this enum.

Do you confirm that?

Since I use the RefIntegrity properties in a macro, is there a way to get the current Toad version?

Hello Tommaso,

I have yet to find out the changes made to the enum values, but I can tell you how to get the current version of TDM. There were a few new properties added for Application object in TDM 5.4 - VersionMajor, VersionMinor, etc. It is not possible to get TDM version by using macro in version older than 5.4. You can use the following script to determine the application version, if possible:

function main(){
var Application = System.GetInterface(‘Application’);
if (Application.SupportsProperty(‘VersionMajor’))
{
Log.Information('TDM Version: ’ + Application.VersionMajor + ‘.’ + Application.VersionMinor + ‘.’ + Application.VersionRelease + ‘.’ + Application.VersionBuild);
}
else
{
Log.Information(‘TDM Version older than 5.4’);
}
}

Regards,

Lukas

Thanks, it did the trick.

Let me know about changes in the RefIntegrity enum, thanks!

Hello again,

About the RefIntegrity enum values - they have been changed, you have correctly discovered the numbers and their corresponding values. And yes, the values start from 1.

Note that there has been some changes in the Referential Integrity system. Only those Ref. Integrity options that are supported by a database platform can be set for its relationship. For example, in TDM 5.3 it was possible to set RESTRICT and SET NULL Ref. Integrity for relationships in SQL Server 2000 model, even though these options are not supported by the database itself. This has been fixed in the current version (Issue 451 in Enhancements in Release Notes).

In TDM 5.4, you can still set any Ref. Integrity value to a relationship of any database platform using macros. But if the set Ref. Integrity option is not supported, you will get a verification error in your model.

Regards,

Lukas

Thanks for the information.