How to use %Dictionary API to retrieve some essences of the properties of the class

Object Data Model, Caché

Given the class name, how could I leverage the %Dictionary API to 

1. Get the ID Key field

2. Check the ID Key field is Integer type.

3. Given a property name, how could I check  there is a UNIQUE constraint/index on it and also the property is Integer type?

Thanks you.

  • 0
  • 0
  • 117
  • 3
  • 1

Answers

1.

SELECT
parent As Class,
Properties
FROM %Dictionary.CompiledIndex
WHERE IdKey=1

2.

SELECT
parent As Class, Name, Type
FROM %Dictionary.CompiledProperty
WHERE Type='%Library.Integer' -- Name='Property' AND parent='Class'

3.

SELECT 1 As "Exists"
FROM %Dictionary.CompiledIndex
WHERE _Unique=1 AND parent = :Class AND Properties = :Property

Does your first query works for the child class under parent child relationship? I don't think there is an ID Key for the child table, but the first query still return the child table.

never mind my previous question, because you just check "parent".

Thanks.