From 7b1f1886568efdd2a8e4baa6d6aca5013f13e3de Mon Sep 17 00:00:00 2001 From: dimitr Date: Fri, 15 Jan 2010 10:09:50 +0000 Subject: [PATCH] Fixed CORE-2793: Binary representation of the backup file is inconsistent among subsequent backup/restore cycles. --- src/burp/backup.epp | 32 ++++++++++++++++++++------------ src/burp/restore.epp | 4 ---- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/burp/backup.epp b/src/burp/backup.epp index c6713a07eb..1a4e6d51dd 100644 --- a/src/burp/backup.epp +++ b/src/burp/backup.epp @@ -557,7 +557,8 @@ burp_fld* get_fields( burp_rel* relation) BurpGlobals* tdgbl = BurpGlobals::getSpecific(); USHORT count = 1; - burp_fld* fields = NULL; + + Firebird::HalfStaticArray field_list; // if we have all capabilities, use the first request to get the // most performance out of the latest engine; if we don't @@ -670,15 +671,14 @@ burp_fld* get_fields( burp_rel* relation) field->fld_flags |= FLD_collate_flag; } - field->fld_next = fields; - fields = field; - // ODS 12 if (!X.RDB$GENERATOR_NAME.NULL) { COPY(X.RDB$GENERATOR_NAME, field->fld_generator); field->fld_identity_type = X.RDB$IDENTITY_TYPE; } + + field_list.add(field); } END_FOR ON_ERROR @@ -790,8 +790,7 @@ burp_fld* get_fields( burp_rel* relation) field->fld_flags |= FLD_collate_flag; } - field->fld_next = fields; - fields = field; + field_list.add(field); } END_FOR ON_ERROR @@ -799,6 +798,15 @@ burp_fld* get_fields( burp_rel* relation) END_ERROR } + burp_fld* fields = NULL; + + while (field_list.getCount()) + { + field = field_list.pop(); + field->fld_next = fields; + fields = field; + } + return fields; } @@ -3233,9 +3241,9 @@ void write_global_fields() MISC_terminate (X.RDB$FIELD_NAME, temp, l, sizeof(temp)); BURP_verbose (149, temp); // msg 149 writing global field %.*s - if (X.RDB$QUERY_NAME [0] != ' ') + if (!X.RDB$QUERY_NAME.NULL && X.RDB$QUERY_NAME [0] != ' ') PUT_TEXT (att_field_query_name, X.RDB$QUERY_NAME); - if (X.RDB$EDIT_STRING [0] != ' ') + if (!X.RDB$EDIT_STRING.NULL && X.RDB$EDIT_STRING [0] != ' ') PUT_TEXT (att_field_edit_string, X.RDB$EDIT_STRING); put_source_blob (att_field_query_header, att_field_query_header, X.RDB$QUERY_HEADER); put_numeric (att_field_type, X.RDB$FIELD_TYPE); @@ -3305,9 +3313,9 @@ void write_global_fields() MISC_terminate (X.RDB$FIELD_NAME, temp, l, sizeof(temp)); BURP_verbose (149, temp); // msg 149 writing global field %.*s - if (X.RDB$QUERY_NAME [0] != ' ') + if (!X.RDB$QUERY_NAME.NULL && X.RDB$QUERY_NAME [0] != ' ') PUT_TEXT (att_field_query_name, X.RDB$QUERY_NAME); - if (X.RDB$EDIT_STRING [0] != ' ') + if (!X.RDB$EDIT_STRING.NULL && X.RDB$EDIT_STRING [0] != ' ') PUT_TEXT (att_field_edit_string, X.RDB$EDIT_STRING); put_source_blob (att_field_query_header, att_field_query_header, X.RDB$QUERY_HEADER); put_numeric (att_field_type, X.RDB$FIELD_TYPE); @@ -3373,9 +3381,9 @@ void write_global_fields() MISC_terminate (X.RDB$FIELD_NAME, temp, l, sizeof(temp)); BURP_verbose (149, temp); // msg 149 writing global field %.*s - if (X.RDB$QUERY_NAME [0] != ' ') + if (!X.RDB$QUERY_NAME.NULL && X.RDB$QUERY_NAME [0] != ' ') PUT_TEXT (att_field_query_name, X.RDB$QUERY_NAME); - if (X.RDB$EDIT_STRING [0] != ' ') + if (!X.RDB$EDIT_STRING.NULL && X.RDB$EDIT_STRING [0] != ' ') PUT_TEXT (att_field_edit_string, X.RDB$EDIT_STRING); put_source_blob (att_field_query_header, att_field_query_header, X.RDB$QUERY_HEADER); put_numeric (att_field_type, X.RDB$FIELD_TYPE); diff --git a/src/burp/restore.epp b/src/burp/restore.epp index 1117828c7e..61bd330a73 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -3577,7 +3577,6 @@ burp_fld* get_field(BurpGlobals* tdgbl, burp_rel* relation) { strcpy (X.RDB$RELATION_NAME, relation->rel_name); X.RDB$FIELD_POSITION = 0; - memset (X.RDB$QUERY_NAME, ' ', sizeof(X.RDB$QUERY_NAME)); X.RDB$VIEW_CONTEXT.NULL = TRUE; X.RDB$BASE_FIELD.NULL = TRUE; X.RDB$SECURITY_CLASS.NULL = TRUE; @@ -3787,7 +3786,6 @@ burp_fld* get_field(BurpGlobals* tdgbl, burp_rel* relation) { strcpy (X.RDB$RELATION_NAME, relation->rel_name); X.RDB$FIELD_POSITION = 0; - memset (X.RDB$QUERY_NAME, ' ', sizeof(X.RDB$QUERY_NAME)); X.RDB$VIEW_CONTEXT.NULL = TRUE; X.RDB$BASE_FIELD.NULL = TRUE; X.RDB$SECURITY_CLASS.NULL = TRUE; @@ -5544,7 +5542,6 @@ bool get_global_field(BurpGlobals* tdgbl) X.RDB$CHARACTER_SET_ID.NULL = TRUE; X.RDB$COLLATION_ID.NULL = TRUE; X.RDB$FIELD_PRECISION.NULL = TRUE; - memset (X.RDB$QUERY_NAME, ' ', sizeof(X.RDB$QUERY_NAME)); skip_init(&scan_next_attr); while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end) @@ -5895,7 +5892,6 @@ bool get_global_field(BurpGlobals* tdgbl) X.RDB$FIELD_SUB_TYPE.NULL = TRUE; X.RDB$CHARACTER_SET_ID.NULL = TRUE; X.RDB$COLLATION_ID.NULL = TRUE; - memset (X.RDB$QUERY_NAME, ' ', sizeof(X.RDB$QUERY_NAME)); skip_init(&scan_next_attr); while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end)