Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Do
-
None
Description
Note: this patch was reverted from 10.5 on Monty's request.
It makes the engine code incompatible between 10.5 and earlier versions.
Old description
We should eventually split numeric type handlers into separate signed and unsigned variants. This is needed for function collection plugins, to define function prototypes easier.
For example, instead of Type_handler_longlong there should be Type_handler_slonglong and Type_handler_ulonglong.
In order to do this easier, let's change Field::flags and Column_definition::flags from a member to:
uint32 flags;
|
a method:
uint32 flags() const; |
To share the code between Field and Column_definition, let's add a new class:
class Column_cached_flags |
{
|
uint32 m_flags;
|
public: |
Column_cached_flags(uint32 flags)
|
:m_flags(flags)
|
{ }
|
void set_flags(uint32 flags) { m_flags= flags; } |
void add_flags(uint32 flags) { m_flags|= flags; } |
void clear_flags(uint32 flags) { m_flags&= ~flags; } |
void mask_flags(uint32 flags) { m_flags&= flags; } |
void swap_flags(Column_cached_flags *other) |
{
|
swap_variables(uint32, m_flags, other->m_flags);
|
}
|
uint32 cached_flags() const { return m_flags; } |
};
|
and derive Field and Column definition from it.
Field::flags() and Column_definition::flags() will do something like this:
uint32 flags() cosnst
|
{
|
return Cached_column_flags::cached_flags() | type_handler()->flags(); |
}
|
where type_handler()->flags() will be a new method in Type_handler:
virtual uint32 flags() const { return 0; } |
Type_handler descendants will override the default implementation and will return data type specific flags:
- ENUM_FLAG
- SET_FLAG
- BLOB_FLAG
- UNSIGNED_FLAG
or their combination when necessary.
Note, under terms of this task will change only ENUM_FLAG, SET_FLAG and BLOB_FLAG to Type_handler::flags().
UNSIGNED_FLAG will be moved to Type_handler::flags() later, under terms of a separate task.
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed