8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Cleanup: initialization.

This commit is contained in:
Adriano dos Santos Fernandes 2023-09-18 20:27:13 -03:00
parent 4a752a3ec8
commit 0f083fd086
13 changed files with 207 additions and 307 deletions

View File

@ -24,8 +24,8 @@
* Adriano dos Santos Fernandes
*/
#ifndef JRD_DSC_H
#define JRD_DSC_H
#ifndef COMMON_DSC_H
#define COMMON_DSC_H
#include "firebird/impl/dsc_pub.h"
#include "firebird/impl/consts_pub.h"
@ -84,21 +84,25 @@ inline bool DTYPE_IS_NUMERIC(UCHAR d)
typedef struct dsc
{
dsc()
: dsc_dtype(0),
dsc_scale(0),
dsc_length(0),
dsc_sub_type(0),
dsc_flags(0),
dsc_address(0)
dsc() = default;
// These Ods::Descriptor constructor and operator were added to have
// interoperability between Ods::Descriptor and struct dsc
dsc(const Ods::Descriptor& od)
: dsc_dtype(od.dsc_dtype),
dsc_scale(od.dsc_scale),
dsc_length(od.dsc_length),
dsc_sub_type(od.dsc_sub_type),
dsc_flags(od.dsc_flags),
dsc_address((UCHAR*)(IPTR)(od.dsc_offset))
{}
UCHAR dsc_dtype;
SCHAR dsc_scale;
USHORT dsc_length;
SSHORT dsc_sub_type;
USHORT dsc_flags;
UCHAR* dsc_address; // Used either as offset in a message or as a pointer
UCHAR dsc_dtype = 0;
SCHAR dsc_scale = 0;
USHORT dsc_length = 0;
SSHORT dsc_sub_type = 0;
USHORT dsc_flags = 0;
UCHAR* dsc_address = nullptr; // Used either as offset in a message or as a pointer
#ifdef __cplusplus
SSHORT dsc_blob_ttype() const { return dsc_scale | (dsc_flags & 0xFF00);}
@ -497,17 +501,6 @@ typedef struct dsc
int getStringLength() const;
// These functions were added to have interoperability
// between Ods::Descriptor and struct dsc
dsc(const Ods::Descriptor& od)
: dsc_dtype(od.dsc_dtype),
dsc_scale(od.dsc_scale),
dsc_length(od.dsc_length),
dsc_sub_type(od.dsc_sub_type),
dsc_flags(od.dsc_flags),
dsc_address((UCHAR*)(IPTR)(od.dsc_offset))
{}
operator Ods::Descriptor() const
{
#ifdef DEV_BUILD
@ -621,4 +614,4 @@ inline SCHAR NUMERIC_SCALE(const dsc desc)
const UCHAR DEFAULT_DOUBLE = dtype_double;
#endif // JRD_DSC_H
#endif // COMMON_DSC_H

View File

@ -62,22 +62,12 @@ namespace {
DsqlBatch::DsqlBatch(DsqlDmlRequest* req, const dsql_msg* /*message*/, IMessageMetadata* inMeta, ClumpletReader& pb)
: m_dsqlRequest(req),
m_batch(NULL),
m_meta(inMeta),
m_messages(m_dsqlRequest->getPool()),
m_blobs(m_dsqlRequest->getPool()),
m_blobMap(m_dsqlRequest->getPool()),
m_blobMeta(m_dsqlRequest->getPool()),
m_defaultBpb(m_dsqlRequest->getPool()),
m_messageSize(0),
m_alignedMessage(0),
m_alignment(0),
m_flags(0),
m_detailed(DETAILED_LIMIT),
m_bufferSize(BUFFER_LIMIT),
m_lastBlob(MAX_ULONG),
m_setBlobSize(false),
m_blobPolicy(IBatch::BLOB_NONE)
m_defaultBpb(m_dsqlRequest->getPool())
{
memset(&m_genId, 0, sizeof(m_genId));

View File

@ -102,15 +102,15 @@ private:
}
DsqlDmlRequest* const m_dsqlRequest;
JBatch* m_batch;
Firebird::IMessageMetadata* m_meta;
JBatch* m_batch = nullptr;
Firebird::IMessageMetadata* const m_meta;
class DataCache : public Firebird::PermanentStorage
{
public:
DataCache(MemoryPool& p)
: PermanentStorage(p), m_cache(getPool()),
m_used(0), m_got(0), m_limit(0), m_shift(0), m_cacheCapacity(0)
: PermanentStorage(p),
m_cache(p)
{ }
void setBuf(ULONG size, ULONG cacheCapacity);
@ -130,7 +130,11 @@ private:
typedef Firebird::Array<UCHAR> Cache;
Cache m_cache;
Firebird::AutoPtr<TempSpace> m_space;
ULONG m_used, m_got, m_limit, m_shift, m_cacheCapacity;
ULONG m_used = 0;
ULONG m_got = 0;
ULONG m_limit = 0;
ULONG m_shift = 0;
ULONG m_cacheCapacity = 0;
};
struct BlobMeta
@ -141,21 +145,28 @@ private:
class QuadComparator
{
public:
static bool greaterThan(const ISC_QUAD& i1, const ISC_QUAD& i2)
{
return memcmp(&i1, &i2, sizeof(ISC_QUAD)) > 0;
}
static bool greaterThan(const ISC_QUAD& i1, const ISC_QUAD& i2)
{
return memcmp(&i1, &i2, sizeof(ISC_QUAD)) > 0;
}
};
DataCache m_messages, m_blobs;
Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<ISC_QUAD, ISC_QUAD> >, QuadComparator> m_blobMap;
DataCache m_messages;
DataCache m_blobs;
Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<ISC_QUAD, ISC_QUAD>>, QuadComparator> m_blobMap;
Firebird::HalfStaticArray<BlobMeta, 4> m_blobMeta;
typedef Firebird::HalfStaticArray<UCHAR, 64> Bpb;
Bpb m_defaultBpb;
ISC_QUAD m_genId;
ULONG m_messageSize, m_alignedMessage, m_alignment, m_flags, m_detailed, m_bufferSize, m_lastBlob;
bool m_setBlobSize;
UCHAR m_blobPolicy;
ULONG m_messageSize = 0;
ULONG m_alignedMessage = 0;
ULONG m_alignment = 0;
ULONG m_flags = 0;
ULONG m_detailed = DETAILED_LIMIT;
ULONG m_bufferSize = BUFFER_LIMIT;
ULONG m_lastBlob = MAX_ULONG;
bool m_setBlobSize = false;
UCHAR m_blobPolicy = Firebird::IBatch::BLOB_NONE;
};
} // namespace

View File

@ -79,54 +79,27 @@ public:
dbb(aDbb),
transaction(aTransaction),
dsqlStatement(aDsqlStatement),
flags(0),
nestingLevel(0),
relation(NULL),
mainContext(p),
context(&mainContext),
unionContext(p),
derivedContext(p),
outerAggContext(NULL),
contextNumber(0),
derivedContextNumber(0),
scopeLevel(0),
loopLevel(0),
labels(p),
cursorNumber(0),
cursors(p),
localTableNumber(0),
localTables(p),
inSelectList(0),
inWhereClause(0),
inGroupByClause(0),
inHavingClause(0),
inOrderByClause(0),
errorHandlers(0),
clientDialect(0),
inOuterJoin(0),
aliasRelationPrefix(p),
package(p),
currCtes(p),
recursiveCtx(0),
recursiveCtxId(0),
processingWindow(false),
checkConstraintTrigger(false),
hiddenVarsNumber(0),
hiddenVariables(p),
variables(p),
outputVariables(p),
returningClause(nullptr),
currCteAlias(NULL),
mainScratch(aMainScratch),
outerMessagesMap(p),
outerVarsMap(p),
ctes(p),
cteAliases(p),
psql(false),
subFunctions(p),
subProcedures(p)
{
domainValue.clear();
}
protected:
@ -277,59 +250,59 @@ private:
bool pass1RelProcIsRecursive(RecordSourceNode* input);
BoolExprNode* pass1JoinIsRecursive(RecordSourceNode*& input);
dsql_dbb* dbb; // DSQL attachment
jrd_tra* transaction; // Transaction
DsqlStatement* dsqlStatement; // DSQL statement
dsql_dbb* dbb = nullptr; // DSQL attachment
jrd_tra* transaction = nullptr; // Transaction
DsqlStatement* dsqlStatement = nullptr; // DSQL statement
public:
unsigned flags; // flags
unsigned nestingLevel; // begin...end nesting level
dsql_rel* relation; // relation created by this request (for DDL)
unsigned flags = 0; // flags
unsigned nestingLevel = 0; // begin...end nesting level
dsql_rel* relation = nullptr; // relation created by this request (for DDL)
DsqlContextStack mainContext;
DsqlContextStack* context;
DsqlContextStack unionContext; // Save contexts for views of unions
DsqlContextStack derivedContext; // Save contexts for views of derived tables
dsql_ctx* outerAggContext; // agg context for outer ref
DsqlContextStack* context = nullptr;
DsqlContextStack unionContext; // Save contexts for views of unions
DsqlContextStack derivedContext; // Save contexts for views of derived tables
dsql_ctx* outerAggContext = nullptr; // agg context for outer ref
// CVC: I think the two contexts may need a bigger var, too.
USHORT contextNumber; // Next available context number
USHORT derivedContextNumber; // Next available context number for derived tables
USHORT scopeLevel; // Scope level for parsing aliases in subqueries
USHORT loopLevel; // Loop level
Firebird::Stack<MetaName*> labels; // Loop labels
USHORT cursorNumber; // Cursor number
USHORT contextNumber = 0; // Next available context number
USHORT derivedContextNumber = 0; // Next available context number for derived tables
USHORT scopeLevel = 0; // Scope level for parsing aliases in subqueries
USHORT loopLevel = 0; // Loop level
Firebird::Stack<MetaName*> labels; // Loop labels
USHORT cursorNumber = 0; // Cursor number
Firebird::Array<DeclareCursorNode*> cursors; // Cursors
USHORT localTableNumber; // Local table number
USHORT localTableNumber = 0; // Local table number
Firebird::Array<DeclareLocalTableNode*> localTables; // Local tables
USHORT inSelectList; // now processing "select list"
USHORT inWhereClause; // processing "where clause"
USHORT inGroupByClause; // processing "group by clause"
USHORT inHavingClause; // processing "having clause"
USHORT inOrderByClause; // processing "order by clause"
USHORT errorHandlers; // count of active error handlers
USHORT clientDialect; // dialect passed into the API call
USHORT inOuterJoin; // processing inside outer-join part
USHORT inSelectList = 0; // now processing "select list"
USHORT inWhereClause = 0; // processing "where clause"
USHORT inGroupByClause = 0; // processing "group by clause"
USHORT inHavingClause = 0; // processing "having clause"
USHORT inOrderByClause = 0; // processing "order by clause"
USHORT errorHandlers = 0; // count of active error handlers
USHORT clientDialect = 0; // dialect passed into the API call
USHORT inOuterJoin = 0; // processing inside outer-join part
Firebird::string aliasRelationPrefix; // prefix for every relation-alias.
MetaName package; // package being defined
MetaName package; // package being defined
Firebird::Stack<SelectExprNode*> currCtes; // current processing CTE's
class dsql_ctx* recursiveCtx; // context of recursive CTE
USHORT recursiveCtxId; // id of recursive union stream context
bool processingWindow; // processing window functions
bool checkConstraintTrigger; // compiling a check constraint trigger
dsc domainValue; // VALUE in the context of domain's check constraint
USHORT hiddenVarsNumber; // next hidden variable number
dsql_ctx* recursiveCtx = nullptr; // context of recursive CTE
USHORT recursiveCtxId = 0; // id of recursive union stream context
bool processingWindow = false; // processing window functions
bool checkConstraintTrigger = false; // compiling a check constraint trigger
dsc domainValue; // VALUE in the context of domain's check constraint
USHORT hiddenVarsNumber = 0; // next hidden variable number
Firebird::Array<dsql_var*> hiddenVariables; // hidden variables
Firebird::Array<dsql_var*> variables;
Firebird::Array<dsql_var*> outputVariables;
ReturningClause* returningClause;
const Firebird::string* const* currCteAlias;
DsqlCompilerScratch* mainScratch;
ReturningClause* returningClause = nullptr;
const Firebird::string* const* currCteAlias = nullptr;
DsqlCompilerScratch* mainScratch = nullptr;
Firebird::NonPooledMap<USHORT, USHORT> outerMessagesMap; // <outer, inner>
Firebird::NonPooledMap<USHORT, USHORT> outerVarsMap; // <outer, inner>
private:
Firebird::HalfStaticArray<SelectExprNode*, 4> ctes; // common table expressions
Firebird::HalfStaticArray<const Firebird::string*, 4> cteAliases; // CTE aliases in recursive members
bool psql;
bool psql = false;
Firebird::LeftPooledMap<MetaName, DeclareSubFuncNode*> subFunctions;
Firebird::LeftPooledMap<MetaName, DeclareSubProcNode*> subProcedures;
};

View File

@ -7486,13 +7486,6 @@ ValueExprNode* InternalInfoNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
static RegisterNode<LiteralNode> regLiteralNode({blr_literal});
LiteralNode::LiteralNode(MemoryPool& pool)
: TypedNode<ValueExprNode, ExprNode::TYPE_LITERAL>(pool),
dsqlStr(NULL), litNumStringLength(0)
{
litDesc.clear();
}
// Parse a literal value.
DmlNode* LiteralNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/)
{

View File

@ -693,7 +693,6 @@ public:
explicit DomainValidationNode(MemoryPool& pool)
: TypedNode<ValueExprNode, ExprNode::TYPE_DOMAIN_VALIDATION>(pool)
{
domDesc.clear();
}
virtual Firebird::string internalPrint(NodePrinter& printer) const;
@ -918,7 +917,10 @@ public:
class LiteralNode final : public TypedNode<ValueExprNode, ExprNode::TYPE_LITERAL>
{
public:
explicit LiteralNode(MemoryPool& pool);
explicit LiteralNode(MemoryPool& pool)
: TypedNode<ValueExprNode, ExprNode::TYPE_LITERAL>(pool)
{
}
static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp);
static void genConstant(DsqlCompilerScratch* dsqlScratch, const dsc* desc, bool negateValue, USHORT numStringLength = 0);
@ -956,9 +958,9 @@ public:
void fixMinSInt128(MemoryPool& pool);
public:
const IntlString* dsqlStr;
const IntlString* dsqlStr = nullptr;
dsc litDesc;
USHORT litNumStringLength;
USHORT litNumStringLength = 0;
};

View File

@ -770,10 +770,8 @@ class ValueExprNode : public ExprNode
{
public:
ValueExprNode(Type aType, MemoryPool& pool)
: ExprNode(aType, pool),
nodScale(0)
: ExprNode(aType, pool)
{
dsqlDesc.clear();
}
public:
@ -848,7 +846,7 @@ public:
virtual dsc* execute(thread_db* tdbb, Request* request) const = 0;
public:
SCHAR nodScale;
SCHAR nodScale = 0;
protected:
dsc dsqlDesc;

View File

@ -510,7 +510,6 @@ public:
explicit DeclareVariableNode(MemoryPool& pool)
: TypedNode<StmtNode, StmtNode::TYPE_DECLARE_VARIABLE>(pool)
{
varDesc.clear();
}
public:

View File

@ -96,10 +96,7 @@ namespace Jrd
class MetaName;
typedef Firebird::Stack<dsql_ctx*> DsqlContextStack;
typedef Firebird::Pair<Firebird::Left<MetaName, NestConst<Jrd::WindowClause> > >
NamedWindowClause;
typedef Firebird::Pair<Firebird::Left<MetaName, NestConst<Jrd::WindowClause>>> NamedWindowClause;
typedef Firebird::ObjectsArray<NamedWindowClause> NamedWindowsClause;
}
@ -157,7 +154,7 @@ public:
{
}
class dsql_fld* rel_fields; // Field block
dsql_fld* rel_fields; // Field block
//dsql_rel* rel_base_relation; // base relation for an updatable view
MetaName rel_name; // Name of relation
MetaName rel_owner; // Owner of relation
@ -179,29 +176,12 @@ class TypeClause
{
public:
TypeClause(MemoryPool& pool, const MetaName& aCollate)
: dtype(dtype_unknown),
length(0),
scale(0),
subType(0),
segLength(0),
precision(0),
charLength(0),
collationId(0),
textType(0),
fullDomain(false),
notNull(false),
fieldSource(pool),
: fieldSource(pool),
typeOfTable(pool),
typeOfName(pool),
collate(pool, aCollate),
charSet(pool),
subTypeName(pool, NULL),
flags(0),
elementDtype(0),
elementLength(0),
dimensions(0),
ranges(NULL),
explicitCollation(false)
subTypeName(pool, nullptr)
{
}
@ -239,41 +219,37 @@ public:
}
public:
USHORT dtype;
FLD_LENGTH length;
SSHORT scale;
SSHORT subType;
USHORT segLength; // Segment length for blobs
USHORT precision; // Precision for exact numeric types
USHORT charLength; // Length of field in characters
USHORT dtype = dtype_unknown;
FLD_LENGTH length = 0;
SSHORT scale = 0;
SSHORT subType = 0;
USHORT segLength = 0; // Segment length for blobs
USHORT precision = 0; // Precision for exact numeric types
USHORT charLength = 0; // Length of field in characters
Nullable<SSHORT> charSetId;
SSHORT collationId;
SSHORT textType;
bool fullDomain; // Domain name without TYPE OF prefix
bool notNull; // NOT NULL was explicit specified
SSHORT collationId = 0;
SSHORT textType = 0;
bool fullDomain = false; // Domain name without TYPE OF prefix
bool notNull = false; // NOT NULL was explicit specified
MetaName fieldSource;
MetaName typeOfTable; // TYPE OF table name
MetaName typeOfName; // TYPE OF
MetaName typeOfTable; // TYPE OF table name
MetaName typeOfName; // TYPE OF
MetaName collate;
MetaName charSet; // empty means not specified
MetaName subTypeName; // Subtype name for later resolution
USHORT flags;
USHORT elementDtype; // Data type of array element
USHORT elementLength; // Length of array element
SSHORT dimensions; // Non-zero means array
ValueListNode* ranges; // ranges for multi dimension array
bool explicitCollation; // COLLATE was explicit specified
MetaName charSet; // empty means not specified
MetaName subTypeName; // Subtype name for later resolution
USHORT flags = 0;
USHORT elementDtype = 0; // Data type of array element
USHORT elementLength = 0; // Length of array element
SSHORT dimensions = 0; // Non-zero means array
ValueListNode* ranges = nullptr; // ranges for multi dimension array
bool explicitCollation = false; // COLLATE was explicit specified
};
class dsql_fld : public TypeClause
{
public:
explicit dsql_fld(MemoryPool& p)
: TypeClause(p, NULL),
fld_next(NULL),
fld_relation(NULL),
fld_procedure(NULL),
fld_id(0),
: TypeClause(p, nullptr),
fld_name(p)
{
}
@ -285,10 +261,10 @@ public:
}
public:
dsql_fld* fld_next; // Next field in relation
dsql_rel* fld_relation; // Parent relation
dsql_prc* fld_procedure; // Parent procedure
USHORT fld_id; // Field in in database
dsql_fld* fld_next = nullptr; // Next field in relation
dsql_rel* fld_relation = nullptr; // Parent relation
dsql_prc* fld_procedure = nullptr; // Parent procedure
USHORT fld_id = 0; // Field in in database
MetaName fld_name;
};
@ -319,16 +295,16 @@ public:
{
}
dsql_fld* prc_inputs; // Input parameters
dsql_fld* prc_outputs; // Output parameters
QualifiedName prc_name; // Name of procedure
MetaName prc_owner; // Owner of procedure
SSHORT prc_in_count;
SSHORT prc_def_count; // number of inputs with default values
SSHORT prc_out_count;
USHORT prc_id; // Procedure id
USHORT prc_flags;
bool prc_private; // Packaged private procedure
dsql_fld* prc_inputs = nullptr; // Input parameters
dsql_fld* prc_outputs = nullptr; // Output parameters
QualifiedName prc_name; // Name of procedure
MetaName prc_owner; // Owner of procedure
SSHORT prc_in_count = 0;
SSHORT prc_def_count = 0; // number of inputs with default values
SSHORT prc_out_count = 0;
USHORT prc_id = 0; // Procedure id
USHORT prc_flags = 0;
bool prc_private = false; // Packaged private procedure
};
// prc_flags bits
@ -344,21 +320,21 @@ class dsql_udf : public pool_alloc<dsql_type_udf>
{
public:
explicit dsql_udf(MemoryPool& p)
: udf_name(p), udf_arguments(p)
: udf_name(p),
udf_arguments(p)
{
}
USHORT udf_dtype;
SSHORT udf_scale;
SSHORT udf_sub_type;
USHORT udf_length;
SSHORT udf_character_set_id;
//USHORT udf_character_length;
USHORT udf_flags;
USHORT udf_dtype = 0;
SSHORT udf_scale = 0;
SSHORT udf_sub_type = 0;
USHORT udf_length = 0;
SSHORT udf_character_set_id = 0;
USHORT udf_flags = 0;
QualifiedName udf_name;
Firebird::Array<dsc> udf_arguments;
bool udf_private; // Packaged private function
SSHORT udf_def_count; // number of inputs with default values
bool udf_private = false; // Packaged private function
SSHORT udf_def_count = 0; // number of inputs with default values
};
// udf_flags bits
@ -388,7 +364,6 @@ public:
explicit dsql_var(MemoryPool& p)
: PermanentStorage(p)
{
desc.clear();
}
dsql_fld* field = nullptr; // Field on which variable is based
@ -414,12 +389,12 @@ public:
}
MetaName intlsym_name;
USHORT intlsym_type; // what type of name
USHORT intlsym_flags;
SSHORT intlsym_ttype; // id of implementation
SSHORT intlsym_charset_id;
SSHORT intlsym_collate_id;
USHORT intlsym_bytes_per_char;
USHORT intlsym_type = 0; // what type of name
USHORT intlsym_flags = 0;
SSHORT intlsym_ttype = 0; // id of implementation
SSHORT intlsym_charset_id = 0;
SSHORT intlsym_collate_id = 0;
USHORT intlsym_bytes_per_char = 0;
};
// values used in intlsym_flags
@ -432,24 +407,21 @@ enum intlsym_flags_vals {
class ImplicitJoin : public pool_alloc<dsql_type_imp_join>
{
public:
ValueExprNode* value;
dsql_ctx* visibleInContext;
ValueExprNode* value = nullptr;
dsql_ctx* visibleInContext = nullptr;
};
struct WindowMap
{
WindowMap(WindowClause* aWindow)
: partitionRemapped(NULL),
window(aWindow),
map(NULL),
context(0)
: window(aWindow)
{
}
NestConst<ValueListNode> partitionRemapped;
NestConst<WindowClause> window;
dsql_map* map;
USHORT context;
dsql_map* map = nullptr;
USHORT context = 0;
};
//! Context block used to create an instance of a relation reference
@ -467,21 +439,21 @@ public:
{
}
dsql_rel* ctx_relation; // Relation for context
dsql_prc* ctx_procedure; // Procedure for context
dsql_rel* ctx_relation = nullptr; // Relation for context
dsql_prc* ctx_procedure = nullptr; // Procedure for context
NestConst<ValueListNode> ctx_proc_inputs; // Procedure input parameters
dsql_map* ctx_map; // Maps for aggregates and unions
RseNode* ctx_rse; // Sub-rse for aggregates
dsql_ctx* ctx_parent; // Parent context for aggregates
USHORT ctx_context; // Context id
USHORT ctx_recursive; // Secondary context id for recursive UNION (nobody referred to this context)
USHORT ctx_scope_level; // Subquery level within this request
USHORT ctx_flags; // Various flag values
USHORT ctx_in_outer_join; // inOuterJoin when context was created
Firebird::string ctx_alias; // Context alias (can include concatenated derived table alias)
Firebird::string ctx_internal_alias; // Alias as specified in query
DsqlContextStack ctx_main_derived_contexts; // contexts used for blr_derived_expr
DsqlContextStack ctx_childs_derived_table; // Childs derived table context
dsql_map* ctx_map = nullptr; // Maps for aggregates and unions
RseNode* ctx_rse = nullptr; // Sub-rse for aggregates
dsql_ctx* ctx_parent = nullptr; // Parent context for aggregates
USHORT ctx_context = 0; // Context id
USHORT ctx_recursive = 0; // Secondary context id for recursive UNION (nobody referred to this context)
USHORT ctx_scope_level = 0; // Subquery level within this request
USHORT ctx_flags = 0; // Various flag values
USHORT ctx_in_outer_join = 0; // inOuterJoin when context was created
Firebird::string ctx_alias; // Context alias (can include concatenated derived table alias)
Firebird::string ctx_internal_alias; // Alias as specified in query
DsqlContextStack ctx_main_derived_contexts; // contexts used for blr_derived_expr
DsqlContextStack ctx_childs_derived_table; // Childs derived table context
Firebird::LeftPooledMap<MetaName, ImplicitJoin*> ctx_imp_join; // Map of USING fieldname to ImplicitJoin
Firebird::Array<WindowMap*> ctx_win_maps; // Maps for window functions
Firebird::GenericMap<NamedWindowClause> ctx_named_windows;
@ -539,9 +511,9 @@ const USHORT CTX_lateral = 0x100; // Context is a lateral derived table
class dsql_map : public pool_alloc<dsql_type_map>
{
public:
dsql_map* map_next; // Next map in item
dsql_map* map_next = nullptr; // Next map in item
NestConst<ValueExprNode> map_node; // Value for map item
USHORT map_position; // Position in map
USHORT map_position = 0; // Position in map
NestConst<WindowMap> map_window; // Partition
};
@ -551,21 +523,16 @@ class dsql_msg : public Firebird::PermanentStorage
public:
explicit dsql_msg(MemoryPool& p)
: PermanentStorage(p),
msg_parameters(p),
msg_number(0),
msg_buffer_number(0),
msg_length(0),
msg_parameter(0),
msg_index(0)
msg_parameters(p)
{
}
Firebird::Array<dsql_par*> msg_parameters; // Parameter list
USHORT msg_number; // Message number
USHORT msg_buffer_number; // Message buffer number (used instead of msg_number for blob msgs)
ULONG msg_length; // Message length
USHORT msg_parameter; // Next parameter number
USHORT msg_index; // Next index into SQLDA
USHORT msg_number = 0; // Message number
USHORT msg_buffer_number = 0; // Message buffer number (used instead of msg_number for blob msgs)
ULONG msg_length = 0; // Message length
USHORT msg_parameter = 0; // Next parameter number
USHORT msg_index = 0; // Next index into SQLDA
};
// Parameter block used to describe a parameter of a message
@ -574,37 +541,30 @@ class dsql_par : public Firebird::PermanentStorage
public:
explicit dsql_par(MemoryPool& p)
: PermanentStorage(p),
par_message(NULL),
par_null(NULL),
par_node(NULL),
par_dbkey_relname(p),
par_rec_version_relname(p),
par_name(p),
par_rel_name(p),
par_owner_name(p),
par_rel_alias(p),
par_alias(p),
par_parameter(0),
par_index(0),
par_is_text(false)
par_alias(p)
{
par_desc.clear();
}
dsql_msg* par_message; // Parent message
dsql_par* par_null; // Null parameter, if used
ValueExprNode* par_node; // Associated value node, if any
MetaName par_dbkey_relname; // Context of internally requested dbkey
dsql_msg* par_message = nullptr; // Parent message
dsql_par* par_null = nullptr; // Null parameter, if used
ValueExprNode* par_node = nullptr; // Associated value node, if any
MetaName par_dbkey_relname; // Context of internally requested dbkey
MetaName par_rec_version_relname; // Context of internally requested rec. version
MetaName par_name; // Parameter name, if any
MetaName par_rel_name; // Relation name, if any
MetaName par_name; // Parameter name, if any
MetaName par_rel_name; // Relation name, if any
MetaName par_owner_name; // Owner name, if any
MetaName par_rel_alias; // Relation alias, if any
MetaName par_alias; // Alias, if any
dsc par_desc; // Field data type
USHORT par_parameter; // BLR parameter number
USHORT par_index; // Index into SQLDA, if appropriate
bool par_is_text; // Parameter should be dtype_text (SQL_TEXT) externaly
MetaName par_rel_alias; // Relation alias, if any
MetaName par_alias; // Alias, if any
dsc par_desc; // Field data type
USHORT par_parameter = 0; // BLR parameter number
USHORT par_index = 0; // Index into SQLDA, if appropriate
bool par_is_text = false; // Parameter should be dtype_text (SQL_TEXT) externaly
};
class CStrCmp
@ -698,16 +658,13 @@ private:
struct SignatureParameter
{
explicit SignatureParameter(MemoryPool& p)
: type(0),
number(0),
name(p),
: name(p),
fieldSource(p),
fieldName(p),
relationName(p),
charSetName(p),
collationName(p),
subTypeName(p),
mechanism(0)
subTypeName(p)
{
}
@ -758,8 +715,8 @@ struct SignatureParameter
mechanism = (SSHORT) type->fullDomain;
}
SSHORT type;
SSHORT number;
SSHORT type = 0;
SSHORT number = 0;
MetaName name;
MetaName fieldSource;
MetaName fieldName;
@ -769,7 +726,7 @@ struct SignatureParameter
MetaName subTypeName;
Nullable<SSHORT> collationId;
Nullable<SSHORT> nullFlag;
SSHORT mechanism;
SSHORT mechanism = 0;
Nullable<SSHORT> fieldLength;
Nullable<SSHORT> fieldScale;
Nullable<SSHORT> fieldType;
@ -826,25 +783,19 @@ struct Signature
Signature(MemoryPool& p, const MetaName& aName)
: name(p, aName),
parameters(p),
flags(0),
defined(false)
parameters(p)
{
}
explicit Signature(const MetaName& aName)
: name(aName),
parameters(*getDefaultMemoryPool()),
flags(0),
defined(false)
parameters(*getDefaultMemoryPool())
{
}
explicit Signature(MemoryPool& p)
: name(p),
parameters(p),
flags(0),
defined(false)
parameters(p)
{
}
@ -891,8 +842,8 @@ struct Signature
MetaName name;
Firebird::SortedObjectsArray<SignatureParameter> parameters;
unsigned flags;
bool defined;
unsigned flags = 0;
bool defined = false;
};

View File

@ -41,13 +41,6 @@ class TypeClause;
class CoercionRule
{
public:
CoercionRule()
: fromMask(0), toMask(0)
{
fromDsc.clear();
toDsc.clear();
}
void setRule(const TypeClause* from, const TypeClause *to);
dsc* makeLegacy(USHORT mask = 0);
bool coerce(thread_db* tdbb, dsc* d) const;
@ -56,8 +49,11 @@ public:
private:
void raiseError();
dsc fromDsc, toDsc;
USHORT fromMask, toMask;
dsc fromDsc;
dsc toDsc;
USHORT fromMask = 0;
USHORT toMask = 0;
};
class CoercionArray : public Firebird::HalfStaticArray<CoercionRule, 4>

View File

@ -2387,10 +2387,9 @@ dsc* evlBlobAppend(thread_db* tdbb, const SysFunction* function, const NestValue
blb* blob = NULL;
bid blob_id;
dsc blobDsc;
blob_id.clear();
blobDsc.clear();
dsc blobDsc;
const dsc* argDsc = EVL_expr(tdbb, request, args[0]);
const bool arg0_null = (request->req_flags & req_null) || (argDsc == NULL);

View File

@ -2604,8 +2604,7 @@ static void move_from_string(thread_db* tdbb, const dsc* from_desc, dsc* to_desc
temp_bid.clear();
blb* blob = blb::create2(tdbb, transaction, &temp_bid, bpb.getCount(), bpb.begin());
DSC blob_desc;
blob_desc.clear();
dsc blob_desc;
blob_desc.dsc_scale = to_desc->dsc_scale; // blob charset
blob_desc.dsc_flags = (blob_desc.dsc_flags & 0xFF) | (to_desc->dsc_flags & 0xFF00); // blob collation

View File

@ -128,12 +128,8 @@ class AggregateSort : protected Firebird::PermanentStorage, public Printable
public:
explicit AggregateSort(Firebird::MemoryPool& p)
: PermanentStorage(p),
length(0),
intl(false),
impure(0),
keyItems(p)
{
desc.clear();
}
public:
@ -144,9 +140,9 @@ public:
public:
dsc desc;
ULONG length;
bool intl;
ULONG impure;
ULONG length = 0;
bool intl = false;
ULONG impure = 0;
Firebird::HalfStaticArray<sort_key_def, 2> keyItems;
};