Skip to content

Commit bcafa97

Browse files
committed
Store (and return via *_LENGTH functions) blob length longer than 4GB. This is only ODS-related change, more will follow later.
1 parent 5dee439 commit bcafa97

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
@@ -800,17 +800,16 @@ struct blh
800800
ULONG blh_max_sequence; // Number of data pages
801801
USHORT blh_max_segment; // Longest segment
802802
USHORT blh_flags; // flags, etc
803-
UCHAR blh_level; // Number of address levels, see blb_level in blb.h
804803
ULONG blh_count; // Total number of segments
805-
ULONG blh_length; // Total length of data
804+
FB_UINT64 blh_length; // Total length of data
806805
USHORT blh_sub_type; // Blob sub-type
807-
UCHAR blh_charset; // Blob charset (since ODS 11.1)
806+
UCHAR blh_charset; // Blob charset
807+
UCHAR blh_level; // Number of address levels, see blb_level in blb.h
808808
// Macro CHECK_BLOB_FIELD_ACCESS_FOR_SELECT is never defined, code under it was left for a case
809809
// we would like to have that check in a future.
810810
#ifdef CHECK_BLOB_FIELD_ACCESS_FOR_SELECT
811811
USHORT blh_fld_id; // Field ID
812812
#endif
813-
UCHAR blh_unused;
814813
ULONG blh_page[1]; // Page vector for blob pages
815814
};
816815

@@ -819,16 +818,15 @@ static_assert(offsetof(struct blh, blh_lead_page) == 0, "blh_lead_page offset mi
819818
static_assert(offsetof(struct blh, blh_max_sequence) == 4, "blh_max_sequence offset mismatch");
820819
static_assert(offsetof(struct blh, blh_max_segment) == 8, "blh_max_segment offset mismatch");
821820
static_assert(offsetof(struct blh, blh_flags) == 10, "blh_flags offset mismatch");
822-
static_assert(offsetof(struct blh, blh_level) == 12, "blh_level offset mismatch");
823-
static_assert(offsetof(struct blh, blh_count) == 16, "blh_count offset mismatch");
824-
static_assert(offsetof(struct blh, blh_length) == 20, "blh_length offset mismatch");
821+
static_assert(offsetof(struct blh, blh_count) == 12, "blh_count offset mismatch");
822+
static_assert(offsetof(struct blh, blh_length) == 16, "blh_length offset mismatch");
825823
static_assert(offsetof(struct blh, blh_sub_type) == 24, "blh_sub_type offset mismatch");
826824
static_assert(offsetof(struct blh, blh_charset) == 26, "blh_charset offset mismatch");
827-
static_assert(offsetof(struct blh, blh_unused) == 27, "blh_unused offset mismatch");
825+
static_assert(offsetof(struct blh, blh_level) == 27, "blh_level offset mismatch");
828826
static_assert(offsetof(struct blh, blh_page) == 28, "blh_page offset mismatch");
829827

830-
831828
#define BLH_SIZE static_cast<FB_SIZE_T>(offsetof(Ods::blh, blh_page[0]))
829+
832830
// rhd_flags, rhdf_flags and blh_flags
833831

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

0 commit comments

Comments
 (0)