8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 06:43:04 +01:00

Postfix for CORE-6028, thanks to Adriano

This commit is contained in:
AlexPeshkoff 2019-03-22 17:55:54 +03:00
parent 1e62335e7f
commit 1ddece969b
4 changed files with 40 additions and 29 deletions

View File

@ -4179,14 +4179,9 @@ void write_triggers()
if (tdgbl->runtimeODS >= DB_VERSION_DDL11_1)
{
FOR (REQUEST_HANDLE req_handle1)
X IN RDB$TRIGGERS
CROSS Y IN RDB$RELATIONS OVER RDB$RELATION_NAME
WITH
(X.RDB$SYSTEM_FLAG NE 1 OR
X.RDB$SYSTEM_FLAG MISSING)
AND
(Y.RDB$SYSTEM_FLAG NE 1 OR
Y.RDB$SYSTEM_FLAG MISSING)
X IN RDB$TRIGGERS WITH
X.RDB$SYSTEM_FLAG NE 1 OR
X.RDB$SYSTEM_FLAG MISSING
put(tdgbl, rec_trigger);
const SSHORT l = PUT_TEXT (att_trig_name, X.RDB$TRIGGER_NAME);

View File

@ -111,7 +111,6 @@ static ULONG get_size(const SCHAR*, burp_fil*);
static gbak_action open_files(const TEXT *, const TEXT**, USHORT,
const Firebird::ClumpletWriter&);
static int svc_api_gbak(Firebird::UtilSvc*, const Switches& switches);
static void burp_output(bool err, const SCHAR*, ...) ATTRIBUTE_FORMAT(2,3);
static void burp_usage(const Switches& switches);
static Switches::in_sw_tab_t* findSwitchOrThrow(Firebird::UtilSvc*, Switches& switches, Firebird::string& sw);
@ -392,7 +391,7 @@ static int svc_api_gbak(Firebird::UtilSvc* uSvc, const Switches& switches)
fb_assert(p + len < respbuf + sizeof(respbuf));
p[len] = '\0';
burp_output(false, "%s\n", p);
BURP_output(false, "%s\n", p);
}
} while (*sl == isc_info_svc_line);
@ -1472,7 +1471,7 @@ void BURP_msg_partial(bool err, USHORT number, const SafeArg& arg)
TEXT buffer[256];
fb_msg_format(NULL, burp_msg_fac, number, sizeof(buffer), buffer, arg);
burp_output(err, "%s", buffer);
BURP_output(err, "%s", buffer);
}
@ -1491,7 +1490,7 @@ void BURP_msg_put(bool err, USHORT number, const SafeArg& arg)
TEXT buffer[256];
fb_msg_format(NULL, burp_msg_fac, number, sizeof(buffer), buffer, arg);
burp_output(err, "%s\n", buffer);
BURP_output(err, "%s\n", buffer);
}
@ -1529,7 +1528,7 @@ void BURP_output_version(void* arg1, const TEXT* arg2)
*
**************************************/
burp_output(false, static_cast<const char*>(arg1), arg2);
BURP_output(false, static_cast<const char*>(arg1), arg2);
}
@ -1607,12 +1606,12 @@ void BURP_print_status(bool err, const ISC_STATUS* status_vector)
if (fb_interpret(s, sizeof(s), &vector))
{
BURP_msg_partial(err, 256); // msg 256: gbak: ERROR:
burp_output(err, "%s\n", s);
BURP_output(err, "%s\n", s);
while (fb_interpret(s, sizeof(s), &vector))
{
BURP_msg_partial(err, 256); // msg 256: gbak: ERROR:
burp_output(err, " %s\n", s);
BURP_output(err, " %s\n", s);
}
}
}
@ -1645,12 +1644,12 @@ void BURP_print_warning(const ISC_STATUS* status_vector)
if (fb_interpret(s, sizeof(s), &vector))
{
BURP_msg_partial(false, 255); // msg 255: gbak: WARNING:
burp_output(false, "%s\n", s);
BURP_output(false, "%s\n", s);
while (fb_interpret(s, sizeof(s), &vector))
{
BURP_msg_partial(false, 255); // msg 255: gbak: WARNING:
burp_output(false, " %s\n", s);
BURP_output(false, " %s\n", s);
}
}
}
@ -1681,7 +1680,7 @@ void BURP_verbose(USHORT number, const SafeArg& arg)
BURP_msg_put(false, number, arg);
}
else
burp_output(false, "%s", "");
BURP_output(false, "%s", "");
}
@ -1709,7 +1708,7 @@ void BURP_verbose(USHORT number, const char* str)
BURP_msg_put(false, number, SafeArg() << str);
}
else
burp_output(false, "%s", "");
BURP_output(false, "%s", "");
}
@ -2195,7 +2194,7 @@ static gbak_action open_files(const TEXT* file1,
}
static void burp_output(bool err, const SCHAR* format, ...)
void BURP_output(bool err, const SCHAR* format, ...)
{
/**************************************
*
@ -2504,7 +2503,7 @@ void BurpGlobals::print_stats(USHORT number)
const bool total = (number == 369);
// msg 369 total statistics
burp_output(false, " ");
BURP_output(false, " ");
const int time_mask = (1 << TIME_TOTAL) | (1 << TIME_DELTA);
if (gbl_stat_flags & time_mask)
@ -2515,13 +2514,13 @@ void BurpGlobals::print_stats(USHORT number)
if (gbl_stat_flags & (1 << TIME_TOTAL))
{
SINT64 t1 = (t0 - gbl_stats[TIME_TOTAL]) / freq_ms;
burp_output(false, STAT_FORMATS[TIME_TOTAL].format, (int)(t1 / 1000), (int)(t1 % 1000));
BURP_output(false, STAT_FORMATS[TIME_TOTAL].format, (int)(t1 / 1000), (int)(t1 % 1000));
}
if (gbl_stat_flags & (1 << TIME_DELTA))
{
SINT64 t2 = (t0 - gbl_stats[TIME_DELTA]) / freq_ms;
burp_output(false, STAT_FORMATS[TIME_DELTA].format, (int)(t2 / 1000), (int)(t2 % 1000));
BURP_output(false, STAT_FORMATS[TIME_DELTA].format, (int)(t2 / 1000), (int)(t2 % 1000));
gbl_stats[TIME_DELTA] = t0;
}
@ -2543,7 +2542,7 @@ void BurpGlobals::print_stats(USHORT number)
gbl_stats[i] = cur_stats[i];
burp_output(false, STAT_FORMATS[i].format, val);
BURP_output(false, STAT_FORMATS[i].format, val);
}
}
@ -2559,15 +2558,15 @@ void BurpGlobals::print_stats_header()
gbl_stat_header = true;
BURP_msg_partial(false, 169); // msg 169: gbak:
burp_output(false, " ");
BURP_output(false, " ");
for (int i = 0; i < LAST_COUNTER; i++)
{
if (gbl_stat_flags & (1 << i))
burp_output(false, "%-*s", STAT_FORMATS[i].width, STAT_FORMATS[i].header);
BURP_output(false, "%-*s", STAT_FORMATS[i].width, STAT_FORMATS[i].header);
}
burp_output(false, "\n");
BURP_output(false, "\n");
}
UnicodeCollationHolder::UnicodeCollationHolder(MemoryPool& pool)

View File

@ -39,6 +39,7 @@ void BURP_msg_partial(bool, USHORT, const MsgFormat::SafeArg& arg = MsgFormat::S
void BURP_msg_put(bool, USHORT, const MsgFormat::SafeArg& arg);
const int BURP_MSG_GET_SIZE = 128; // Use it for buffers passed to this function.
void BURP_msg_get(USHORT, TEXT*, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void BURP_output(bool err, const SCHAR*, ...) ATTRIBUTE_FORMAT(2,3);
void BURP_output_version(void*, const TEXT*);
void BURP_print(bool err, USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void BURP_print(bool err, USHORT, const char* str);

View File

@ -8463,6 +8463,11 @@ bool get_trigger_old (BurpGlobals* tdgbl, burp_rel* relation)
return true;
}
void write_skip_message(const char* trigName, const char* relName)
{
BURP_output(false, "gbak:Skipped trigger %s on system table %s\n", trigName, relName);
}
bool get_trigger(BurpGlobals* tdgbl)
{
/**************************************
@ -8477,6 +8482,7 @@ bool get_trigger(BurpGlobals* tdgbl)
**************************************/
att_type attribute;
BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name;
BASED_ON RDB$TRIGGERS.RDB$RELATION_NAME relName;
scan_attr_t scan_next_attr;
bool skipTrig = false;
@ -8546,10 +8552,12 @@ bool get_trigger(BurpGlobals* tdgbl)
case att_trig_relation_name:
X.RDB$RELATION_NAME.NULL = FALSE;
GET_TEXT(X.RDB$RELATION_NAME);
strcpy (relName, X.RDB$RELATION_NAME);
// Check for trigger on system relation
FOR (TRANSACTION_HANDLE local_trans REQUEST_HANDLE tdgbl->handles_get_trigger_req_handle2)
Y IN RDB$RELATIONS
WITH Y.RDB$RELATION_NAME EQ X.RDB$RELATION_NAME
WITH Y.RDB$RELATION_NAME EQ relName
AND Y.RDB$SYSTEM_FLAG EQ 1
skipTrig = true;
@ -8628,7 +8636,10 @@ bool get_trigger(BurpGlobals* tdgbl)
// Skip trigger on system relation
if (skipTrig)
{
write_skip_message(name, relName);
return true;
}
END_STORE;
ON_ERROR
@ -8688,10 +8699,12 @@ bool get_trigger(BurpGlobals* tdgbl)
case att_trig_relation_name:
X.RDB$RELATION_NAME.NULL = FALSE;
GET_TEXT(X.RDB$RELATION_NAME);
strcpy (relName, X.RDB$RELATION_NAME);
// Check for trigger on system relation
FOR (TRANSACTION_HANDLE local_trans REQUEST_HANDLE tdgbl->handles_get_trigger_req_handle2)
Y IN RDB$RELATIONS
WITH Y.RDB$RELATION_NAME EQ X.RDB$RELATION_NAME
WITH Y.RDB$RELATION_NAME EQ relName
AND Y.RDB$SYSTEM_FLAG EQ 1
skipTrig = true;
@ -8759,7 +8772,10 @@ bool get_trigger(BurpGlobals* tdgbl)
// Skip trigger on system relation
if (skipTrig)
{
write_skip_message(name, relName);
return true;
}
END_STORE;
ON_ERROR