mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 18:03:04 +01:00
Changed the ODS encoding, messaging and protection rules.
This commit is contained in:
parent
bb3b484d47
commit
668907912f
@ -77,7 +77,7 @@ static const SCHAR * const messages[] = {
|
|||||||
"table %s was omitted from the transaction reserving list", /* 56, unres_rel */
|
"table %s was omitted from the transaction reserving list", /* 56, unres_rel */
|
||||||
"request includes a DSRI extension not supported in this implementation", /* 57, uns_ext */
|
"request includes a DSRI extension not supported in this implementation", /* 57, uns_ext */
|
||||||
"feature is not supported", /* 58, wish_list */
|
"feature is not supported", /* 58, wish_list */
|
||||||
"unsupported on-disk structure for file %s; found %ld type %04X, support %ld type %04X", /* 59, wrong_ods */
|
"unsupported on-disk structure for file %s; found %ld.%ld, support %ld.%ld", /* 59, wrong_ods */
|
||||||
"wrong number of arguments on call", /* 60, wronumarg */
|
"wrong number of arguments on call", /* 60, wronumarg */
|
||||||
"Implementation limit exceeded", /* 61, imp_exc */
|
"Implementation limit exceeded", /* 61, imp_exc */
|
||||||
"%s", /* 62, random */
|
"%s", /* 62, random */
|
||||||
|
@ -660,11 +660,10 @@ static void dmp_header(const header_page* page)
|
|||||||
const USHORT minor_version = page->hdr_ods_minor;
|
const USHORT minor_version = page->hdr_ods_minor;
|
||||||
|
|
||||||
fprintf(dbg_file,
|
fprintf(dbg_file,
|
||||||
"HEADER PAGE\t checksum %d\t generation %ld\n\tPage size: %d, version: %d.%d(%d) type %04x, pages: %ld\n",
|
"HEADER PAGE\t checksum %d\t generation %ld\n\tPage size: %d, version: %d.%d(%d), pages: %ld\n",
|
||||||
((PAG) page)->pag_checksum, ((PAG) page)->pag_generation,
|
((PAG) page)->pag_checksum, ((PAG) page)->pag_generation,
|
||||||
page->hdr_page_size, page->hdr_ods_version & ~ODS_TYPE_MASK,
|
page->hdr_page_size, page->hdr_ods_version & ~ODS_FIREBIRD_FLAG,
|
||||||
minor_version, page->hdr_ods_minor_original,
|
minor_version, page->hdr_ods_minor_original, page->hdr_PAGES);
|
||||||
page->hdr_ods_version & ODS_TYPE_MASK, page->hdr_PAGES);
|
|
||||||
|
|
||||||
struct tm time;
|
struct tm time;
|
||||||
isc_decode_timestamp((GDS_TIMESTAMP *) page->hdr_creation_date, &time);
|
isc_decode_timestamp((GDS_TIMESTAMP *) page->hdr_creation_date, &time);
|
||||||
|
@ -119,10 +119,13 @@ const USHORT ODS_10_0 = ENCODE_ODS(ODS_VERSION10, 0);
|
|||||||
const USHORT ODS_10_1 = ENCODE_ODS(ODS_VERSION10, 1);
|
const USHORT ODS_10_1 = ENCODE_ODS(ODS_VERSION10, 1);
|
||||||
const USHORT ODS_11_0 = ENCODE_ODS(ODS_VERSION11, 0);
|
const USHORT ODS_11_0 = ENCODE_ODS(ODS_VERSION11, 0);
|
||||||
|
|
||||||
|
const USHORT ODS_FIREBIRD_FLAG = 0x8000;
|
||||||
|
|
||||||
/* Decode ODS version to Major and Minor parts. The 4 LSB's are minor and
|
/* Decode ODS version to Major and Minor parts. The 4 LSB's are minor and
|
||||||
the next 4 bits are major version number */
|
the next 11 bits are major version number. The highest significant bit
|
||||||
|
is the Firebird database flag. */
|
||||||
inline USHORT DECODE_ODS_MAJOR(USHORT ods_version) {
|
inline USHORT DECODE_ODS_MAJOR(USHORT ods_version) {
|
||||||
return ((ods_version & 0x00F0) >> 4);
|
return ((ods_version & 0x7FF0) >> 4);
|
||||||
}
|
}
|
||||||
inline USHORT DECODE_ODS_MINOR(USHORT ods_version) {
|
inline USHORT DECODE_ODS_MINOR(USHORT ods_version) {
|
||||||
return (ods_version & 0x000F);
|
return (ods_version & 0x000F);
|
||||||
@ -130,48 +133,52 @@ inline USHORT DECODE_ODS_MINOR(USHORT ods_version) {
|
|||||||
|
|
||||||
/* Set current ODS major and minor version */
|
/* Set current ODS major and minor version */
|
||||||
|
|
||||||
const USHORT ODS_VERSION = ODS_VERSION11; /* current ods major version -- always
|
const USHORT ODS_VERSION = ODS_VERSION11; // Current ODS major version -- always
|
||||||
the highest */
|
// the highest.
|
||||||
const USHORT ODS_CURRENT = ODS_CURRENT11; /* the highest defined minor version
|
|
||||||
number for this ODS_VERSION!! */
|
|
||||||
const USHORT ODS_CURRENT_VERSION = ODS_11_0; /* Current ODS version in use which includes
|
|
||||||
both Major and Minor ODS versions! */
|
|
||||||
// ODS types.
|
|
||||||
const USHORT ODS_TYPE_MASK = 0xFF00;
|
|
||||||
const USHORT ODS_TYPE_INTERBASE = 0x0000; // Interbase ODS (we support it up to ODS10)
|
|
||||||
const USHORT ODS_TYPE_FIREBIRD = 0x0100; // Official Firebird ODS (used since ODS11)
|
|
||||||
const USHORT ODS_TYPE_TRANSIENT = 0x0200; // Firebird ODS with some unfinished changes
|
|
||||||
const USHORT ODS_TYPE_TRANSIENT_INTL= 0x0300; // Firebird 2 - INTL branch
|
|
||||||
|
|
||||||
// ODS types in range 0x80-0xFF are reserved for private builds and forks
|
const USHORT ODS_RELEASED = ODS_CURRENT11; // The lowest stable minor version
|
||||||
const USHORT ODS_TYPE_PRIVATE_0 = 0x8000; // ODS used for private versions, such as BroadView builds
|
// number for this ODS_VERSION!
|
||||||
|
|
||||||
|
const USHORT ODS_CURRENT = ODS_CURRENT11; // The highest defined minor version
|
||||||
|
// number for this ODS_VERSION!
|
||||||
|
|
||||||
|
const USHORT ODS_CURRENT_VERSION = ODS_11_0; // Current ODS version in use which includes
|
||||||
|
// both major and minor ODS versions!
|
||||||
|
|
||||||
const USHORT ODS_TYPE_CURRENT = ODS_TYPE_TRANSIENT_INTL;
|
|
||||||
//const USHORT ODS_TYPE_CURRENT = ODS_TYPE_TRANSIENT;
|
|
||||||
//const USHORT ODS_TYPE_CURRENT = ODS_TYPE_PRIVATE_0;
|
|
||||||
|
|
||||||
const USHORT USER_REL_INIT_ID_ODS8 = 31; /* ODS <= 8 */
|
const USHORT USER_REL_INIT_ID_ODS8 = 31; /* ODS <= 8 */
|
||||||
const USHORT USER_DEF_REL_INIT_ID = 128; /* ODS >= 9 */
|
const USHORT USER_DEF_REL_INIT_ID = 128; /* ODS >= 9 */
|
||||||
|
|
||||||
|
|
||||||
static inline bool ODS_SUPPORTED(USHORT hdr_version) {
|
static inline bool ODS_SUPPORTED(USHORT ods_major_version,
|
||||||
USHORT ods_version = hdr_version & ~ODS_TYPE_MASK;
|
USHORT ods_minor_version)
|
||||||
USHORT ods_type = hdr_version & ODS_TYPE_MASK;
|
{
|
||||||
|
bool ods_firebird_flag = (ods_major_version & ODS_FIREBIRD_FLAG);
|
||||||
|
ods_major_version &= ~ODS_FIREBIRD_FLAG;
|
||||||
|
|
||||||
#ifdef ODS_8_TO_CURRENT
|
#ifdef ODS_8_TO_CURRENT
|
||||||
// Support Interbase ODS from 8 to 10;
|
// Support InterBase major ODS numbers from 8 to 10
|
||||||
if (ods_type == ODS_TYPE_INTERBASE)
|
if (!ods_firebird_flag)
|
||||||
return ods_version >= ODS_VERSION8 && ods_version <= ODS_VERSION10;
|
{
|
||||||
|
return (ods_major_version >= ODS_VERSION8 &&
|
||||||
|
ods_major_version <= ODS_VERSION10);
|
||||||
|
}
|
||||||
|
|
||||||
// This is for future ODS versions
|
// This is for future ODS versions
|
||||||
if (ods_type == ODS_TYPE_FIREBIRD &&
|
if (ods_major_version > ODS_VERSION10 &&
|
||||||
ods_version > ODS_VERSION10 && ods_version <= ODS_VERSION - 1)
|
ods_major_version < ODS_VERSION)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support current ODS of the engine
|
// Support current ODS of the engine
|
||||||
if (ods_type == ODS_TYPE_CURRENT && ods_version == ODS_VERSION)
|
if (ods_major_version == ODS_VERSION &&
|
||||||
|
ods_minor_version >= ODS_RELEASED &&
|
||||||
|
ods_minor_version <= ODS_CURRENT)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Do not support anything else
|
// Do not support anything else
|
||||||
return false;
|
return false;
|
||||||
|
@ -474,7 +474,7 @@ USHORT PAG_add_file(const TEXT* file_name, SLONG start)
|
|||||||
/* The following lines (taken from PAG_format_header) are needed to identify
|
/* The following lines (taken from PAG_format_header) are needed to identify
|
||||||
this file in raw_devices_validate_database as a valid database attachment. */
|
this file in raw_devices_validate_database as a valid database attachment. */
|
||||||
MOV_time_stamp(reinterpret_cast<ISC_TIMESTAMP*>(header->hdr_creation_date));
|
MOV_time_stamp(reinterpret_cast<ISC_TIMESTAMP*>(header->hdr_creation_date));
|
||||||
header->hdr_ods_version = ODS_VERSION | ODS_TYPE_CURRENT;
|
header->hdr_ods_version = ODS_VERSION | ODS_FIREBIRD_FLAG;
|
||||||
header->hdr_implementation = CLASS;
|
header->hdr_implementation = CLASS;
|
||||||
header->hdr_ods_minor = ODS_CURRENT;
|
header->hdr_ods_minor = ODS_CURRENT;
|
||||||
header->hdr_ods_minor_original = ODS_CURRENT;
|
header->hdr_ods_minor_original = ODS_CURRENT;
|
||||||
@ -895,7 +895,7 @@ void PAG_format_header(void)
|
|||||||
MOV_time_stamp(reinterpret_cast<ISC_TIMESTAMP*>(header->hdr_creation_date));
|
MOV_time_stamp(reinterpret_cast<ISC_TIMESTAMP*>(header->hdr_creation_date));
|
||||||
header->hdr_header.pag_type = pag_header;
|
header->hdr_header.pag_type = pag_header;
|
||||||
header->hdr_page_size = dbb->dbb_page_size;
|
header->hdr_page_size = dbb->dbb_page_size;
|
||||||
header->hdr_ods_version = ODS_VERSION | ODS_TYPE_CURRENT;
|
header->hdr_ods_version = ODS_VERSION | ODS_FIREBIRD_FLAG;
|
||||||
header->hdr_implementation = CLASS;
|
header->hdr_implementation = CLASS;
|
||||||
header->hdr_ods_minor = ODS_CURRENT;
|
header->hdr_ods_minor = ODS_CURRENT;
|
||||||
header->hdr_ods_minor_original = ODS_CURRENT;
|
header->hdr_ods_minor_original = ODS_CURRENT;
|
||||||
@ -911,7 +911,7 @@ void PAG_format_header(void)
|
|||||||
header->hdr_flags |= hdr_SQL_dialect_3;
|
header->hdr_flags |= hdr_SQL_dialect_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbb->dbb_ods_version = header->hdr_ods_version & ~ODS_TYPE_MASK;
|
dbb->dbb_ods_version = header->hdr_ods_version & ~ODS_FIREBIRD_FLAG;
|
||||||
dbb->dbb_minor_version = header->hdr_ods_minor;
|
dbb->dbb_minor_version = header->hdr_ods_minor;
|
||||||
dbb->dbb_minor_original = header->hdr_ods_minor_original;
|
dbb->dbb_minor_original = header->hdr_ods_minor_original;
|
||||||
|
|
||||||
@ -1075,15 +1075,16 @@ void PAG_header(const TEXT* file_name, USHORT file_length)
|
|||||||
file_length), 0);
|
file_length), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ODS_SUPPORTED(header->hdr_ods_version))
|
if (!ODS_SUPPORTED(header->hdr_ods_version, header->hdr_ods_minor))
|
||||||
{
|
{
|
||||||
ERR_post(isc_wrong_ods,
|
ERR_post(isc_wrong_ods,
|
||||||
isc_arg_cstring, file_length, ERR_string(file_name,
|
isc_arg_cstring, file_length, ERR_string(file_name,
|
||||||
file_length),
|
file_length),
|
||||||
isc_arg_number, (SLONG) (header->hdr_ods_version & ~ODS_TYPE_MASK),
|
isc_arg_number, (SLONG) (header->hdr_ods_version & ~ODS_FIREBIRD_FLAG),
|
||||||
isc_arg_number, (SLONG) (header->hdr_ods_version & ODS_TYPE_MASK),
|
isc_arg_number, (SLONG) header->hdr_ods_minor,
|
||||||
isc_arg_number, (SLONG) ODS_VERSION,
|
isc_arg_number, (SLONG) ODS_VERSION,
|
||||||
isc_arg_number, (SLONG) ODS_TYPE_CURRENT, 0);
|
isc_arg_number, (SLONG) ODS_CURRENT,
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****
|
/****
|
||||||
@ -1134,7 +1135,7 @@ is accessed with engine built for another architecture. - Nickolay 9-Feb-2005
|
|||||||
BUGCHECK(267); /* next transaction older than oldest transaction */
|
BUGCHECK(267); /* next transaction older than oldest transaction */
|
||||||
}
|
}
|
||||||
|
|
||||||
dbb->dbb_ods_version = header->hdr_ods_version & ~ODS_TYPE_MASK;
|
dbb->dbb_ods_version = header->hdr_ods_version & ~ODS_FIREBIRD_FLAG;
|
||||||
dbb->dbb_minor_version = header->hdr_ods_minor;
|
dbb->dbb_minor_version = header->hdr_ods_minor;
|
||||||
dbb->dbb_minor_original = header->hdr_ods_minor_original;
|
dbb->dbb_minor_original = header->hdr_ods_minor_original;
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FL
|
|||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('unres_rel', NULL, NULL, NULL, 0, 56, NULL, 'table %s was omitted from the transaction reserving list', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('unres_rel', NULL, NULL, NULL, 0, 56, NULL, 'table %s was omitted from the transaction reserving list', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('uns_ext', NULL, NULL, NULL, 0, 57, NULL, 'request includes a DSRI extension not supported in this implementation', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('uns_ext', NULL, NULL, NULL, 0, 57, NULL, 'request includes a DSRI extension not supported in this implementation', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wish_list', NULL, NULL, NULL, 0, 58, NULL, 'feature is not supported', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wish_list', NULL, NULL, NULL, 0, 58, NULL, 'feature is not supported', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wrong_ods', '', '', NULL, 0, 59, NULL, 'unsupported on-disk structure for file %s; found %ld type %04X, support %ld type %04X', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wrong_ods', '', '', NULL, 0, 59, NULL, 'unsupported on-disk structure for file %s; found %ld.%ld, support %ld.%ld', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wronumarg', NULL, NULL, NULL, 0, 60, NULL, 'wrong number of arguments on call', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('wronumarg', NULL, NULL, NULL, 0, 60, NULL, 'wrong number of arguments on call', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('imp_exc', NULL, NULL, NULL, 0, 61, NULL, 'Implementation limit exceeded', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('imp_exc', NULL, NULL, NULL, 0, 61, NULL, 'Implementation limit exceeded', NULL, NULL);
|
||||||
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('random', NULL, NULL, NULL, 0, 62, NULL, '%s', NULL, NULL);
|
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('random', NULL, NULL, NULL, 0, 62, NULL, '%s', NULL, NULL);
|
||||||
|
@ -548,16 +548,16 @@ int CLIB_ROUTINE main(int argc, char** argv)
|
|||||||
service->svc_started();
|
service->svc_started();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ODS_SUPPORTED(header->hdr_ods_version))
|
if (!ODS_SUPPORTED(header->hdr_ods_version, header->hdr_ods_minor))
|
||||||
{
|
{
|
||||||
#ifdef SUPERSERVER
|
#ifdef SUPERSERVER
|
||||||
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
CMD_UTIL_put_svc_status(tddba->dba_service_blk->svc_status,
|
||||||
GSTAT_MSG_FAC, 3,
|
GSTAT_MSG_FAC, 3,
|
||||||
isc_arg_number, (void*)(IPTR)(ODS_VERSION | ODS_TYPE_CURRENT),
|
isc_arg_number, (void*)(IPTR)(ODS_VERSION | ODS_FIREBIRD_FLAG),
|
||||||
isc_arg_number, (void*)(IPTR)header->hdr_ods_version,
|
isc_arg_number, (void*)(IPTR)header->hdr_ods_version,
|
||||||
0, NULL, 0, NULL, 0, NULL);
|
0, NULL, 0, NULL, 0, NULL);
|
||||||
#endif
|
#endif
|
||||||
dba_error(3, (TEXT *)(IPTR) (ODS_VERSION | ODS_TYPE_CURRENT), (TEXT *)(IPTR) header->hdr_ods_version,
|
dba_error(3, (TEXT *)(IPTR) (ODS_VERSION | ODS_FIREBIRD_FLAG), (TEXT *)(IPTR) header->hdr_ods_version,
|
||||||
0, 0, 0); /* msg 3: Wrong ODS version, expected %d, encountered %d? */
|
0, 0, 0); /* msg 3: Wrong ODS version, expected %d, encountered %d? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ void PPG_print_header(const header_page* header, SLONG page, bool nocreation,
|
|||||||
FPRINTF(outfile, "\tGeneration\t\t%"ULONGFORMAT"\n",
|
FPRINTF(outfile, "\tGeneration\t\t%"ULONGFORMAT"\n",
|
||||||
header->hdr_header.pag_generation);
|
header->hdr_header.pag_generation);
|
||||||
FPRINTF(outfile, "\tPage size\t\t%d\n", header->hdr_page_size);
|
FPRINTF(outfile, "\tPage size\t\t%d\n", header->hdr_page_size);
|
||||||
FPRINTF(outfile, "\tODS version\t\t%d.%d type %04x\n", header->hdr_ods_version & ~ODS_TYPE_MASK,
|
FPRINTF(outfile, "\tODS version\t\t%d.%d\n",
|
||||||
header->hdr_ods_minor, header->hdr_ods_version & ODS_TYPE_MASK);
|
header->hdr_ods_version & ~ODS_FIREBIRD_FLAG, header->hdr_ods_minor);
|
||||||
FPRINTF(outfile, "\tOldest transaction\t%"SLONGFORMAT"\n",
|
FPRINTF(outfile, "\tOldest transaction\t%"SLONGFORMAT"\n",
|
||||||
header->hdr_oldest_transaction);
|
header->hdr_oldest_transaction);
|
||||||
FPRINTF(outfile, "\tOldest active\t\t%"SLONGFORMAT"\n",
|
FPRINTF(outfile, "\tOldest active\t\t%"SLONGFORMAT"\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user