Skip to content

Commit 0158776

Browse files
authored
Store (and return via *_LENGTH functions) blob length longer than 4GB. This is only ODS-related change, more will follow later. (#8428)
1 parent 6e92bb0 commit 0158776

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/dsql/ExprNodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11079,7 +11079,7 @@ dsc* StrLenNode::execute(thread_db* tdbb, Request* request) const
1107911079
switch (blrSubOp)
1108011080
{
1108111081
case blr_strlen_bit:
11082-
length = (FB_UINT64) blob->blb_length * 8;
11082+
length = blob->blb_length * 8;
1108311083
break;
1108411084

1108511085
case blr_strlen_octet:

src/jrd/blb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class blb : public pool_alloc<type_blb>
7676
jrd_rel* blb_relation; // Relation, if known
7777
JBlob* blb_interface;
7878

79-
ULONG blb_length; // Total length of data sans segments
79+
FB_UINT64 blb_length; // Blob's total length (in bytes)
8080
USHORT blb_flags; // Interesting stuff (see below)
8181

8282
SSHORT blb_sub_type; // Blob's declared sub-type

src/jrd/ods.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -833,17 +833,16 @@ struct blh
833833
ULONG blh_max_sequence; // Number of data pages
834834
USHORT blh_max_segment; // Longest segment
835835
USHORT blh_flags; // flags, etc
836-
UCHAR blh_level; // Number of address levels, see blb_level in blb.h
837836
ULONG blh_count; // Total number of segments
838-
ULONG blh_length; // Total length of data
837+
FB_UINT64 blh_length; // Total length of data
839838
USHORT blh_sub_type; // Blob sub-type
840-
UCHAR blh_charset; // Blob charset (since ODS 11.1)
839+
UCHAR blh_charset; // Blob charset
840+
UCHAR blh_level; // Number of address levels, see blb_level in blb.h
841841
// Macro CHECK_BLOB_FIELD_ACCESS_FOR_SELECT is never defined, code under it was left for a case
842842
// we would like to have that check in a future.
843843
#ifdef CHECK_BLOB_FIELD_ACCESS_FOR_SELECT
844844
USHORT blh_fld_id; // Field ID
845845
#endif
846-
UCHAR blh_unused;
847846
ULONG blh_page[1]; // Page vector for blob pages
848847
};
849848

@@ -852,16 +851,15 @@ static_assert(offsetof(struct blh, blh_lead_page) == 0, "blh_lead_page offset mi
852851
static_assert(offsetof(struct blh, blh_max_sequence) == 4, "blh_max_sequence offset mismatch");
853852
static_assert(offsetof(struct blh, blh_max_segment) == 8, "blh_max_segment offset mismatch");
854853
static_assert(offsetof(struct blh, blh_flags) == 10, "blh_flags offset mismatch");
855-
static_assert(offsetof(struct blh, blh_level) == 12, "blh_level offset mismatch");
856-
static_assert(offsetof(struct blh, blh_count) == 16, "blh_count offset mismatch");
857-
static_assert(offsetof(struct blh, blh_length) == 20, "blh_length offset mismatch");
854+
static_assert(offsetof(struct blh, blh_count) == 12, "blh_count offset mismatch");
855+
static_assert(offsetof(struct blh, blh_length) == 16, "blh_length offset mismatch");
858856
static_assert(offsetof(struct blh, blh_sub_type) == 24, "blh_sub_type offset mismatch");
859857
static_assert(offsetof(struct blh, blh_charset) == 26, "blh_charset offset mismatch");
860-
static_assert(offsetof(struct blh, blh_unused) == 27, "blh_unused offset mismatch");
858+
static_assert(offsetof(struct blh, blh_level) == 27, "blh_level offset mismatch");
861859
static_assert(offsetof(struct blh, blh_page) == 28, "blh_page offset mismatch");
862860

863-
864861
#define BLH_SIZE static_cast<FB_SIZE_T>(offsetof(Ods::blh, blh_page[0]))
862+
865863
// rhd_flags, rhdf_flags and blh_flags
866864

867865
// record_param flags in req.h must be an exact replica of ODS record header flags

0 commit comments

Comments
 (0)