Versions available for this page: CUBRID 8.2.1 | CUBRID 8.3.0 | CUBRID 8.3.1 | CUBRID 8.4.0 | CUBRID 8.4.1 | CUBRID 8.4.3 | CUBRID 9.0.0 |
Represents the attribute information of the class for which the current user has access authorization in the database.
|
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. |
|
def_order |
INTEGER |
Order of attributes in the class. Begins with 0. If the attribute is inherited, the order is the one defined in the superclass. |
|
from_class_name |
VARCHAR(255) |
If the attribute is inherited, the superclass in which it is defined is used. Otherwise, NULL |
|
from_attr_name |
VARCHAR(255) |
If the attribute is inherited and its name is changed to resolve a name conflict, the original name defined in the superclass is used. Otherwise, NULL |
|
data_type |
VARCHAR(9) |
Data type of the attribute (one in the "Meaning" column of the "Data Types Supported by CUBRID" table in _db_attribute) |
|
prec |
INTEGER |
Precision of the data type. 0 is used if the precision is not specified. |
|
scale |
INTEGER |
Scale of the data type. 0 is used if the scale is not specified. |
|
code_set |
INTEGER |
Character set (a value in the 'Value' column of the 'Character Sets Supported by CUBRID' table in _db_attribute) if the data type is a character, and 0 otherwise. |
|
domain_class_name |
VARCHAR(255) |
Domain class name if the data type is an object; otherwise, NULL |
|
default_value |
VARCHAR(255) |
Saved as a character string by default, regardless of data types. If no default value is specified, NULL is saved; if a default value is NULL, it is displayed as 'NULL'. An object data type is represented as 'volume id | page id | slot id' while a set data type is represented as '{element 1, element 2, ... '. |
|
is_nullable |
VARCHAR(3) |
'NO' if a not null constraint is set, and 'YES' otherwise. |
CREATE VCLASS db_attribute (
attr_name, class_name, attr_type, def_order, from_class_name, from_attr_name, data_type, prec, scale, code_set, domain_class_name, default_value, is_nullable)
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,
a.def_order, a.from_class_of.class_name, a.from_attr_name, t.type_name,
d.prec, d.scale, d.code_set, d.class_of.class_name, a.default_value,
CASE WHEN a.is_nullable = 0 THEN 'YES' ELSE 'NO' END
FROM _db_class c, _db_attribute a, _db_domain d, _db_data_type t
WHERE a.class_of = c AND d.object_of = a AND d.data_type = t.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'));
csql> select attr_name, data_type, domain_class_name
csql> from db_attribute
csql> where class_name = 'event'
csql> order by def_order;
csql> ;xrun
=== <Result of SELECT Command in Line 1> ===
attr_name data_type domain_class_name
==================================================================
'code' 'INTEGER' NULL
'sports' 'STRING' NULL
'name' 'STRING' NULL
'gender' 'CHAR' NULL
'players' 'INTEGER' NULL
csql> select attr_name, from_class_name
csql> from db_attribute
csql> where class_name = 'female_event'
csql> order by def_order;
csql> ;xrun
=== <Result of SELECT Command in Line 1> ===
attr_name from_class_name
============================================
'code' 'event'
'sports' 'event'
'name' 'event'
'gender' 'event'
'players' 'event'
csql> select a.class_name, a.attr_name
csql> from db_class c join db_attribute a
csql> on c.class_name = a.class_name
csql> where c.owner_name = CURRENT_USER and
csql> attr_name like '%name%'
csql> order by 1;
csql> ;xrun
=== <Result of SELECT Command in Line 1> ===
class_name attr_name
============================================
'athlete' 'name'
'code' 'f_name'
'code' 's_name'
'event' 'name'
'female_event' 'name'
'nation' 'name'
'stadium' 'name'