Among attributes of the class to which the current user has access authorization in the database, if an attribute's data type is a set (set, multiset, sequence), this macro represents the data type of the element of the set.
Attribute Name |
Data Type |
Description |
---|---|---|
attr_name |
VARCHAR(255) |
Attribute name |
class_name |
VARCHAR(255) |
Name of the class to which the attribute belongs |
attr_type |
VARCHAR(8) |
‘INSTANCE’ for an instance attribute, 'CLASS' for a class attribute, and 'SHARED' for a shared attribute. |
data_type |
VARCHAR(9) |
Data type of the element |
prec |
INTEGER |
Precision of the data type of the element |
scale |
INTEGER |
Scale of the data type of the element |
code_set |
INTEGER |
Character set if the data type of the element is a character |
domain_class_name |
VARCHAR(255) |
Domain class name if the data type of the element is an object |
CREATE VCLASS db_attr_setdomain_elm (
attr_name, class_name, attr_type,data_type, prec, scale, code_set, domain_class_name)
AS
SELECT a.attr_name, c.class_name,
CASE WHEN a.attr_type = 0 THEN 'INSTANCE'
WHEN a.attr_type = 1 THEN 'CLASS'
ELSE 'SHARED' END,
et.type_name, e.prec, e.scale, e.code_set, e.class_of.class_name
FROM _db_class c, _db_attribute a, _db_domain d,
TABLE(d.set_domains) AS t(e), _db_data_type et
WHERE a.class_of = c AND d.object_of = a AND e.data_type = et.type_id AND
(CURRENT_USER = 'DBA' OR
{c.owner.name} subseteq (
SELECT set{CURRENT_USER} + coalesce(sum(set{t.g.name}), set{})
from db_user u, table(groups) as t(g)
where u.name = CURRENT_USER ) OR
{c} subseteq (
SELECT sum(set{au.class_of})
FROM _db_auth au
WHERE {au.grantee.name} subseteq (
SELECT set{CURRENT_USER} + coalesce(sum(set{t.g.name}), set{})
from db_user u, table(groups) as t(g)
where u.name = CURRENT_USER ) AND
au.auth_type = 'SELECT'));
If the set_attr attribute of class D is of a SET (A, B, C) type, the following three records exist.
Attr_name |
Class_name |
Attr_type |
Data_type |
Prec |
Scale |
Code_set |
Domain_class_name |
---|---|---|---|---|---|---|---|
‘set_attr’ |
‘D’ |
‘INSTANCE’ |
‘SET’ |
0 |
0 |
0 |
‘A’ |
‘set_attr’ |
‘D’ |
‘INSTANCE’ |
‘SET’ |
0 |
0 |
0 |
‘B’ |
‘set_attr’ |
‘D’ |
‘INSTANCE’ |
‘SET’ |
0 |
0 |
0 |
‘C’ |
The following example shows how to retrieve set type attributes and data types of the ‘city’ class (the city table defined in Containment Operators is created).
SELECT attr_name, attr_type, data_type, domain_class_name
FROM db_attr_setdomain_elm
WHERE class_name = 'city';
attr_name attr_type data_type domain_class_name
==============================================================================
'sports' 'INSTANCE' 'STRING' NULL