Skip to content

Commit

Permalink
Fixed CORE-6233 - Wrong dependencies of stored function on view after…
Browse files Browse the repository at this point in the history
… backup and restore.
  • Loading branch information
asfernandes committed Mar 5, 2020
1 parent ada5330 commit 7da1fc9
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions src/burp/restore.epp
Expand Up @@ -4158,12 +4158,15 @@ bool get_function(BurpGlobals* tdgbl)

bool existFlag = false;

isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;

if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
{
GDS_NAME function_name;
bool securityClass = false;

STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
X IN RDB$FUNCTIONS
X.RDB$DESCRIPTION.NULL = TRUE;
X.RDB$ENGINE_NAME.NULL = TRUE;
Expand Down Expand Up @@ -4212,12 +4215,12 @@ bool get_function(BurpGlobals* tdgbl)

case att_function_description:
X.RDB$DESCRIPTION.NULL = FALSE;
get_misc_blob (tdgbl, X.RDB$DESCRIPTION, false);
get_misc_blob (tdgbl, X.RDB$DESCRIPTION, true);
break;

case att_function_description2:
X.RDB$DESCRIPTION.NULL = FALSE;
get_source_blob (tdgbl, X.RDB$DESCRIPTION, false);
get_source_blob (tdgbl, X.RDB$DESCRIPTION, true);
break;

case att_function_module_name:
Expand Down Expand Up @@ -4277,7 +4280,7 @@ bool get_function(BurpGlobals* tdgbl)
case att_function_blr:
if (tdgbl->RESTORE_format >= 10)
{
get_blr_blob(tdgbl, X.RDB$FUNCTION_BLR, false);
get_blr_blob(tdgbl, X.RDB$FUNCTION_BLR, true);
X.RDB$FUNCTION_BLR.NULL = FALSE;
}
else
Expand All @@ -4287,7 +4290,7 @@ bool get_function(BurpGlobals* tdgbl)
case att_function_source:
if (tdgbl->RESTORE_format >= 10)
{
get_source_blob(tdgbl, X.RDB$FUNCTION_SOURCE, false);
get_source_blob(tdgbl, X.RDB$FUNCTION_SOURCE, true);
X.RDB$FUNCTION_SOURCE.NULL = FALSE;
}
else
Expand All @@ -4307,7 +4310,7 @@ bool get_function(BurpGlobals* tdgbl)
case att_function_debug_info:
if (tdgbl->RESTORE_format >= 10)
{
get_misc_blob(tdgbl, X.RDB$DEBUG_INFO, false);
get_misc_blob(tdgbl, X.RDB$DEBUG_INFO, true);
X.RDB$DEBUG_INFO.NULL = FALSE;
}
else
Expand Down Expand Up @@ -4376,7 +4379,8 @@ bool get_function(BurpGlobals* tdgbl)
}
else
{
STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
X IN RDB$FUNCTIONS
X.RDB$SYSTEM_FLAG = 0;
X.RDB$SYSTEM_FLAG.NULL = FALSE;
Expand All @@ -4396,12 +4400,12 @@ bool get_function(BurpGlobals* tdgbl)

case att_function_description:
X.RDB$DESCRIPTION.NULL = FALSE;
get_misc_blob (tdgbl, X.RDB$DESCRIPTION, false);
get_misc_blob (tdgbl, X.RDB$DESCRIPTION, true);
break;

case att_function_description2:
X.RDB$DESCRIPTION.NULL = FALSE;
get_source_blob (tdgbl, X.RDB$DESCRIPTION, false);
get_source_blob (tdgbl, X.RDB$DESCRIPTION, true);
break;

case att_function_module_name:
Expand Down Expand Up @@ -4515,6 +4519,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
att_type attribute;
scan_attr_t scan_next_attr;

isc_tr_handle local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans;

if (skip_arguments)
{
skip_init(&scan_next_attr);
Expand Down Expand Up @@ -4614,7 +4620,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
{
// with RDB$FIELD_PRECISION
STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
Expand Down Expand Up @@ -4732,7 +4739,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
case att_functionarg_default_value:
if (tdgbl->RESTORE_format >= 10)
{
get_blr_blob(tdgbl, X.RDB$DEFAULT_VALUE, false);
get_blr_blob(tdgbl, X.RDB$DEFAULT_VALUE, true);
X.RDB$DEFAULT_VALUE.NULL = FALSE;
}
else
Expand All @@ -4742,7 +4749,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
case att_functionarg_default_source:
if (tdgbl->RESTORE_format >= 10)
{
get_source_blob(tdgbl, X.RDB$DEFAULT_SOURCE, false);
get_source_blob(tdgbl, X.RDB$DEFAULT_SOURCE, true);
X.RDB$DEFAULT_SOURCE.NULL = FALSE;
}
else
Expand Down Expand Up @@ -4802,7 +4809,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
case att_functionarg_description:
if (tdgbl->RESTORE_format >= 10)
{
get_source_blob(tdgbl, X.RDB$DESCRIPTION, false);
get_source_blob(tdgbl, X.RDB$DESCRIPTION, true);
X.RDB$DESCRIPTION.NULL = FALSE;
}
else
Expand All @@ -4823,7 +4830,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
else if (tdgbl->runtimeODS >= DB_VERSION_DDL10)
{
// with RDB$FIELD_PRECISION
STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
Expand Down Expand Up @@ -4936,7 +4944,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments)
else
{
// without RDB$FIELD_PRECISION
STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
STORE (TRANSACTION_HANDLE local_trans
REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1)
X IN RDB$FUNCTION_ARGUMENTS
X.RDB$FIELD_SUB_TYPE.NULL = TRUE;
X.RDB$CHARACTER_SET_ID.NULL = TRUE;
Expand Down

0 comments on commit 7da1fc9

Please sign in to comment.