ods.h (Firebird-3.0.2.32703-0.tar.bz2) | : | ods.h (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* | * | |||
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port | * 2002.10.29 Sean Leyne - Removed obsolete "Netware" port | |||
* | * | |||
* 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define | * 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define | |||
* | * | |||
*/ | */ | |||
#ifndef JRD_ODS_H | #ifndef JRD_ODS_H | |||
#define JRD_ODS_H | #define JRD_ODS_H | |||
#ifndef ODS_TESTING | ||||
#include "../jrd/RecordNumber.h" | #include "../jrd/RecordNumber.h" | |||
#include "../common/classes/fb_string.h" | #include "../common/classes/fb_string.h" | |||
#endif //ODS_TESTING | ||||
// This macro enables the ability of the engine to connect to databases | // This macro enables the ability of the engine to connect to databases | |||
// from ODS 8 up to the latest. If this macro is undefined, the engine | // from ODS 8 up to the latest. If this macro is undefined, the engine | |||
// only opens a database of the current ODS major version. | // only opens a database of the current ODS major version. | |||
//#define ODS_8_TO_CURRENT | //#define ODS_8_TO_CURRENT | |||
/********************************************************************** | /********************************************************************** | |||
** | ** | |||
** NOTE: | ** NOTE: | |||
skipping to change at line 120 | skipping to change at line 122 | |||
// Minor versions for ODS 11 | // Minor versions for ODS 11 | |||
//const USHORT ODS_CURRENT11_0 = 0; // Firebird 2.0 features | //const USHORT ODS_CURRENT11_0 = 0; // Firebird 2.0 features | |||
//const USHORT ODS_CURRENT11_1 = 1; // Firebird 2.1 features | //const USHORT ODS_CURRENT11_1 = 1; // Firebird 2.1 features | |||
//const USHORT ODS_CURRENT11_2 = 2; // Firebird 2.5 features | //const USHORT ODS_CURRENT11_2 = 2; // Firebird 2.5 features | |||
//const USHORT ODS_CURRENT11 = 2; | //const USHORT ODS_CURRENT11 = 2; | |||
// Minor versions for ODS 12 | // Minor versions for ODS 12 | |||
const USHORT ODS_CURRENT12_0 = 0; // Firebird 3.0 features | const USHORT ODS_CURRENT12_0 = 0; // Firebird 3.0 features | |||
const USHORT ODS_CURRENT12 = 0; | const USHORT ODS_CURRENT12_1 = 1; // Skipped due to Avalerion's blunder | |||
const USHORT ODS_CURRENT12_2 = 2; // Fix for generator page for linux/x86 | ||||
const USHORT ODS_CURRENT12 = 2; | ||||
// useful ODS macros. These are currently used to flag the version of the | // useful ODS macros. These are currently used to flag the version of the | |||
// system triggers and system indices in ini.e | // system triggers and system indices in ini.e | |||
inline USHORT ENCODE_ODS(USHORT major, USHORT minor) | inline USHORT ENCODE_ODS(USHORT major, USHORT minor) | |||
{ | { | |||
return ((major << 4) | minor); | return ((major << 4) | minor); | |||
} | } | |||
const USHORT ODS_8_0 = ENCODE_ODS(ODS_VERSION8, 0); | const USHORT ODS_8_0 = ENCODE_ODS(ODS_VERSION8, 0); | |||
const USHORT ODS_8_1 = ENCODE_ODS(ODS_VERSION8, 1); | const USHORT ODS_8_1 = ENCODE_ODS(ODS_VERSION8, 1); | |||
const USHORT ODS_9_0 = ENCODE_ODS(ODS_VERSION9, 0); | const USHORT ODS_9_0 = ENCODE_ODS(ODS_VERSION9, 0); | |||
const USHORT ODS_9_1 = ENCODE_ODS(ODS_VERSION9, 1); | const USHORT ODS_9_1 = ENCODE_ODS(ODS_VERSION9, 1); | |||
const USHORT ODS_10_0 = ENCODE_ODS(ODS_VERSION10, 0); | 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_11_1 = ENCODE_ODS(ODS_VERSION11, 1); | const USHORT ODS_11_1 = ENCODE_ODS(ODS_VERSION11, 1); | |||
const USHORT ODS_11_2 = ENCODE_ODS(ODS_VERSION11, 2); | const USHORT ODS_11_2 = ENCODE_ODS(ODS_VERSION11, 2); | |||
const USHORT ODS_12_0 = ENCODE_ODS(ODS_VERSION12, 0); | const USHORT ODS_12_0 = ENCODE_ODS(ODS_VERSION12, 0); | |||
//const USHORT ODS_12_1 = ENCODE_ODS(ODS_VERSION12, 1); / | ||||
/ Skipped due to Avalerion's blunder | ||||
const USHORT ODS_12_2 = ENCODE_ODS(ODS_VERSION12, 2); | ||||
const USHORT ODS_FIREBIRD_FLAG = 0x8000; | 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 11 bits are major version number. The highest significant bit | // the next 11 bits are major version number. The highest significant bit | |||
// is the Firebird database flag. | // is the Firebird database flag. | |||
inline USHORT DECODE_ODS_MAJOR(USHORT ods_version) | inline USHORT DECODE_ODS_MAJOR(USHORT ods_version) | |||
{ | { | |||
return ((ods_version & 0x7FF0) >> 4); | return ((ods_version & 0x7FF0) >> 4); | |||
} | } | |||
skipping to change at line 167 | skipping to change at line 173 | |||
const USHORT ODS_VERSION = ODS_VERSION12; // Current ODS major vers ion -- always | const USHORT ODS_VERSION = ODS_VERSION12; // Current ODS major vers ion -- always | |||
// the highest. | // the highest. | |||
const USHORT ODS_RELEASED = ODS_CURRENT12_0; // The lowest stable minor versio n | const USHORT ODS_RELEASED = ODS_CURRENT12_0; // The lowest stable minor versio n | |||
// number for this ODS_VERSION! | // number for this ODS_VERSION! | |||
const USHORT ODS_CURRENT = ODS_CURRENT12; // The highest defined mi nor version | const USHORT ODS_CURRENT = ODS_CURRENT12; // The highest defined mi nor version | |||
// number for this ODS_VERSION! | // number for this ODS_VERSION! | |||
const USHORT ODS_CURRENT_VERSION = ODS_12_0; // Current ODS version in use whi ch includes | const USHORT ODS_CURRENT_VERSION = ODS_12_2; // Current ODS version in use whi ch includes | |||
// both major and minor ODS versions! | // both major and minor ODS versions! | |||
//const USHORT USER_REL_INIT_ID_ODS8 = 31; // ODS < 9 ( <= 8.2) | //const USHORT USER_REL_INIT_ID_ODS8 = 31; // ODS < 9 ( <= 8.2) | |||
const USHORT USER_DEF_REL_INIT_ID = 128; // ODS >= 9 | const USHORT USER_DEF_REL_INIT_ID = 128; // ODS >= 9 | |||
// Page types | // Page types | |||
const SCHAR pag_undefined = 0; | const SCHAR pag_undefined = 0; | |||
const SCHAR pag_header = 1; // Database header page | const SCHAR pag_header = 1; // Database header page | |||
const SCHAR pag_pages = 2; // Page inventory page | const SCHAR pag_pages = 2; // Page inventory page | |||
skipping to change at line 307 | skipping to change at line 313 | |||
// Index root page | // Index root page | |||
struct index_root_page | struct index_root_page | |||
{ | { | |||
pag irt_header; | pag irt_header; | |||
USHORT irt_relation; // relation id (for consistency) | USHORT irt_relation; // relation id (for consistency) | |||
USHORT irt_count; // Number of indices | USHORT irt_count; // Number of indices | |||
struct irt_repeat | struct irt_repeat | |||
{ | { | |||
#ifndef ODS_TESTING | ||||
private: | private: | |||
#endif //ODS_TESTING | ||||
ULONG irt_root; // page number of index r oot if irt_in_progress is NOT set, or | ULONG irt_root; // page number of index r oot if irt_in_progress is NOT set, or | |||
// highes t 32 bit of transaction if irt_in_progress is set | // highes t 32 bit of transaction if irt_in_progress is set | |||
ULONG irt_transaction; // transaction in progress (lowes t 32 bits) | ULONG irt_transaction; // transaction in progress (lowes t 32 bits) | |||
public: | public: | |||
USHORT irt_desc; // offset to key descript ions | USHORT irt_desc; // offset to key descript ions | |||
UCHAR irt_keys; // number of keys in inde x | UCHAR irt_keys; // number of keys in inde x | |||
UCHAR irt_flags; | UCHAR irt_flags; | |||
#ifndef ODS_TESTING | ||||
ULONG getRoot() const; | ULONG getRoot() const; | |||
void setRoot(ULONG root_page); | void setRoot(ULONG root_page); | |||
TraNumber getTransaction() const; | TraNumber getTransaction() const; | |||
void setTransaction(TraNumber traNumber); | void setTransaction(TraNumber traNumber); | |||
bool isUsed() const; | bool isUsed() const; | |||
#endif //ODS_TESTING | ||||
} irt_rpt[1]; | } irt_rpt[1]; | |||
}; | }; | |||
// key descriptor | // key descriptor | |||
struct irtd | struct irtd | |||
{ | { | |||
USHORT irtd_field; | USHORT irtd_field; | |||
USHORT irtd_itype; | USHORT irtd_itype; | |||
float irtd_selectivity; | float irtd_selectivity; | |||
}; | }; | |||
// irt_flags, must match the idx_flags (see btr.h) | // irt_flags, must match the idx_flags (see btr.h) | |||
const USHORT irt_unique = 1; | const USHORT irt_unique = 1; | |||
const USHORT irt_descending = 2; | const USHORT irt_descending = 2; | |||
const USHORT irt_in_progress = 4; | const USHORT irt_in_progress = 4; | |||
const USHORT irt_foreign = 8; | const USHORT irt_foreign = 8; | |||
const USHORT irt_primary = 16; | const USHORT irt_primary = 16; | |||
const USHORT irt_expression = 32; | const USHORT irt_expression = 32; | |||
#ifndef ODS_TESTING | ||||
inline ULONG index_root_page::irt_repeat::getRoot() const | inline ULONG index_root_page::irt_repeat::getRoot() const | |||
{ | { | |||
return (irt_flags & irt_in_progress) ? 0 : irt_root; | return (irt_flags & irt_in_progress) ? 0 : irt_root; | |||
} | } | |||
inline void index_root_page::irt_repeat::setRoot(ULONG root_page) | inline void index_root_page::irt_repeat::setRoot(ULONG root_page) | |||
{ | { | |||
irt_root = root_page; | irt_root = root_page; | |||
irt_flags &= ~irt_in_progress; | irt_flags &= ~irt_in_progress; | |||
} | } | |||
skipping to change at line 370 | skipping to change at line 381 | |||
{ | { | |||
irt_root = ULONG(traNumber >> BITS_PER_LONG); | irt_root = ULONG(traNumber >> BITS_PER_LONG); | |||
irt_transaction = ULONG(traNumber); | irt_transaction = ULONG(traNumber); | |||
irt_flags |= irt_in_progress; | irt_flags |= irt_in_progress; | |||
} | } | |||
inline bool index_root_page::irt_repeat::isUsed() const | inline bool index_root_page::irt_repeat::isUsed() const | |||
{ | { | |||
return (irt_flags & irt_in_progress) || (irt_root != 0); | return (irt_flags & irt_in_progress) || (irt_root != 0); | |||
} | } | |||
#endif //ODS_TESTING | ||||
const int STUFF_COUNT = 4; | const int STUFF_COUNT = 4; | |||
const ULONG END_LEVEL = ~0; | const ULONG END_LEVEL = ~0; | |||
const ULONG END_BUCKET = (~0u) << 1; | const ULONG END_BUCKET = (~0u) << 1; | |||
// Header page | // Header page | |||
struct header_page | struct header_page | |||
{ | { | |||
skipping to change at line 554 | skipping to change at line 566 | |||
ULONG tip_next; // Next transaction inventory pag e | ULONG tip_next; // Next transaction inventory pag e | |||
UCHAR tip_transactions[1]; | UCHAR tip_transactions[1]; | |||
}; | }; | |||
// Generator Page | // Generator Page | |||
struct generator_page | struct generator_page | |||
{ | { | |||
pag gpg_header; | pag gpg_header; | |||
ULONG gpg_sequence; // Sequence number | ULONG gpg_sequence; // Sequence number | |||
ULONG gpg_dummy1; // Alignment enforced | ||||
SINT64 gpg_values[1]; // Generator vector | SINT64 gpg_values[1]; // Generator vector | |||
}; | }; | |||
// Record header | // Record header | |||
struct rhd | struct rhd | |||
{ | { | |||
ULONG rhd_transaction; // transaction id (lowest 32 bits) | ULONG rhd_transaction; // transaction id (lowest 32 bits) | |||
ULONG rhd_b_page; // back pointer | ULONG rhd_b_page; // back pointer | |||
USHORT rhd_b_line; // back line | USHORT rhd_b_line; // back line | |||
skipping to change at line 686 | skipping to change at line 699 | |||
{ | { | |||
if (!count) | if (!count) | |||
count = 1; | count = 1; | |||
return sizeof (InternalArrayDesc) + | return sizeof (InternalArrayDesc) + | |||
(count - 1) * sizeof (InternalArrayDesc::iad_repeat); | (count - 1) * sizeof (InternalArrayDesc::iad_repeat); | |||
} | } | |||
*/ | */ | |||
#define IAD_LEN(count) (sizeof (Ods::InternalArrayDesc) + \ | #define IAD_LEN(count) (sizeof (Ods::InternalArrayDesc) + \ | |||
(count ? count - 1: count) * sizeof (Ods::InternalArrayDesc::iad_repeat)) | (count ? count - 1: count) * sizeof (Ods::InternalArrayDesc::iad_repeat)) | |||
#ifndef ODS_TESTING | ||||
Firebird::string pagtype(UCHAR type); | Firebird::string pagtype(UCHAR type); | |||
#endif //ODS_TESTING | ||||
} //namespace Ods | } //namespace Ods | |||
// alignment for raw page access | // alignment for raw page access | |||
const USHORT PAGE_ALIGNMENT = 1024; | const USHORT PAGE_ALIGNMENT = 1024; | |||
// size of raw I/O operation for header page | // size of raw I/O operation for header page | |||
const USHORT RAW_HEADER_SIZE = 1024; // ROUNDUP(HDR_SIZE, PAGE_ALIGNMENT); | const USHORT RAW_HEADER_SIZE = 1024; // ROUNDUP(HDR_SIZE, PAGE_ALIGNMENT); | |||
#endif // JRD_ODS_H | #endif // JRD_ODS_H | |||
End of changes. 14 change blocks. | ||||
2 lines changed or deleted | 18 lines changed or added |