mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Cleanup.
This commit is contained in:
parent
2dfbdef005
commit
81609a77d7
@ -294,7 +294,7 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, RelationSourceNode* relati
|
||||
ValueSourceClause* clause, string& source, BlrWriter::BlrData& value)
|
||||
{
|
||||
// Get the table node and set up correct context.
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
// Save the size of the field if it is specified.
|
||||
dsc saveDesc;
|
||||
@ -364,7 +364,7 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, RelationSourceNode* relati
|
||||
field->fld_sub_type = desc.dsc_sub_type;
|
||||
}
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
// Generate the source text.
|
||||
source = clause->source;
|
||||
@ -935,7 +935,7 @@ TypeClause::TypeClause(MemoryPool& pool, dsql_fld* aLegacyField, const MetaName&
|
||||
|
||||
void TypeClause::resolve(DsqlCompilerScratch* dsqlScratch, bool modifying)
|
||||
{
|
||||
DDL_resolve_intl_type2(dsqlScratch, legacyField,
|
||||
DDL_resolve_intl_type(dsqlScratch, legacyField,
|
||||
(collate.isEmpty() ? NULL : collate), modifying);
|
||||
|
||||
setup(dsqlScratch);
|
||||
@ -3194,7 +3194,7 @@ void CreateAlterTriggerNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch* d
|
||||
// fields to that context but prevent relations referenced in
|
||||
// the trigger actions from referencing the predefined "1" context.
|
||||
if (dsqlScratch->contextNumber)
|
||||
dsqlScratch->resetContextStack();
|
||||
dsqlScratch->resetTriggerContextStack();
|
||||
|
||||
if (relationName.hasData())
|
||||
{
|
||||
@ -5995,7 +5995,7 @@ void RelationNode::defineCheckConstraintTrigger(DsqlCompilerScratch* dsqlScratch
|
||||
// place holder to avoid resolving fields to that context but prevent relations referenced
|
||||
// in the trigger actions from referencing the predefined "1" context.
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
// CVC: I thought I could disable the OLD context here to avoid "ambiguous field name"
|
||||
// errors in pre_store and pre_modify triggers. Also, what sense can I make from NEW in
|
||||
@ -6026,7 +6026,7 @@ void RelationNode::defineCheckConstraintTrigger(DsqlCompilerScratch* dsqlScratch
|
||||
|
||||
dsqlScratch->appendUChar(blr_eoc); // end of the blr
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
// Move the blr to the constraint blrWriter.
|
||||
blrWriter.getBlrData().join(dsqlScratch->getBlrData());
|
||||
@ -7454,7 +7454,7 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
||||
// context number since view contexts start at 1 (except for computed fields) -- note that
|
||||
// calling PASS1_rse directly rather than PASS1_statement saves the context stack.
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
++dsqlScratch->contextNumber;
|
||||
RseNode* rse = PASS1_rse(dsqlScratch, selectExpr, NULL);
|
||||
|
||||
@ -7972,7 +7972,7 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
||||
createCheckTrigger(tdbb, dsqlScratch, items);
|
||||
}
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name);
|
||||
|
||||
@ -8008,7 +8008,7 @@ void CreateAlterViewNode::createCheckTrigger(thread_db* tdbb, DsqlCompilerScratc
|
||||
|
||||
dsqlScratch->appendUChar(blr_begin);
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
++dsqlScratch->contextNumber; // OLD context
|
||||
|
||||
@ -8089,7 +8089,7 @@ void CreateAlterViewNode::createCheckTrigger(thread_db* tdbb, DsqlCompilerScratc
|
||||
dsqlScratch->appendUChar(blr_end); // of begin
|
||||
dsqlScratch->appendUChar(blr_eoc);
|
||||
|
||||
DDL_reset_context_stack(dsqlScratch);
|
||||
dsqlScratch->resetContextStack();
|
||||
|
||||
TriggerDefinition trigger(pool);
|
||||
trigger.systemFlag = fb_sysflag_view_check;
|
||||
|
@ -171,7 +171,19 @@ public:
|
||||
void genParameters(Firebird::Array<ParameterClause>& parameters,
|
||||
Firebird::Array<ParameterClause>& returns);
|
||||
|
||||
// Get rid of any predefined contexts created for a view or trigger definition.
|
||||
// Also reset hidden variables.
|
||||
void resetContextStack()
|
||||
{
|
||||
context->clear();
|
||||
contextNumber = 0;
|
||||
derivedContextNumber = 0;
|
||||
|
||||
hiddenVarsNumber = 0;
|
||||
hiddenVariables.clear();
|
||||
}
|
||||
|
||||
void resetTriggerContextStack()
|
||||
{
|
||||
context->clear();
|
||||
contextNumber = 0;
|
||||
|
@ -125,24 +125,12 @@ bool DDL_ids(const DsqlCompilerScratch* scratch)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// See the next function for description. This is only a
|
||||
// wrapper that sets the last parameter to false to indicate
|
||||
// we are creating a field, not modifying one.
|
||||
//
|
||||
void DDL_resolve_intl_type(DsqlCompilerScratch* dsqlScratch, dsql_fld* field,
|
||||
const MetaName& collation_name)
|
||||
{
|
||||
DDL_resolve_intl_type2(dsqlScratch, field, collation_name, false);
|
||||
}
|
||||
|
||||
|
||||
void DDL_resolve_intl_type2(DsqlCompilerScratch* dsqlScratch, dsql_fld* field,
|
||||
const MetaName& collation_name, bool modifying)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D D L _ r e s o l v e _ i n t l _ t y p e 2
|
||||
* D D L _ r e s o l v e _ i n t l _ t y p e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -286,9 +274,6 @@ void DDL_resolve_intl_type2(DsqlCompilerScratch* dsqlScratch, dsql_fld* field,
|
||||
|
||||
if (modifying)
|
||||
{
|
||||
#ifdef DEV_BUILD
|
||||
const dsql_rel* relation = dsqlScratch->relation;
|
||||
#endif
|
||||
const dsql_fld* afield = field->fld_next;
|
||||
USHORT bpc = 0;
|
||||
|
||||
@ -297,7 +282,7 @@ void DDL_resolve_intl_type2(DsqlCompilerScratch* dsqlScratch, dsql_fld* field,
|
||||
// The first test is redundant.
|
||||
if (afield != field && afield->fld_relation && afield->fld_name == field->fld_name)
|
||||
{
|
||||
fb_assert(afield->fld_relation == relation || !relation);
|
||||
fb_assert(afield->fld_relation == dsqlScratch->relation || !dsqlScratch->relation);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -467,30 +452,6 @@ static void assign_field_length(dsql_fld* field, USHORT bytes_per_char)
|
||||
}
|
||||
|
||||
|
||||
void DDL_reset_context_stack(DsqlCompilerScratch* dsqlScratch)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D D L _ r e s e t _ c o n t e x t _ s t a c k
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Function
|
||||
* Get rid of any predefined contexts created
|
||||
* for a view or trigger definition.
|
||||
* Also reset hidden variables.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
dsqlScratch->context->clear();
|
||||
dsqlScratch->contextNumber = 0;
|
||||
dsqlScratch->derivedContextNumber = 0;
|
||||
|
||||
dsqlScratch->hiddenVarsNumber = 0;
|
||||
dsqlScratch->hiddenVariables.clear();
|
||||
}
|
||||
|
||||
|
||||
// post very often used error - avoid code duplication
|
||||
static void post_607(const Arg::StatusVector& v)
|
||||
{
|
||||
|
@ -61,8 +61,7 @@ const USHORT blr_dtypes[] = {
|
||||
};
|
||||
|
||||
bool DDL_ids(const Jrd::DsqlCompilerScratch*);
|
||||
void DDL_reset_context_stack(Jrd::DsqlCompilerScratch*);
|
||||
void DDL_resolve_intl_type(Jrd::DsqlCompilerScratch*, Jrd::dsql_fld*, const Firebird::MetaName&);
|
||||
void DDL_resolve_intl_type2(Jrd::DsqlCompilerScratch*, Jrd::dsql_fld*, const Firebird::MetaName&, bool);
|
||||
void DDL_resolve_intl_type(Jrd::DsqlCompilerScratch*, Jrd::dsql_fld*, const Firebird::MetaName&,
|
||||
bool = false);
|
||||
|
||||
#endif // DSQL_DDL_PROTO_H
|
||||
|
@ -775,38 +775,6 @@ USHORT METD_get_domain_default(jrd_tra* transaction, const MetaName& domain_name
|
||||
}
|
||||
|
||||
|
||||
bool METD_get_exception(jrd_tra* transaction, const dsql_str* name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* M E T D _ g e t _ e x c e p t i o n
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Look up an exception.
|
||||
*
|
||||
**************************************/
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
|
||||
validateTransaction(transaction);
|
||||
|
||||
bool found = false;
|
||||
|
||||
AutoCacheRequest handle(tdbb, irq_exception, IRQ_REQUESTS);
|
||||
|
||||
FOR(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction)
|
||||
X IN RDB$EXCEPTIONS WITH
|
||||
X.RDB$EXCEPTION_NAME EQ name->str_data;
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
END_FOR
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
dsql_udf* METD_get_function(jrd_tra* transaction, DsqlCompilerScratch* dsqlScratch,
|
||||
const QualifiedName& name)
|
||||
{
|
||||
|
@ -60,7 +60,6 @@ USHORT METD_get_col_default(Jrd::jrd_tra*, const char*, const char*, bool*, UCHA
|
||||
Jrd::dsql_str* METD_get_default_charset(Jrd::jrd_tra*);
|
||||
bool METD_get_domain(Jrd::jrd_tra*, class Jrd::dsql_fld*, const Firebird::MetaName& name);
|
||||
USHORT METD_get_domain_default(Jrd::jrd_tra*, const Firebird::MetaName&, bool*, UCHAR*, USHORT);
|
||||
bool METD_get_exception(Jrd::jrd_tra*, const Jrd::dsql_str*);
|
||||
Jrd::dsql_udf* METD_get_function(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*,
|
||||
const Firebird::QualifiedName&);
|
||||
void METD_get_primary_key(Jrd::jrd_tra*, const Firebird::MetaName&,
|
||||
|
@ -139,7 +139,6 @@ enum irq_type_t
|
||||
irq_type, // DSQL/METD: lookup a symbolic name in RDB$TYPES
|
||||
irq_col_default, // DSQL/METD: lookup default for a column
|
||||
irq_domain_2, // DSQL/METD: lookup a domain
|
||||
irq_exception, // DSQL/METD: lookup an exception
|
||||
irq_cs_name, // DSQL/METD: lookup a charset name
|
||||
irq_default_cs, // DSQL/METD: lookup the default charset
|
||||
irq_rel_ids, // DSQL/METD: check relation/field ids
|
||||
|
@ -643,7 +643,7 @@ without specifying a character set.', NULL);
|
||||
('tra_num_exc', 'bump_transaction_id', 'tra.cpp', NULL, 0, 544, NULL, 'Transactions count exceeded. Perform backup and restore to make database operable again', NULL, NULL);
|
||||
('field_disappeared', 'EVL_assign_to', 'evl.cpp', NULL, 0, 545, NULL, 'Column has been unexpectedly deleted', NULL, NULL);
|
||||
('met_wrong_gtt_scope', 'store_dependencies', 'met.e', NULL, 0, 546, NULL, '@1 cannot depend on @2', NULL, NULL);
|
||||
('subtype_for_internal_use', 'DDL_resolve_intl_type2', 'DSQL/ddl.cpp', NULL, 0, 547, NULL, 'Blob sub_types bigger than 1 (text) are for internal use only', NULL, NULL);
|
||||
('subtype_for_internal_use', 'DDL_resolve_intl_type', 'DSQL/ddl.cpp', NULL, 0, 547, NULL, 'Blob sub_types bigger than 1 (text) are for internal use only', NULL, NULL);
|
||||
('illegal_prc_type', 'par_procedure', 'par.cpp', NULL, 0, 548, NULL, 'Procedure @1 is not selectable (it does not contain a SUSPEND statement)', NULL, NULL);
|
||||
('invalid_sort_datatype', 'gen_sort', 'opt.cpp', NULL, 0, 549, NULL, 'Datatype @1 is not supported for sorting operation', NULL, NULL);
|
||||
('collation_name', 'check_dependencies', 'dfw.e', NULL, 0, 550, NULL, 'COLLATION @1', NULL, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user