From 4580126101d5740f8a1282f290e881841a8604ee Mon Sep 17 00:00:00 2001 From: robocop Date: Wed, 16 Apr 2008 10:38:08 +0000 Subject: [PATCH] Do not use flags for values that are exclusive (can't be combined). --- src/dsql/ddl.cpp | 2 +- src/dsql/dsql.h | 11 +++-------- src/dsql/gen.cpp | 2 +- src/dsql/make.cpp | 5 +++-- src/dsql/make_proto.h | 14 ++++++++++++-- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index 56b5569940..a160dbf499 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -6286,7 +6286,7 @@ static void put_local_variables(dsql_req* request, dsql_nod* parameters, } dsql_nod* var_node = - MAKE_variable(field, field->fld_name.c_str(), VAR_output, 0, 0, locals); + MAKE_variable(field, field->fld_name.c_str(), VAR_local, 0, 0, locals); *ptr = var_node; dsql_var* variable = (dsql_var*) var_node->nod_arg[e_var_variable]; diff --git a/src/dsql/dsql.h b/src/dsql/dsql.h index adafc23caa..9cfe708221 100644 --- a/src/dsql/dsql.h +++ b/src/dsql/dsql.h @@ -313,20 +313,15 @@ class dsql_var : public pool_alloc_rpt { public: dsql_fld* var_field; //!< Field on which variable is based - USHORT var_flags; + USHORT var_flags; // Reserved + //dsql_var_type var_type; // Too cumbersome to compile the right data type. + int var_type; // Input, output or local var. USHORT var_msg_number; //!< Message number containing variable USHORT var_msg_item; //!< Item number in message USHORT var_variable_number; //!< Local variable number TEXT var_name[2]; }; -// values used in var_flags -enum var_flags_vals { - VAR_input = 1, - VAR_output = 2, - VAR_local = 4 -}; - // Symbolic names for international text types // (either collation or character set name) diff --git a/src/dsql/gen.cpp b/src/dsql/gen.cpp index 31cb8eb384..70d722db30 100644 --- a/src/dsql/gen.cpp +++ b/src/dsql/gen.cpp @@ -220,7 +220,7 @@ void GEN_expr( dsql_req* request, dsql_nod* node) case nod_variable: variable = (dsql_var*) node->nod_arg[e_var_variable]; - if (variable->var_flags & VAR_input) { + if (variable->var_type == VAR_input) { stuff(request, blr_parameter2); stuff(request, variable->var_msg_number); stuff_word(request, variable->var_msg_item); diff --git a/src/dsql/make.cpp b/src/dsql/make.cpp index 0a3aec63d9..114a10d728 100644 --- a/src/dsql/make.cpp +++ b/src/dsql/make.cpp @@ -1821,7 +1821,7 @@ dsql_nod* MAKE_trigger_type(dsql_nod* prefix_node, dsql_nod* suffix_node) **/ dsql_nod* MAKE_variable(dsql_fld* field, const TEXT* name, - USHORT type, + const dsql_var_type type, USHORT msg_number, USHORT item_number, USHORT local_number) { DEV_BLKCHK(field, dsql_type_fld); @@ -1836,7 +1836,8 @@ dsql_nod* MAKE_variable(dsql_fld* field, variable->var_variable_number = local_number; variable->var_field = field; strcpy(variable->var_name, name); - variable->var_flags = type; + variable->var_flags = 0; + variable->var_type = type; MAKE_desc_from_field(&node->nod_desc, field); return node; diff --git a/src/dsql/make_proto.h b/src/dsql/make_proto.h index 171eb719e6..9307886380 100644 --- a/src/dsql/make_proto.h +++ b/src/dsql/make_proto.h @@ -44,6 +44,15 @@ namespace Jrd { CONSTANT_TIMESTAMP = 5, // stored as a QUAD CONSTANT_SINT64 = 6 // stored as a SINT64 }; + + // Parameters to MAKE_variable + enum dsql_var_type + { + VAR_input, + VAR_output, + VAR_local + }; + }; @@ -64,8 +73,9 @@ Jrd::dsql_sym* MAKE_symbol(Jrd::dsql_dbb*, const TEXT*, USHORT, Jrd::sym_type, Jrd::dsql_req*); Jrd::dsql_str* MAKE_tagged_string(const char* str, size_t length, const char* charset); Jrd::dsql_nod* MAKE_trigger_type(Jrd::dsql_nod*, Jrd::dsql_nod*); -Jrd::dsql_nod* MAKE_variable(Jrd::dsql_fld*, const TEXT*, USHORT, USHORT, - USHORT, USHORT); +Jrd::dsql_nod* MAKE_variable(Jrd::dsql_fld*, const TEXT*, + const Jrd::dsql_var_type type, USHORT, + USHORT, USHORT); #endif // DSQL_MAKE_PROTO_H