diff --git a/src/dudley/ddl.h b/src/dudley/ddl.h index 88b07ade77..711f92f4e9 100644 --- a/src/dudley/ddl.h +++ b/src/dudley/ddl.h @@ -286,9 +286,8 @@ typedef struct funcarg { enum idx_direction { - IDX_type_none = -1, - IDX_type_ascending = 0, - IDX_type_descending = 1 + IDX_type_none = 0, + IDX_type_descend = 1 }; typedef struct dudley_idx { diff --git a/src/dudley/exe.epp b/src/dudley/exe.epp index 84e6e1bd47..a8c5144722 100644 --- a/src/dudley/exe.epp +++ b/src/dudley/exe.epp @@ -1420,7 +1420,7 @@ 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 != IDX_type_none) { + if (index->idx_type) { X.RDB$INDEX_TYPE = index->idx_type; X.RDB$INDEX_TYPE.NULL = FALSE; } @@ -3706,9 +3706,7 @@ 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) - && (index->idx_type != IDX_type_none)) - { + if (index->idx_flags & IDX_type_flag) { X.RDB$INDEX_TYPE = index->idx_type; X.RDB$INDEX_TYPE.NULL = FALSE; } diff --git a/src/dudley/parse.cpp b/src/dudley/parse.cpp index 99827fdeeb..fd12cda905 100644 --- a/src/dudley/parse.cpp +++ b/src/dudley/parse.cpp @@ -1044,7 +1044,7 @@ static void define_index(void) SSHORT count; bool unique = false; bool inactive = false; - bool descending = false; + idx_direction descending = IDX_type_none; index_name = PARSE_symbol(tok_ident); MATCH(KW_FOR); @@ -1062,9 +1062,9 @@ static void define_index(void) else if (MATCH(KW_INACTIVE)) inactive = true; else if (MATCH(KW_ASCENDING)) - descending = false; + descending = IDX_type_none; else if (MATCH(KW_DESCENDING)) - descending = true; + descending = IDX_type_descend; else break; } @@ -1089,7 +1089,7 @@ static void define_index(void) index->idx_unique = unique; index->idx_description = description; index->idx_inactive = inactive; - index->idx_type = IDX_type_none; + index->idx_type = descending; 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 = IDX_type_ascending; + index->idx_type = IDX_type_none; index->idx_flags |= IDX_type_flag; } else if (MATCH(KW_DESCENDING)) { - index->idx_type = IDX_type_descending; + index->idx_type = IDX_type_descend; index->idx_flags |= IDX_type_flag; } else if (KEYWORD(KW_DESCRIPTION)) { diff --git a/src/dudley/trn.cpp b/src/dudley/trn.cpp index bf9671f38b..adb559060b 100644 --- a/src/dudley/trn.cpp +++ b/src/dudley/trn.cpp @@ -640,7 +640,7 @@ 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 != IDX_type_none) + if (index->idx_type) put_number(dyn, gds_dyn_idx_type, index->idx_type); put_text(dyn, gds_dyn_description, index->idx_description); @@ -1380,7 +1380,7 @@ 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) && (index->idx_type != IDX_type_none)) + if (index->idx_flags & IDX_type_flag) put_number(dyn, gds_dyn_idx_type, index->idx_type); if (index->idx_flags & IDX_null_description) {