Details
-
Task
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
Description
The pointer to a generic attribute in Type_extra_attributes is of the "void *m_attr_const_void_ptr" data type. This is error prone and makes coding hard, as it allows to pass a pointer to a wrong structure without control from the compiler.
With introducing associative arrays, we've added nested data types:
- The attribute in the associative data type points to the data record
- The data record has its own attribute (the field list).
We're going to add more complex data types, such as nested records, or REF CURSOR.
To make coding easier, let's introduce a parent class for all generic attributes.
Let's change "void *m_attr_const_void_ptr" to a strict data type, with this declaration:
class Type_generic_attributes |
{
|
public: |
virtual ~Type_generic_attributes() { } |
virtual const Type_handler *type_handler() const = 0; |
};
|
Then change Type_extra_attributes's field for generic attributes from:
const void *m_attr_const_void_ptr[1]; |
to
const Type_generic_attributes *m_attr_const_generic_attributes_ptr[1]; |
and change related methods to store/get a pointer of the Type_generic_attributes data type (instead of void pointers).
All type specific attributes will go into this hierarchy:
Type_generic_attributes
|
Type_typelib_attributes
|
sp_type_def
|
sp_type_def_record
|
sp_type_def_composite2
|
The change will be more or less straightforward. However, changes for Type_typelib_attributes will need some efforts: we'll need to change a pointer to TYPELIB to a pointer to Type_typelib_attributes in a considerable amount of places.
Attachments
Issue Links
- blocks
-
MDEV-10152 Add support for TYPE .. IS REF CURSOR
-
- In Progress
-