mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:43:03 +01:00
Fixed CORE-4954 - The package procedure with value by default isn't called if this parameter isn't specified.
This commit is contained in:
parent
2a53f5c9c5
commit
96e6676163
@ -1860,8 +1860,8 @@ C --
|
||||
PARAMETER (GDS__dyn_funcsignat_package = 336068873)
|
||||
INTEGER*4 GDS__dyn_procsignat_package
|
||||
PARAMETER (GDS__dyn_procsignat_package = 336068874)
|
||||
INTEGER*4 GDS__dyn_defvaldecl_package
|
||||
PARAMETER (GDS__dyn_defvaldecl_package = 336068875)
|
||||
INTEGER*4 GDS__dyn_defvaldecl_package_proc
|
||||
PARAMETER (GDS__dyn_defvaldecl_package_proc = 336068875)
|
||||
INTEGER*4 GDS__dyn_package_body_exists
|
||||
PARAMETER (GDS__dyn_package_body_exists = 336068877)
|
||||
INTEGER*4 GDS__dyn_invalid_ddl_func
|
||||
@ -1888,6 +1888,8 @@ C --
|
||||
PARAMETER (GDS__dyn_cant_use_zero_increment = 336068896)
|
||||
INTEGER*4 GDS__dyn_cant_use_in_foreignkey
|
||||
PARAMETER (GDS__dyn_cant_use_in_foreignkey = 336068897)
|
||||
INTEGER*4 GDS__dyn_defvaldecl_package_func
|
||||
PARAMETER (GDS__dyn_defvaldecl_package_func = 336068898)
|
||||
INTEGER*4 GDS__gbak_unknown_switch
|
||||
PARAMETER (GDS__gbak_unknown_switch = 336330753)
|
||||
INTEGER*4 GDS__gbak_page_size_missing
|
||||
|
@ -937,7 +937,7 @@ const
|
||||
gds_dyn_procnotdef_package = 336068872;
|
||||
gds_dyn_funcsignat_package = 336068873;
|
||||
gds_dyn_procsignat_package = 336068874;
|
||||
gds_dyn_defvaldecl_package = 336068875;
|
||||
gds_dyn_defvaldecl_package_proc = 336068875;
|
||||
gds_dyn_package_body_exists = 336068877;
|
||||
gds_dyn_invalid_ddl_func = 336068878;
|
||||
gds_dyn_newfc_oldsyntax = 336068879;
|
||||
@ -951,6 +951,7 @@ const
|
||||
gds_dyn_cant_modify_sysobj = 336068895;
|
||||
gds_dyn_cant_use_zero_increment = 336068896;
|
||||
gds_dyn_cant_use_in_foreignkey = 336068897;
|
||||
gds_dyn_defvaldecl_package_func = 336068898;
|
||||
gds_gbak_unknown_switch = 336330753;
|
||||
gds_gbak_page_size_missing = 336330754;
|
||||
gds_gbak_page_size_toobig = 336330755;
|
||||
|
@ -1906,9 +1906,9 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
||||
|
||||
if (!secondPass && modified)
|
||||
{
|
||||
// Get all comments from the old parameter list.
|
||||
MetaNameBidMap comments;
|
||||
collectParamComments(tdbb, transaction, comments);
|
||||
// Get all comments and defaults from the old parameter list.
|
||||
CollectedParameterMap collectedParameters;
|
||||
collectParameters(tdbb, transaction, collectedParameters);
|
||||
|
||||
// delete all old arguments
|
||||
DropFunctionNode::dropArguments(tdbb, transaction, name, package);
|
||||
@ -1921,13 +1921,13 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
||||
for (FB_SIZE_T i = 0; i < parameters.getCount(); ++i)
|
||||
{
|
||||
ParameterClause* parameter = parameters[i];
|
||||
bid comment;
|
||||
CollectedParameter collectedParameter;
|
||||
|
||||
// Find the original comment to recreate in the new parameter.
|
||||
if (!comments.get(parameter->name, comment))
|
||||
comment.clear();
|
||||
// Find the original parameter to recreate in the new parameter.
|
||||
collectedParameters.get(parameter->name, collectedParameter);
|
||||
|
||||
storeArgument(tdbb, dsqlScratch, transaction, i + 1, false, parameter, &comment);
|
||||
storeArgument(tdbb, dsqlScratch, transaction, i + 1, false,
|
||||
parameter, &collectedParameter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1936,7 +1936,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
||||
|
||||
void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
jrd_tra* transaction, unsigned pos, bool returnArg, ParameterClause* parameter,
|
||||
const bid* comment)
|
||||
const CollectedParameter* collectedParameter)
|
||||
{
|
||||
Attachment* const attachment = transaction->getAttachment();
|
||||
TypeClause* type = parameter->type;
|
||||
@ -2053,6 +2053,14 @@ void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, DsqlCompilerScratch
|
||||
|
||||
if (parameter->defaultClause)
|
||||
{
|
||||
if (preserveDefaults)
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_dyn_defvaldecl_package_func) <<
|
||||
package.c_str() <<
|
||||
name.c_str());
|
||||
}
|
||||
|
||||
ARG.RDB$DEFAULT_VALUE.NULL = FALSE;
|
||||
ARG.RDB$DEFAULT_SOURCE.NULL = FALSE;
|
||||
|
||||
@ -2073,6 +2081,16 @@ void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, DsqlCompilerScratch
|
||||
attachment->storeBinaryBlob(tdbb, transaction, &ARG.RDB$DEFAULT_VALUE,
|
||||
dsqlScratch->getBlrData());
|
||||
}
|
||||
else if (preserveDefaults && collectedParameter)
|
||||
{
|
||||
ARG.RDB$DEFAULT_SOURCE.NULL = collectedParameter->defaultSource.isEmpty();
|
||||
if (!ARG.RDB$DEFAULT_SOURCE.NULL)
|
||||
ARG.RDB$DEFAULT_SOURCE = collectedParameter->defaultSource;
|
||||
|
||||
ARG.RDB$DEFAULT_VALUE.NULL = collectedParameter->defaultValue.isEmpty();
|
||||
if (!ARG.RDB$DEFAULT_VALUE.NULL)
|
||||
ARG.RDB$DEFAULT_VALUE = collectedParameter->defaultValue;
|
||||
}
|
||||
|
||||
if (isUdf())
|
||||
{
|
||||
@ -2095,9 +2113,9 @@ void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, DsqlCompilerScratch
|
||||
ARG.RDB$MECHANISM = (SSHORT) FUN_reference;
|
||||
}
|
||||
|
||||
ARG.RDB$DESCRIPTION.NULL = !comment || comment->isEmpty();
|
||||
ARG.RDB$DESCRIPTION.NULL = !collectedParameter || collectedParameter->comment.isEmpty();
|
||||
if (!ARG.RDB$DESCRIPTION.NULL)
|
||||
ARG.RDB$DESCRIPTION = *comment;
|
||||
ARG.RDB$DESCRIPTION = collectedParameter->comment;
|
||||
}
|
||||
END_STORE
|
||||
}
|
||||
@ -2189,18 +2207,21 @@ void CreateAlterFunctionNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch*
|
||||
invalid = false;
|
||||
}
|
||||
|
||||
void CreateAlterFunctionNode::collectParamComments(thread_db* tdbb, jrd_tra* transaction,
|
||||
MetaNameBidMap& items)
|
||||
void CreateAlterFunctionNode::collectParameters(thread_db* tdbb, jrd_tra* transaction,
|
||||
CollectedParameterMap& items)
|
||||
{
|
||||
AutoRequest requestHandle;
|
||||
|
||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||
ARG IN RDB$FUNCTION_ARGUMENTS
|
||||
WITH ARG.RDB$FUNCTION_NAME EQ name.c_str() AND
|
||||
ARG.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '') AND
|
||||
ARG.RDB$DESCRIPTION NOT MISSING
|
||||
ARG.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '')
|
||||
{
|
||||
items.put(ARG.RDB$ARGUMENT_NAME, ARG.RDB$DESCRIPTION);
|
||||
CollectedParameter parameter;
|
||||
parameter.comment = ARG.RDB$DESCRIPTION;
|
||||
parameter.defaultSource = ARG.RDB$DEFAULT_SOURCE;
|
||||
parameter.defaultValue = ARG.RDB$DEFAULT_VALUE;
|
||||
items.put(ARG.RDB$ARGUMENT_NAME, parameter);
|
||||
}
|
||||
END_FOR
|
||||
}
|
||||
@ -2792,9 +2813,9 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
||||
|
||||
if (!secondPass && modified)
|
||||
{
|
||||
// Get all comments from the old parameter list.
|
||||
MetaNameBidMap comments;
|
||||
collectParamComments(tdbb, transaction, comments);
|
||||
// Get all comments and defaults from the old parameter list.
|
||||
CollectedParameterMap collectedParameters;
|
||||
collectParameters(tdbb, transaction, collectedParameters);
|
||||
|
||||
// Delete all old input and output parameters.
|
||||
DropProcedureNode::dropParameters(tdbb, transaction, name, package);
|
||||
@ -2804,25 +2825,23 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
||||
for (FB_SIZE_T i = 0; i < parameters.getCount(); ++i)
|
||||
{
|
||||
ParameterClause* parameter = parameters[i];
|
||||
bid comment;
|
||||
CollectedParameter collectedParameter;
|
||||
|
||||
// Find the original comment to recreate in the new parameter.
|
||||
if (!comments.get(parameter->name, comment))
|
||||
comment.clear();
|
||||
// Find the original parameter to recreate in the new parameter.
|
||||
collectedParameters.get(parameter->name, collectedParameter);
|
||||
|
||||
storeParameter(tdbb, dsqlScratch, transaction, 0, i, parameter, &comment);
|
||||
storeParameter(tdbb, dsqlScratch, transaction, 0, i, parameter, &collectedParameter);
|
||||
}
|
||||
|
||||
for (FB_SIZE_T i = 0; i < returns.getCount(); ++i)
|
||||
{
|
||||
ParameterClause* parameter = returns[i];
|
||||
bid comment;
|
||||
CollectedParameter collectedParameter;
|
||||
|
||||
// Find the original comment to recreate in the new parameter.
|
||||
if (!comments.get(parameter->name, comment))
|
||||
comment.clear();
|
||||
// Find the original parameter to recreate in the new parameter.
|
||||
collectedParameters.get(parameter->name, collectedParameter);
|
||||
|
||||
storeParameter(tdbb, dsqlScratch, transaction, 1, i, parameter, &comment);
|
||||
storeParameter(tdbb, dsqlScratch, transaction, 1, i, parameter, &collectedParameter);
|
||||
}
|
||||
|
||||
AutoCacheRequest requestHandle2(tdbb, drq_m_prm_view, DYN_REQUESTS);
|
||||
@ -2854,7 +2873,7 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
||||
|
||||
void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
jrd_tra* transaction, USHORT parameterType, unsigned pos, ParameterClause* parameter,
|
||||
const bid* comment)
|
||||
const CollectedParameter* collectedParameter)
|
||||
{
|
||||
Attachment* const attachment = transaction->getAttachment();
|
||||
TypeClause* type = parameter->type;
|
||||
@ -2934,6 +2953,14 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, DsqlCompilerScrat
|
||||
|
||||
if (parameter->defaultClause)
|
||||
{
|
||||
if (preserveDefaults)
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_dyn_defvaldecl_package_proc) <<
|
||||
package.c_str() <<
|
||||
name.c_str());
|
||||
}
|
||||
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &PRM.RDB$DEFAULT_SOURCE,
|
||||
parameter->defaultClause->source);
|
||||
|
||||
@ -2951,10 +2978,20 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, DsqlCompilerScrat
|
||||
attachment->storeBinaryBlob(tdbb, transaction, &PRM.RDB$DEFAULT_VALUE,
|
||||
dsqlScratch->getBlrData());
|
||||
}
|
||||
else if (preserveDefaults && collectedParameter)
|
||||
{
|
||||
PRM.RDB$DEFAULT_SOURCE.NULL = collectedParameter->defaultSource.isEmpty();
|
||||
if (!PRM.RDB$DEFAULT_SOURCE.NULL)
|
||||
PRM.RDB$DEFAULT_SOURCE = collectedParameter->defaultSource;
|
||||
|
||||
PRM.RDB$DESCRIPTION.NULL = !comment || comment->isEmpty();
|
||||
PRM.RDB$DEFAULT_VALUE.NULL = collectedParameter->defaultValue.isEmpty();
|
||||
if (!PRM.RDB$DEFAULT_VALUE.NULL)
|
||||
PRM.RDB$DEFAULT_VALUE = collectedParameter->defaultValue;
|
||||
}
|
||||
|
||||
PRM.RDB$DESCRIPTION.NULL = !collectedParameter || collectedParameter->comment.isEmpty();
|
||||
if (!PRM.RDB$DESCRIPTION.NULL)
|
||||
PRM.RDB$DESCRIPTION = *comment;
|
||||
PRM.RDB$DESCRIPTION = collectedParameter->comment;
|
||||
}
|
||||
END_STORE
|
||||
}
|
||||
@ -3049,18 +3086,21 @@ void CreateAlterProcedureNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch*
|
||||
invalid = false;
|
||||
}
|
||||
|
||||
void CreateAlterProcedureNode::collectParamComments(thread_db* tdbb, jrd_tra* transaction,
|
||||
MetaNameBidMap& items)
|
||||
void CreateAlterProcedureNode::collectParameters(thread_db* tdbb, jrd_tra* transaction,
|
||||
CollectedParameterMap& items)
|
||||
{
|
||||
AutoRequest requestHandle;
|
||||
|
||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||
PRM IN RDB$PROCEDURE_PARAMETERS
|
||||
WITH PRM.RDB$PROCEDURE_NAME EQ name.c_str() AND
|
||||
PRM.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '') AND
|
||||
PRM.RDB$DESCRIPTION NOT MISSING
|
||||
PRM.RDB$PACKAGE_NAME EQUIV NULLIF(package.c_str(), '')
|
||||
{
|
||||
items.put(PRM.RDB$PARAMETER_NAME, PRM.RDB$DESCRIPTION);
|
||||
CollectedParameter parameter;
|
||||
parameter.comment = PRM.RDB$DESCRIPTION;
|
||||
parameter.defaultSource = PRM.RDB$DEFAULT_SOURCE;
|
||||
parameter.defaultValue = PRM.RDB$DEFAULT_VALUE;
|
||||
items.put(PRM.RDB$PARAMETER_NAME, parameter);
|
||||
}
|
||||
END_FOR
|
||||
}
|
||||
|
@ -178,6 +178,25 @@ public:
|
||||
};
|
||||
|
||||
|
||||
struct CollectedParameter
|
||||
{
|
||||
CollectedParameter()
|
||||
{
|
||||
comment.clear();
|
||||
defaultSource.clear();
|
||||
defaultValue.clear();
|
||||
}
|
||||
|
||||
bid comment;
|
||||
bid defaultSource;
|
||||
bid defaultValue;
|
||||
};
|
||||
|
||||
typedef Firebird::GenericMap<
|
||||
Firebird::Pair<Firebird::Left<Firebird::MetaName, CollectedParameter> > >
|
||||
CollectedParameterMap;
|
||||
|
||||
|
||||
class ExecInSecurityDb
|
||||
{
|
||||
public:
|
||||
@ -335,6 +354,7 @@ public:
|
||||
package(pool),
|
||||
packageOwner(pool),
|
||||
privateScope(false),
|
||||
preserveDefaults(false),
|
||||
udfReturnPos(0)
|
||||
{
|
||||
}
|
||||
@ -366,9 +386,10 @@ private:
|
||||
bool secondPass, bool runTriggers);
|
||||
|
||||
void storeArgument(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
|
||||
unsigned pos, bool returnArg, ParameterClause* parameter, const bid* comment);
|
||||
unsigned pos, bool returnArg, ParameterClause* parameter,
|
||||
const CollectedParameter* collectedParameter);
|
||||
void compile(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch);
|
||||
void collectParamComments(thread_db* tdbb, jrd_tra* transaction, MetaNameBidMap& items);
|
||||
void collectParameters(thread_db* tdbb, jrd_tra* transaction, CollectedParameterMap& items);
|
||||
|
||||
public:
|
||||
Firebird::MetaName name;
|
||||
@ -386,6 +407,7 @@ public:
|
||||
Firebird::MetaName package;
|
||||
Firebird::string packageOwner;
|
||||
bool privateScope;
|
||||
bool preserveDefaults;
|
||||
SLONG udfReturnPos;
|
||||
};
|
||||
|
||||
@ -473,7 +495,8 @@ public:
|
||||
invalid(false),
|
||||
package(pool),
|
||||
packageOwner(pool),
|
||||
privateScope(false)
|
||||
privateScope(false),
|
||||
preserveDefaults(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -498,9 +521,10 @@ private:
|
||||
bool executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
|
||||
bool secondPass, bool runTriggers);
|
||||
void storeParameter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
|
||||
USHORT parameterType, unsigned pos, ParameterClause* parameter, const bid* comment);
|
||||
USHORT parameterType, unsigned pos, ParameterClause* parameter,
|
||||
const CollectedParameter* collectedParameter);
|
||||
void compile(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch);
|
||||
void collectParamComments(thread_db* tdbb, jrd_tra* transaction, MetaNameBidMap& items);
|
||||
void collectParameters(thread_db* tdbb, jrd_tra* transaction, CollectedParameterMap& items);
|
||||
|
||||
public:
|
||||
Firebird::MetaName name;
|
||||
@ -517,6 +541,7 @@ public:
|
||||
Firebird::MetaName package;
|
||||
Firebird::string packageOwner;
|
||||
bool privateScope;
|
||||
bool preserveDefaults;
|
||||
};
|
||||
|
||||
|
||||
|
@ -895,11 +895,17 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
||||
continue;
|
||||
|
||||
if (arrays[i] == items)
|
||||
collectPackagedItems(tdbb, transaction, name, existingFuncs, existingProcs, true);
|
||||
{
|
||||
existingFuncs.clear();
|
||||
existingProcs.clear();
|
||||
}
|
||||
|
||||
collectPackagedItems(tdbb, transaction, name, existingFuncs, existingProcs, true);
|
||||
|
||||
for (unsigned j = 0; j < arrays[i]->getCount(); ++j)
|
||||
{
|
||||
CreateAlterPackageNode::Item& elem = (*arrays[i])[j];
|
||||
|
||||
switch (elem.type)
|
||||
{
|
||||
case CreateAlterPackageNode::Item::FUNCTION:
|
||||
@ -908,8 +914,17 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
||||
|
||||
if (arrays[i] == items)
|
||||
func->privateScope = !headerFuncs.exist(Signature(func->name));
|
||||
else if (existingFuncs.exist(Signature(func->name)))
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_no_meta_update) <<
|
||||
Arg::Gds(isc_dyn_duplicate_package_item) <<
|
||||
Arg::Str("FUNCTION") << Arg::Str(func->name));
|
||||
}
|
||||
|
||||
func->packageOwner = owner;
|
||||
func->preserveDefaults =
|
||||
existingFuncs.exist(Signature(func->name)) && arrays[i] == items;
|
||||
func->executeDdl(tdbb, elem.dsqlScratch, transaction);
|
||||
break;
|
||||
}
|
||||
@ -920,8 +935,17 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
||||
|
||||
if (arrays[i] == items)
|
||||
proc->privateScope = !headerProcs.exist(Signature(proc->name));
|
||||
else if (existingProcs.exist(Signature(proc->name)))
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_no_meta_update) <<
|
||||
Arg::Gds(isc_dyn_duplicate_package_item) <<
|
||||
Arg::Str("PROCEDURE") << Arg::Str(proc->name));
|
||||
}
|
||||
|
||||
proc->packageOwner = owner;
|
||||
proc->preserveDefaults =
|
||||
existingProcs.exist(Signature(proc->name)) && arrays[i] == items;
|
||||
proc->executeDdl(tdbb, elem.dsqlScratch, transaction);
|
||||
break;
|
||||
}
|
||||
@ -967,81 +991,8 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_dyn_procsignat_package) << i->name.c_str() << name.c_str());
|
||||
}
|
||||
|
||||
for (SortedObjectsArray<ParameterInfo>::iterator j = newProcs[pos].parameters.begin();
|
||||
j != newProcs[pos].parameters.end(); ++j)
|
||||
{
|
||||
if (!j->defaultSource.isEmpty() || !j->defaultValue.isEmpty())
|
||||
{
|
||||
status_exception::raise(
|
||||
Arg::Gds(isc_dyn_defvaldecl_package) << name.c_str() << i->name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lets recreate default of public procedure/function parameters
|
||||
|
||||
requestHandle.reset(tdbb, drq_m_pkg_prm_defs, DYN_REQUESTS);
|
||||
|
||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||
PRM IN RDB$PROCEDURE_PARAMETERS
|
||||
WITH PRM.RDB$PACKAGE_NAME EQ name.c_str()
|
||||
{
|
||||
FB_SIZE_T pos;
|
||||
if (existingProcs.find(Signature(getPool(), MetaName(PRM.RDB$PROCEDURE_NAME)), pos))
|
||||
{
|
||||
const Signature& proc = existingProcs[pos];
|
||||
|
||||
ParameterInfo paramKey(getPool());
|
||||
paramKey.type = PRM.RDB$PARAMETER_TYPE;
|
||||
paramKey.number = PRM.RDB$PARAMETER_NUMBER;
|
||||
|
||||
if (proc.parameters.find(paramKey, pos))
|
||||
{
|
||||
const ParameterInfo& param = proc.parameters[pos];
|
||||
|
||||
MODIFY PRM
|
||||
PRM.RDB$DEFAULT_SOURCE = param.defaultSource;
|
||||
PRM.RDB$DEFAULT_SOURCE.NULL = param.defaultSource.isEmpty();
|
||||
|
||||
PRM.RDB$DEFAULT_VALUE = param.defaultValue;
|
||||
PRM.RDB$DEFAULT_VALUE.NULL = param.defaultValue.isEmpty();
|
||||
END_MODIFY
|
||||
}
|
||||
}
|
||||
}
|
||||
END_FOR
|
||||
|
||||
requestHandle.reset(tdbb, drq_m_pkg_arg_defs, DYN_REQUESTS);
|
||||
|
||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||
ARG IN RDB$FUNCTION_ARGUMENTS
|
||||
WITH ARG.RDB$PACKAGE_NAME EQ name.c_str()
|
||||
{
|
||||
FB_SIZE_T pos;
|
||||
if (existingFuncs.find(Signature(getPool(), MetaName(ARG.RDB$FUNCTION_NAME)), pos))
|
||||
{
|
||||
const Signature& func = existingFuncs[pos];
|
||||
|
||||
ParameterInfo paramKey(getPool());
|
||||
paramKey.number = ARG.RDB$ARGUMENT_POSITION;
|
||||
|
||||
if (func.parameters.find(paramKey, pos))
|
||||
{
|
||||
const ParameterInfo& param = func.parameters[pos];
|
||||
|
||||
MODIFY ARG
|
||||
ARG.RDB$DEFAULT_SOURCE = param.defaultSource;
|
||||
ARG.RDB$DEFAULT_SOURCE.NULL = param.defaultSource.isEmpty();
|
||||
|
||||
ARG.RDB$DEFAULT_VALUE = param.defaultValue;
|
||||
ARG.RDB$DEFAULT_VALUE.NULL = param.defaultValue.isEmpty();
|
||||
END_MODIFY
|
||||
}
|
||||
}
|
||||
}
|
||||
END_FOR
|
||||
|
||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||
DDL_TRIGGER_CREATE_PACKAGE_BODY, name, NULL);
|
||||
|
||||
|
@ -926,7 +926,7 @@ static const struct {
|
||||
{"dyn_procnotdef_package", 336068872},
|
||||
{"dyn_funcsignat_package", 336068873},
|
||||
{"dyn_procsignat_package", 336068874},
|
||||
{"dyn_defvaldecl_package", 336068875},
|
||||
{"dyn_defvaldecl_package_proc", 336068875},
|
||||
{"dyn_package_body_exists", 336068877},
|
||||
{"dyn_invalid_ddl_func", 336068878},
|
||||
{"dyn_newfc_oldsyntax", 336068879},
|
||||
@ -940,6 +940,7 @@ static const struct {
|
||||
{"dyn_cant_modify_sysobj", 336068895},
|
||||
{"dyn_cant_use_zero_increment", 336068896},
|
||||
{"dyn_cant_use_in_foreignkey", 336068897},
|
||||
{"dyn_defvaldecl_package_func", 336068898},
|
||||
{"gbak_unknown_switch", 336330753},
|
||||
{"gbak_page_size_missing", 336330754},
|
||||
{"gbak_page_size_toobig", 336330755},
|
||||
|
@ -960,7 +960,7 @@ const ISC_STATUS isc_dyn_funcnotdef_package = 336068871L;
|
||||
const ISC_STATUS isc_dyn_procnotdef_package = 336068872L;
|
||||
const ISC_STATUS isc_dyn_funcsignat_package = 336068873L;
|
||||
const ISC_STATUS isc_dyn_procsignat_package = 336068874L;
|
||||
const ISC_STATUS isc_dyn_defvaldecl_package = 336068875L;
|
||||
const ISC_STATUS isc_dyn_defvaldecl_package_proc = 336068875L;
|
||||
const ISC_STATUS isc_dyn_package_body_exists = 336068877L;
|
||||
const ISC_STATUS isc_dyn_invalid_ddl_func = 336068878L;
|
||||
const ISC_STATUS isc_dyn_newfc_oldsyntax = 336068879L;
|
||||
@ -974,6 +974,7 @@ const ISC_STATUS isc_dyn_duplicate_package_item = 336068894L;
|
||||
const ISC_STATUS isc_dyn_cant_modify_sysobj = 336068895L;
|
||||
const ISC_STATUS isc_dyn_cant_use_zero_increment = 336068896L;
|
||||
const ISC_STATUS isc_dyn_cant_use_in_foreignkey = 336068897L;
|
||||
const ISC_STATUS isc_dyn_defvaldecl_package_func = 336068898L;
|
||||
const ISC_STATUS isc_gbak_unknown_switch = 336330753L;
|
||||
const ISC_STATUS isc_gbak_page_size_missing = 336330754L;
|
||||
const ISC_STATUS isc_gbak_page_size_toobig = 336330755L;
|
||||
@ -1303,7 +1304,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L;
|
||||
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
|
||||
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
|
||||
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
|
||||
const ISC_STATUS isc_err_max = 1247;
|
||||
const ISC_STATUS isc_err_max = 1248;
|
||||
|
||||
#else /* c definitions */
|
||||
|
||||
@ -2233,7 +2234,7 @@ const ISC_STATUS isc_err_max = 1247;
|
||||
#define isc_dyn_procnotdef_package 336068872L
|
||||
#define isc_dyn_funcsignat_package 336068873L
|
||||
#define isc_dyn_procsignat_package 336068874L
|
||||
#define isc_dyn_defvaldecl_package 336068875L
|
||||
#define isc_dyn_defvaldecl_package_proc 336068875L
|
||||
#define isc_dyn_package_body_exists 336068877L
|
||||
#define isc_dyn_invalid_ddl_func 336068878L
|
||||
#define isc_dyn_newfc_oldsyntax 336068879L
|
||||
@ -2247,6 +2248,7 @@ const ISC_STATUS isc_err_max = 1247;
|
||||
#define isc_dyn_cant_modify_sysobj 336068895L
|
||||
#define isc_dyn_cant_use_zero_increment 336068896L
|
||||
#define isc_dyn_cant_use_in_foreignkey 336068897L
|
||||
#define isc_dyn_defvaldecl_package_func 336068898L
|
||||
#define isc_gbak_unknown_switch 336330753L
|
||||
#define isc_gbak_page_size_missing 336330754L
|
||||
#define isc_gbak_page_size_toobig 336330755L
|
||||
@ -2576,7 +2578,7 @@ const ISC_STATUS isc_err_max = 1247;
|
||||
#define isc_trace_switch_param_miss 337182758L
|
||||
#define isc_trace_param_act_notcompat 337182759L
|
||||
#define isc_trace_mandatory_switch_miss 337182760L
|
||||
#define isc_err_max 1247
|
||||
#define isc_err_max 1248
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -929,7 +929,7 @@ Data source : @4"}, /* eds_statement */
|
||||
{336068872, "Procedure @1 has not been defined on the package body @2"}, /* dyn_procnotdef_package */
|
||||
{336068873, "Function @1 has a signature mismatch on package body @2"}, /* dyn_funcsignat_package */
|
||||
{336068874, "Procedure @1 has a signature mismatch on package body @2"}, /* dyn_procsignat_package */
|
||||
{336068875, "Default values for parameters are allowed only in declaration of packaged procedure @1.@2"}, /* dyn_defvaldecl_package */
|
||||
{336068875, "Default values for parameters are allowed only in declaration of packaged procedure @1.@2"}, /* dyn_defvaldecl_package_proc */
|
||||
{336068877, "Package body @1 already exists"}, /* dyn_package_body_exists */
|
||||
{336068878, "Invalid DDL statement for function @1"}, /* dyn_invalid_ddl_func */
|
||||
{336068879, "Cannot alter new style function @1 with ALTER EXTERNAL FUNCTION. Use ALTER FUNCTION instead."}, /* dyn_newfc_oldsyntax */
|
||||
@ -943,6 +943,7 @@ Data source : @4"}, /* eds_statement */
|
||||
{336068895, "System @1 @2 cannot be modified"}, /* dyn_cant_modify_sysobj */
|
||||
{336068896, "INCREMENT BY 0 is an illegal option for sequence @1"}, /* dyn_cant_use_zero_increment */
|
||||
{336068897, "Can't use @1 in FOREIGN KEY constraint"}, /* dyn_cant_use_in_foreignkey */
|
||||
{336068898, "Default values for parameters are allowed only in declaration of packaged function @1.@2"}, /* dyn_defvaldecl_package_func */
|
||||
{336330753, "found unknown switch"}, /* gbak_unknown_switch */
|
||||
{336330754, "page size parameter missing"}, /* gbak_page_size_missing */
|
||||
{336330755, "Page size specified (@1) greater than limit (16384 bytes)"}, /* gbak_page_size_toobig */
|
||||
|
@ -925,7 +925,7 @@ static const struct {
|
||||
{336068872, -901}, /* 264 dyn_procnotdef_package */
|
||||
{336068873, -901}, /* 265 dyn_funcsignat_package */
|
||||
{336068874, -901}, /* 266 dyn_procsignat_package */
|
||||
{336068875, -901}, /* 267 dyn_defvaldecl_package */
|
||||
{336068875, -901}, /* 267 dyn_defvaldecl_package_proc */
|
||||
{336068877, -901}, /* 269 dyn_package_body_exists */
|
||||
{336068878, -607}, /* 270 dyn_invalid_ddl_func */
|
||||
{336068879, -901}, /* 271 dyn_newfc_oldsyntax */
|
||||
@ -939,6 +939,7 @@ static const struct {
|
||||
{336068895, -901}, /* 287 dyn_cant_modify_sysobj */
|
||||
{336068896, -901}, /* 288 dyn_cant_use_zero_increment */
|
||||
{336068897, -901}, /* 289 dyn_cant_use_in_foreignkey */
|
||||
{336068898, -901}, /* 290 dyn_defvaldecl_package_func */
|
||||
{336330753, -901}, /* 1 gbak_unknown_switch */
|
||||
{336330754, -901}, /* 2 gbak_page_size_missing */
|
||||
{336330755, -901}, /* 3 gbak_page_size_toobig */
|
||||
|
@ -925,7 +925,7 @@ static const struct {
|
||||
{336068872, "42000"}, // 264 dyn_procnotdef_package
|
||||
{336068873, "42000"}, // 265 dyn_funcsignat_package
|
||||
{336068874, "42000"}, // 266 dyn_procsignat_package
|
||||
{336068875, "42000"}, // 267 dyn_defvaldecl_package
|
||||
{336068875, "42000"}, // 267 dyn_defvaldecl_package_proc
|
||||
{336068877, "42000"}, // 269 dyn_package_body_exists
|
||||
{336068878, "HY000"}, // 270 dyn_invalid_ddl_func
|
||||
{336068879, "42000"}, // 271 dyn_newfc_oldsyntax
|
||||
@ -939,6 +939,7 @@ static const struct {
|
||||
{336068895, "42000"}, // 287 dyn_cant_modify_sysobj
|
||||
{336068896, "42000"}, // 288 dyn_cant_use_zero_increment
|
||||
{336068897, "42000"}, // 289 dyn_cant_use_in_foreignkey
|
||||
{336068898, "42000"}, // 290 dyn_defvaldecl_package_func
|
||||
{336330753, "00000"}, // 1 gbak_unknown_switch
|
||||
{336330754, "00000"}, // 2 gbak_page_size_missing
|
||||
{336330755, "00000"}, // 3 gbak_page_size_toobig
|
||||
|
@ -205,8 +205,6 @@ enum drq_type_t
|
||||
drq_l_pkg_procs, // lookup packaged procedures
|
||||
drq_l_pkg_proc_args, // lookup packaged procedure arguments
|
||||
drq_e_pkg_prv, // erase package privileges
|
||||
drq_m_pkg_prm_defs, // modify packaged procedure parameters defaults
|
||||
drq_m_pkg_arg_defs, // modify packaged function arguments defaults
|
||||
drq_s2_difference, // Store backup difference file, DYN_mod's change_backup_mode
|
||||
drq_l_relation, // lookup relation before erase
|
||||
drq_l_fun_name, // lookup function name
|
||||
|
@ -6,7 +6,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
|
||||
('2015-01-07 18:01:51', 'GFIX', 3, 134)
|
||||
('1996-11-07 13:39:40', 'GPRE', 4, 1)
|
||||
('2012-08-27 21:26:00', 'DSQL', 7, 33)
|
||||
('2014-04-22 16:39:03', 'DYN', 8, 290)
|
||||
('2015-10-07 12:30:00', 'DYN', 8, 291)
|
||||
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
|
||||
('1996-11-07 13:38:41', 'TEST', 11, 4)
|
||||
('2015-07-23 14:20:00', 'GBAK', 12, 370)
|
||||
|
@ -1934,7 +1934,7 @@ COMMIT WORK;
|
||||
('dyn_procnotdef_package', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 264, NULL, 'Procedure @1 has not been defined on the package body @2', NULL, NULL);
|
||||
('dyn_funcsignat_package', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 265, NULL, 'Function @1 has a signature mismatch on package body @2', NULL, NULL);
|
||||
('dyn_procsignat_package', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 266, NULL, 'Procedure @1 has a signature mismatch on package body @2', NULL, NULL);
|
||||
('dyn_defvaldecl_package', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 267, NULL, 'Default values for parameters are allowed only in declaration of packaged procedure @1.@2', NULL, NULL);
|
||||
('dyn_defvaldecl_package_proc', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 267, NULL, 'Default values for parameters are allowed only in declaration of packaged procedure @1.@2', NULL, NULL);
|
||||
('dyn_dup_function', 'DYN_define_function', 'dyn_def.epp', NULL, 8, 268, NULL, 'Function @1 already exists', NULL, NULL);
|
||||
('dyn_package_body_exists', NULL, 'DdlNodes.epp/PackageNodes.epp', NULL, 8, 269, NULL, 'Package body @1 already exists', NULL, NULL);
|
||||
('dyn_invalid_ddl_func', 'CreateAlterFunctionNode::compile', 'DdlNodes.epp', NULL, 8, 270, NULL, 'Invalid DDL statement for function @1', NULL, NULL);
|
||||
@ -1957,6 +1957,7 @@ COMMIT WORK;
|
||||
('dyn_cant_modify_sysobj', NULL, 'DdlNodes.epp', NULL, 8, 287, NULL, 'System @1 @2 cannot be modified', NULL, 'Ex: System generator rdb$... cannot be modified');
|
||||
('dyn_cant_use_zero_increment', NULL, 'DdlNodes.epp', NULL, 8, 288, NULL, 'INCREMENT BY 0 is an illegal option for sequence @1', NULL, NULL);
|
||||
('dyn_cant_use_in_foreignkey', NULL, 'DdlNodes.epp', NULL, 8, 289, NULL, 'Can''t use @1 in FOREIGN KEY constraint', NULL, NULL);
|
||||
('dyn_defvaldecl_package_func', 'CreatePackageBodyNode::execute', 'PackageNodes.epp', NULL, 8, 290, NULL, 'Default values for parameters are allowed only in declaration of packaged function @1.@2', NULL, NULL);
|
||||
COMMIT WORK;
|
||||
-- TEST
|
||||
(NULL, 'main', 'test.c', NULL, 11, 0, NULL, 'This is a modified text message', NULL, NULL);
|
||||
|
@ -914,7 +914,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
|
||||
(-901, '42', '000', 8, 264, 'dyn_procnotdef_package', NULL, NULL)
|
||||
(-901, '42', '000', 8, 265, 'dyn_funcsignat_package', NULL, NULL)
|
||||
(-901, '42', '000', 8, 266, 'dyn_procsignat_package', NULL, NULL)
|
||||
(-901, '42', '000', 8, 267, 'dyn_defvaldecl_package', NULL, NULL)
|
||||
(-901, '42', '000', 8, 267, 'dyn_defvaldecl_package_proc', NULL, NULL)
|
||||
(-901, '42', '000', 8, 269, 'dyn_package_body_exists', NULL, NULL)
|
||||
(-607, 'HY', '000', 8, 270, 'dyn_invalid_ddl_func' NULL, NULL)
|
||||
(-901, '42', '000', 8, 271, 'dyn_newfc_oldsyntax', NULL, NULL)
|
||||
@ -928,6 +928,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
|
||||
(-901, '42', '000', 8, 287, 'dyn_cant_modify_sysobj', NULL, NULL)
|
||||
(-901, '42', '000', 8, 288, 'dyn_cant_use_zero_increment', NULL, NULL)
|
||||
(-901, '42', '000', 8, 289, 'dyn_cant_use_in_foreignkey', NULL, NULL)
|
||||
(-901, '42', '000', 8, 290, 'dyn_defvaldecl_package_func', NULL, NULL)
|
||||
-- GBAK
|
||||
(-901, '00', '000', 12, 1, 'gbak_unknown_switch', NULL, NULL)
|
||||
(-901, '00', '000', 12, 2, 'gbak_page_size_missing', NULL, NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user