Question
· Aug 17, 2022

Ensemble default packages

Hi Guys,

I've newly joined a new company and have been asked to get the number of classes in their system and was wondering if Ens, EnsLib and EnsPortal are normally a system or default packages that comes with default classes that developers can use or override? 

Thanks

Product version: Caché 2014.1
Discussion (6)2
Log in or sign up to continue

Ens, EnsLib and EnsPortal are system packages, developes can subclass them.

To get class count call something like this:

SELECT 
  count(ID)
FROM %Dictionary.ClassDefinition
WHERE 1=1 AND
      System = 0 AND 
      NOT (Name %STARTSWITH '%' OR 
           Name %STARTSWITH 'Ens.' OR 
           Name %STARTSWITH 'EnsLib.' OR 
           Name %STARTSWITH 'EnsPortal.' OR 
           Name %STARTSWITH 'HS.' OR 
           Name %STARTSWITH 'SchemaMap')

Missing: SQL way to filter out mapped classes.

Say you have this query:

SELECT a, b, c
FROM mytable
WHERE d=1 AND e=2

If you want to change fields in SELECT or WHERE, you'll need to rewrite your query by adding or removing it's parts. Source control diff would also show a whole line change.

But if you write it like this:

SELECT 1
  , a 
  , b 
  , c
FROM mytable
WHERE 1=1
      AND d=1 
      AND e=2

You can comment out any field or condition simply by adding --:

SELECT 1
  --, a 
  , b 
  , c
FROM mytable
WHERE 1=1
      --AND d=1 
      AND e=2

when you have a lot of conditions and need to iterate fast, this way of writing queries is much better for debugging and source control since diff is always contianed to the one line you edit.