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

Refactored nod_dom_value.

This commit is contained in:
asfernandes 2011-02-16 01:38:48 +00:00
parent f062c62d7f
commit c87b541ae2
8 changed files with 37 additions and 52 deletions

View File

@ -4123,6 +4123,38 @@ dsc* DerivedExprNode::execute(thread_db* tdbb, jrd_req* request) const
//--------------------
void DomainValidationNode::print(Firebird::string& text, Firebird::Array<dsql_nod*>& 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;

View File

@ -444,27 +444,15 @@ public:
domDesc.clear();
}
// This is a non-DSQL node.
virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const
{
fb_assert(false);
}
virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& 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;

View File

@ -375,9 +375,6 @@ inline bool DsqlNodeVisitor<T, T2>::visitChildren(T node)
break;
}
case nod_dom_value:
break;
case nod_alias:
ret |= visit(&node->nod_arg[e_alias_value]);
break;

View File

@ -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]);

View File

@ -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;
}
}

View File

@ -114,7 +114,6 @@ enum nod_t
nod_order,
nod_flag,
nod_unique,
nod_dom_value,
nod_field_name,
nod_alias,
nod_user_name,

View File

@ -5275,7 +5275,7 @@ common_value
| symbol_table_alias_name '.' DB_KEY
{ $$ = makeClassNode(newNode<RecordKeyNode>(blr_dbkey, toName($1))); }
| KW_VALUE
{ $$ = make_node (nod_dom_value, 0, NULL); }
{ $$ = makeClassNode(newNode<DomainValidationNode>()); }
| datetime_value_expression
{ $$ = makeClassNode($1); }
| null_value

View File

@ -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;