diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp index 2acdc967a6..c474c14f59 100644 --- a/src/dsql/ExprNodes.cpp +++ b/src/dsql/ExprNodes.cpp @@ -4123,6 +4123,38 @@ dsc* DerivedExprNode::execute(thread_db* tdbb, jrd_req* request) const //-------------------- +void DomainValidationNode::print(Firebird::string& text, Firebird::Array& nodes) const +{ + text.printf("DomainValidationNode"); + ExprNode::print(text, nodes); +} + +ValueExprNode* DomainValidationNode::dsqlPass(DsqlCompilerScratch* dsqlScratch) +{ + if (dsqlScratch->domainValue.isUnknown()) + { + ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << + Arg::Gds(isc_dsql_domain_err)); + } + + DomainValidationNode* node = FB_NEW(getPool()) DomainValidationNode(getPool()); + node->domDesc = dsqlScratch->domainValue; + + return node; +} + +void DomainValidationNode::genBlr(DsqlCompilerScratch* dsqlScratch) +{ + dsqlScratch->appendUChar(blr_fid); + dsqlScratch->appendUChar(0); // context + dsqlScratch->appendUShort(0); // field id +} + +void DomainValidationNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc) +{ + *desc = domDesc; +} + void DomainValidationNode::getDesc(thread_db* /*tdbb*/, CompilerScratch* /*csb*/, dsc* desc) { *desc = domDesc; diff --git a/src/dsql/ExprNodes.h b/src/dsql/ExprNodes.h index 1c3500c597..b9b232e8f2 100644 --- a/src/dsql/ExprNodes.h +++ b/src/dsql/ExprNodes.h @@ -444,27 +444,15 @@ public: domDesc.clear(); } - // This is a non-DSQL node. - - virtual void print(Firebird::string& text, Firebird::Array& nodes) const - { - fb_assert(false); - } + virtual void print(Firebird::string& text, Firebird::Array& nodes) const; + virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch); virtual void setParameterName(dsql_par* parameter) const { - fb_assert(false); } - virtual void genBlr(DsqlCompilerScratch* dsqlScratch) - { - fb_assert(false); - } - - virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc) - { - fb_assert(false); - } + virtual void genBlr(DsqlCompilerScratch* dsqlScratch); + virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; diff --git a/src/dsql/Visitors.h b/src/dsql/Visitors.h index b00b4ca7f0..8b43c9ba35 100644 --- a/src/dsql/Visitors.h +++ b/src/dsql/Visitors.h @@ -375,9 +375,6 @@ inline bool DsqlNodeVisitor::visitChildren(T node) break; } - case nod_dom_value: - break; - case nod_alias: ret |= visit(&node->nod_arg[e_alias_value]); break; diff --git a/src/dsql/gen.cpp b/src/dsql/gen.cpp index b98be3f435..07056992f6 100644 --- a/src/dsql/gen.cpp +++ b/src/dsql/gen.cpp @@ -157,12 +157,6 @@ void GEN_expr(DsqlCompilerScratch* dsqlScratch, dsql_nod* node) GEN_expr(dsqlScratch, node->nod_arg[e_alias_value]); return; - case nod_dom_value: - dsqlScratch->appendUChar(blr_fid); - dsqlScratch->appendUChar(0); // Context - dsqlScratch->appendUShort(0); // Field id - return; - case nod_assign: dsqlScratch->appendUChar(blr_assignment); GEN_expr(dsqlScratch, node->nod_arg[0]); diff --git a/src/dsql/make.cpp b/src/dsql/make.cpp index 9dfd1213b1..1805d84a9f 100644 --- a/src/dsql/make.cpp +++ b/src/dsql/make.cpp @@ -404,17 +404,6 @@ void MAKE_desc(DsqlCompilerScratch* dsqlScratch, dsc* desc, dsql_nod* node) default: fb_assert(false); // unexpected dsql_nod type - - case nod_dom_value: // computed value not used - // By the time we get here, any nod_dom_value node should have had - // its descriptor set to the type of the domain being created, or - // to the type of the existing domain to which a CHECK constraint - // is being added. - - fb_assert(node->nod_desc.dsc_dtype != dtype_unknown); - if (desc != &node->nod_desc) - *desc = node->nod_desc; - return; } } diff --git a/src/dsql/node.h b/src/dsql/node.h index c73671fc3e..a326c66a45 100644 --- a/src/dsql/node.h +++ b/src/dsql/node.h @@ -114,7 +114,6 @@ enum nod_t nod_order, nod_flag, nod_unique, - nod_dom_value, nod_field_name, nod_alias, nod_user_name, diff --git a/src/dsql/parse.y b/src/dsql/parse.y index 3e43ed86c7..8040832c8c 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -5275,7 +5275,7 @@ common_value | symbol_table_alias_name '.' DB_KEY { $$ = makeClassNode(newNode(blr_dbkey, toName($1))); } | KW_VALUE - { $$ = make_node (nod_dom_value, 0, NULL); } + { $$ = makeClassNode(newNode()); } | datetime_value_expression { $$ = makeClassNode($1); } | null_value diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 18261b7972..a69c564cc8 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -928,17 +928,6 @@ dsql_nod* PASS1_node(DsqlCompilerScratch* dsqlScratch, dsql_nod* input) node->nod_arg[1] = input->nod_arg[1]; return node; - case nod_dom_value: - if (dsqlScratch->domainValue.isUnknown()) - { - ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-901) << - Arg::Gds(isc_dsql_domain_err)); - } - - node = MAKE_node(input->nod_type, input->nod_count); - node->nod_desc = dsqlScratch->domainValue; - return node; - case nod_returning: return pass1_returning(dsqlScratch, input); @@ -7279,9 +7268,6 @@ void DSQL_pretty(const dsql_nod* node, int column) case nod_end_savepoint: verb = "end_savepoint"; break; - case nod_dom_value: - verb = "dom_value"; - break; case nod_user_group: verb = "user_group"; break;