mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 10:03:03 +01:00
Remove dsqlCompatDialectVerb field and organize some members in AggNode for better alignment.
This commit is contained in:
parent
0ffd7b571c
commit
061d6af342
@ -56,10 +56,10 @@ AggNode::AggNode(MemoryPool& pool, const AggInfo& aAggInfo, bool aDistinct, bool
|
||||
ValueExprNode* aArg)
|
||||
: TypedNode<ValueExprNode, ExprNode::TYPE_AGGREGATE>(pool),
|
||||
aggInfo(aAggInfo),
|
||||
distinct(aDistinct),
|
||||
dialect1(aDialect1),
|
||||
arg(aArg),
|
||||
asb(NULL),
|
||||
distinct(aDistinct),
|
||||
dialect1(aDialect1),
|
||||
indexed(false)
|
||||
{
|
||||
addChildNode(arg, arg);
|
||||
@ -474,7 +474,6 @@ AvgAggNode::AvgAggNode(MemoryPool& pool, bool aDistinct, bool aDialect1, ValueEx
|
||||
: AggNode(pool, avgAggInfo, aDistinct, aDialect1, aArg),
|
||||
tempImpure(0)
|
||||
{
|
||||
dsqlCompatDialectVerb = "avg";
|
||||
}
|
||||
|
||||
DmlNode* AvgAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
|
||||
@ -964,7 +963,6 @@ static AggNode::Register<SumAggNode> sumAggInfo("SUM", blr_agg_total, blr_agg_to
|
||||
SumAggNode::SumAggNode(MemoryPool& pool, bool aDistinct, bool aDialect1, ValueExprNode* aArg)
|
||||
: AggNode(pool, sumAggInfo, aDistinct, aDialect1, aArg)
|
||||
{
|
||||
dsqlCompatDialectVerb = "sum";
|
||||
}
|
||||
|
||||
DmlNode* SumAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp)
|
||||
|
@ -37,6 +37,11 @@ public:
|
||||
|
||||
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
|
||||
|
||||
virtual const char* getCompatDialectVerb()
|
||||
{
|
||||
return "avg";
|
||||
}
|
||||
|
||||
virtual unsigned getCapabilities() const
|
||||
{
|
||||
return CAP_RESPECTS_WINDOW_FRAME | CAP_WANTS_AGG_CALLS;
|
||||
@ -123,6 +128,11 @@ public:
|
||||
|
||||
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
|
||||
|
||||
virtual const char* getCompatDialectVerb()
|
||||
{
|
||||
return "sum";
|
||||
}
|
||||
|
||||
virtual unsigned getCapabilities() const
|
||||
{
|
||||
return CAP_RESPECTS_WINDOW_FRAME | CAP_WANTS_AGG_CALLS;
|
||||
|
@ -397,29 +397,7 @@ ArithmeticNode::ArithmeticNode(MemoryPool& pool, UCHAR aBlrOp, bool aDialect1,
|
||||
arg1(aArg1),
|
||||
arg2(aArg2)
|
||||
{
|
||||
switch (blrOp)
|
||||
{
|
||||
case blr_add:
|
||||
dsqlCompatDialectVerb = "add";
|
||||
break;
|
||||
|
||||
case blr_subtract:
|
||||
dsqlCompatDialectVerb = "subtract";
|
||||
break;
|
||||
|
||||
case blr_multiply:
|
||||
dsqlCompatDialectVerb = "multiply";
|
||||
break;
|
||||
|
||||
case blr_divide:
|
||||
dsqlCompatDialectVerb = "divide";
|
||||
break;
|
||||
|
||||
default:
|
||||
fb_assert(false);
|
||||
}
|
||||
|
||||
label = dsqlCompatDialectVerb;
|
||||
label = getCompatDialectVerb();
|
||||
label.upper();
|
||||
|
||||
addChildNode(arg1, arg1);
|
||||
|
@ -47,6 +47,28 @@ public:
|
||||
|
||||
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
|
||||
|
||||
virtual const char* getCompatDialectVerb()
|
||||
{
|
||||
switch (blrOp)
|
||||
{
|
||||
case blr_add:
|
||||
return "add";
|
||||
|
||||
case blr_subtract:
|
||||
return "subtract";
|
||||
|
||||
case blr_multiply:
|
||||
return "multiply";
|
||||
|
||||
case blr_divide:
|
||||
return "divide";
|
||||
|
||||
default:
|
||||
fb_assert(false);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
virtual Firebird::string internalPrint(NodePrinter& printer) const;
|
||||
virtual ValueExprNode* dsqlPass(DsqlCompilerScratch* dsqlScratch);
|
||||
virtual void setParameterName(dsql_par* parameter) const;
|
||||
|
@ -533,12 +533,16 @@ public:
|
||||
type(aType),
|
||||
nodFlags(0),
|
||||
impureOffset(0),
|
||||
dsqlCompatDialectVerb(NULL),
|
||||
dsqlChildNodes(pool),
|
||||
jrdChildNodes(pool)
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char* getCompatDialectVerb()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Allocate and assign impure space for various nodes.
|
||||
template <typename T> static void doPass2(thread_db* tdbb, CompilerScratch* csb, T** node)
|
||||
{
|
||||
@ -711,7 +715,6 @@ public:
|
||||
const Type type;
|
||||
unsigned nodFlags;
|
||||
ULONG impureOffset;
|
||||
const char* dsqlCompatDialectVerb;
|
||||
Firebird::Array<NodeRef*> dsqlChildNodes;
|
||||
Firebird::Array<NodeRef*> jrdChildNodes;
|
||||
};
|
||||
@ -1074,10 +1077,10 @@ protected:
|
||||
|
||||
public:
|
||||
const AggInfo& aggInfo;
|
||||
bool distinct;
|
||||
bool dialect1;
|
||||
NestConst<ValueExprNode> arg;
|
||||
const AggregateSort* asb;
|
||||
bool distinct;
|
||||
bool dialect1;
|
||||
bool indexed;
|
||||
|
||||
private:
|
||||
|
@ -124,8 +124,10 @@ void GEN_expr(DsqlCompilerScratch* dsqlScratch, ExprNode* node)
|
||||
|
||||
// ASF: Shouldn't we check nod_gen_id2 too?
|
||||
|
||||
if (node->kind == DmlNode::KIND_VALUE && node->dsqlCompatDialectVerb &&
|
||||
dsqlScratch->clientDialect == SQL_DIALECT_V6_TRANSITION)
|
||||
const char* compatDialectVerb;
|
||||
|
||||
if (node->kind == DmlNode::KIND_VALUE && dsqlScratch->clientDialect == SQL_DIALECT_V6_TRANSITION &&
|
||||
(compatDialectVerb = node->getCompatDialectVerb()))
|
||||
{
|
||||
dsc desc;
|
||||
MAKE_desc(dsqlScratch, &desc, static_cast<ValueExprNode*>(node));
|
||||
@ -134,7 +136,7 @@ void GEN_expr(DsqlCompilerScratch* dsqlScratch, ExprNode* node)
|
||||
{
|
||||
ERRD_post_warning(
|
||||
Arg::Warning(isc_dsql_dialect_warning_expr) <<
|
||||
Arg::Str(node->dsqlCompatDialectVerb));
|
||||
Arg::Str(compatDialectVerb));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user