8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 10:43:03 +01:00

Better idx_type use

This commit is contained in:
brodsom 2003-09-12 16:32:19 +00:00
parent 6b5c0003ac
commit daa5c5842c
4 changed files with 21 additions and 12 deletions

View File

@ -284,11 +284,18 @@ typedef struct funcarg {
/* Index description block */
enum idx_direction
{
IDX_type_none = -1,
IDX_type_ascending = 0,
IDX_type_descending = 1
};
typedef struct dudley_idx {
USHORT idx_count; /* Number of fields */
bool idx_unique; /* true if unique index */
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 */
struct sym *idx_name; /* Index name */
struct sym *idx_relation; /* Relation in question */

View File

@ -1420,8 +1420,8 @@ static void add_index( DUDLEY_IDX index)
X.RDB$SEGMENT_COUNT = index->idx_count;
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
if (index->idx_type) {
X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
if (index->idx_type != IDX_type_none) {
X.RDB$INDEX_TYPE = index->idx_type;
X.RDB$INDEX_TYPE.NULL = FALSE;
}
else
@ -3706,8 +3706,10 @@ static void modify_index( DUDLEY_IDX index)
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
if (index->idx_flags & IDX_unique_flag)
X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
if (index->idx_flags & IDX_type_flag) {
X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
if ((index->idx_flags & IDX_type_flag)
&& (index->idx_type != IDX_type_none))
{
X.RDB$INDEX_TYPE = index->idx_type;
X.RDB$INDEX_TYPE.NULL = FALSE;
}
if (index->idx_flags & IDX_null_description)

View File

@ -1089,7 +1089,7 @@ static void define_index(void)
index->idx_unique = unique;
index->idx_description = description;
index->idx_inactive = inactive;
index->idx_type = descending;
index->idx_type = IDX_type_none;
ptr = &index->idx_field[count];
@ -2542,11 +2542,11 @@ static void modify_index(void)
index->idx_flags |= IDX_active_flag;
}
else if (MATCH(KW_ASCENDING)) {
index->idx_type = false;
index->idx_type = IDX_type_ascending;
index->idx_flags |= IDX_type_flag;
}
else if (MATCH(KW_DESCENDING)) {
index->idx_type = true;
index->idx_type = IDX_type_descending;
index->idx_flags |= IDX_type_flag;
}
else if (KEYWORD(KW_DESCRIPTION)) {

View File

@ -640,8 +640,8 @@ static void add_index( STR dyn, DUDLEY_IDX index)
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_inactive, (index->idx_inactive) ? TRUE : FALSE);
if (index->idx_type)
put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
if (index->idx_type != IDX_type_none)
put_number(dyn, gds_dyn_idx_type, index->idx_type);
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,
(index->idx_inactive) ? TRUE : FALSE);
if (index->idx_flags & IDX_type_flag)
put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
if ((index->idx_flags & IDX_type_flag) && (index->idx_type != IDX_type_none))
put_number(dyn, gds_dyn_idx_type, index->idx_type);
if (index->idx_flags & IDX_null_description) {
CHECK_DYN(3);