mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-25 00:43:03 +01:00
Better idx_type use
This commit is contained in:
parent
6b5c0003ac
commit
daa5c5842c
@ -284,11 +284,18 @@ typedef struct funcarg {
|
|||||||
|
|
||||||
/* Index description block */
|
/* Index description block */
|
||||||
|
|
||||||
|
enum idx_direction
|
||||||
|
{
|
||||||
|
IDX_type_none = -1,
|
||||||
|
IDX_type_ascending = 0,
|
||||||
|
IDX_type_descending = 1
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct dudley_idx {
|
typedef struct dudley_idx {
|
||||||
USHORT idx_count; /* Number of fields */
|
USHORT idx_count; /* Number of fields */
|
||||||
bool idx_unique; /* true if unique index */
|
bool idx_unique; /* true if unique index */
|
||||||
bool idx_inactive; /* false if index is active */
|
bool idx_inactive; /* false if index is active */
|
||||||
bool idx_type; /* true descending */
|
idx_direction idx_type; /* true descending */
|
||||||
USHORT idx_flags; /* Indicate which attributes have changed */
|
USHORT idx_flags; /* Indicate which attributes have changed */
|
||||||
struct sym *idx_name; /* Index name */
|
struct sym *idx_name; /* Index name */
|
||||||
struct sym *idx_relation; /* Relation in question */
|
struct sym *idx_relation; /* Relation in question */
|
||||||
|
@ -1420,8 +1420,8 @@ static void add_index( DUDLEY_IDX index)
|
|||||||
X.RDB$SEGMENT_COUNT = index->idx_count;
|
X.RDB$SEGMENT_COUNT = index->idx_count;
|
||||||
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
|
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
|
||||||
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
|
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
|
||||||
if (index->idx_type) {
|
if (index->idx_type != IDX_type_none) {
|
||||||
X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
|
X.RDB$INDEX_TYPE = index->idx_type;
|
||||||
X.RDB$INDEX_TYPE.NULL = FALSE;
|
X.RDB$INDEX_TYPE.NULL = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3706,8 +3706,10 @@ static void modify_index( DUDLEY_IDX index)
|
|||||||
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
|
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
|
||||||
if (index->idx_flags & IDX_unique_flag)
|
if (index->idx_flags & IDX_unique_flag)
|
||||||
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
|
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
|
||||||
if (index->idx_flags & IDX_type_flag) {
|
if ((index->idx_flags & IDX_type_flag)
|
||||||
X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
|
&& (index->idx_type != IDX_type_none))
|
||||||
|
{
|
||||||
|
X.RDB$INDEX_TYPE = index->idx_type;
|
||||||
X.RDB$INDEX_TYPE.NULL = FALSE;
|
X.RDB$INDEX_TYPE.NULL = FALSE;
|
||||||
}
|
}
|
||||||
if (index->idx_flags & IDX_null_description)
|
if (index->idx_flags & IDX_null_description)
|
||||||
|
@ -1089,7 +1089,7 @@ static void define_index(void)
|
|||||||
index->idx_unique = unique;
|
index->idx_unique = unique;
|
||||||
index->idx_description = description;
|
index->idx_description = description;
|
||||||
index->idx_inactive = inactive;
|
index->idx_inactive = inactive;
|
||||||
index->idx_type = descending;
|
index->idx_type = IDX_type_none;
|
||||||
|
|
||||||
ptr = &index->idx_field[count];
|
ptr = &index->idx_field[count];
|
||||||
|
|
||||||
@ -2542,11 +2542,11 @@ static void modify_index(void)
|
|||||||
index->idx_flags |= IDX_active_flag;
|
index->idx_flags |= IDX_active_flag;
|
||||||
}
|
}
|
||||||
else if (MATCH(KW_ASCENDING)) {
|
else if (MATCH(KW_ASCENDING)) {
|
||||||
index->idx_type = false;
|
index->idx_type = IDX_type_ascending;
|
||||||
index->idx_flags |= IDX_type_flag;
|
index->idx_flags |= IDX_type_flag;
|
||||||
}
|
}
|
||||||
else if (MATCH(KW_DESCENDING)) {
|
else if (MATCH(KW_DESCENDING)) {
|
||||||
index->idx_type = true;
|
index->idx_type = IDX_type_descending;
|
||||||
index->idx_flags |= IDX_type_flag;
|
index->idx_flags |= IDX_type_flag;
|
||||||
}
|
}
|
||||||
else if (KEYWORD(KW_DESCRIPTION)) {
|
else if (KEYWORD(KW_DESCRIPTION)) {
|
||||||
|
@ -640,8 +640,8 @@ static void add_index( STR dyn, DUDLEY_IDX index)
|
|||||||
put_symbol(dyn, gds_dyn_rel_name, index->idx_relation);
|
put_symbol(dyn, gds_dyn_rel_name, index->idx_relation);
|
||||||
put_number(dyn, gds_dyn_idx_unique, (index->idx_unique) ? TRUE : FALSE);
|
put_number(dyn, gds_dyn_idx_unique, (index->idx_unique) ? TRUE : FALSE);
|
||||||
put_number(dyn, gds_dyn_idx_inactive, (index->idx_inactive) ? TRUE : FALSE);
|
put_number(dyn, gds_dyn_idx_inactive, (index->idx_inactive) ? TRUE : FALSE);
|
||||||
if (index->idx_type)
|
if (index->idx_type != IDX_type_none)
|
||||||
put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
|
put_number(dyn, gds_dyn_idx_type, index->idx_type);
|
||||||
|
|
||||||
put_text(dyn, gds_dyn_description, index->idx_description);
|
put_text(dyn, gds_dyn_description, index->idx_description);
|
||||||
|
|
||||||
@ -1380,8 +1380,8 @@ static void modify_index( STR dyn, DUDLEY_IDX index)
|
|||||||
put_number(dyn, gds_dyn_idx_inactive,
|
put_number(dyn, gds_dyn_idx_inactive,
|
||||||
(index->idx_inactive) ? TRUE : FALSE);
|
(index->idx_inactive) ? TRUE : FALSE);
|
||||||
|
|
||||||
if (index->idx_flags & IDX_type_flag)
|
if ((index->idx_flags & IDX_type_flag) && (index->idx_type != IDX_type_none))
|
||||||
put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
|
put_number(dyn, gds_dyn_idx_type, index->idx_type);
|
||||||
|
|
||||||
if (index->idx_flags & IDX_null_description) {
|
if (index->idx_flags & IDX_null_description) {
|
||||||
CHECK_DYN(3);
|
CHECK_DYN(3);
|
||||||
|
Loading…
Reference in New Issue
Block a user