8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 23:23:04 +01:00

BLB_put_segment can't write more than 64K in one shot.

Create BLB_put_data and use it. Thanks to Claudio.
This commit is contained in:
asfernandes 2006-05-13 18:35:13 +00:00
parent 37f3b19c4e
commit 22640e1189
3 changed files with 32 additions and 2 deletions

View File

@ -1229,6 +1229,35 @@ blb* BLB_open2(thread_db* tdbb,
}
void BLB_put_data(thread_db* tdbb, blb* blob, const UCHAR* buffer, SLONG length)
{
/**************************************
*
* B L B _ p u t _ d a t a
*
**************************************
*
* Functional description
* Write data to a blob.
* Don't worry about segment boundaries.
*
**************************************/
SET_TDBB(tdbb);
const BLOB_PTR* p = buffer;
while (length > 0)
{
// ASF: the comment below was copied from BLB_get_data
// I have no idea why this limit is 32768 instead of 32767
// 1994-August-12 David Schnepper
USHORT n = (USHORT) MIN(length, (SLONG) 32768);
BLB_put_segment(tdbb, blob, p, n);
p += n;
length -= n;
}
}
void BLB_put_segment(thread_db* tdbb, blb* blob, const UCHAR* seg, USHORT segment_length)
{
/**************************************

View File

@ -46,6 +46,7 @@ SLONG BLB_lseek(Jrd::blb*, USHORT, SLONG);
void BLB_move(Jrd::thread_db*, dsc*, dsc*, Jrd::jrd_nod*);
Jrd::blb* BLB_open(Jrd::thread_db*, Jrd::jrd_tra*, const Jrd::bid*);
Jrd::blb* BLB_open2(Jrd::thread_db*, Jrd::jrd_tra*, const Jrd::bid*, USHORT, const UCHAR*);
void BLB_put_data(Jrd::thread_db*, Jrd::blb*, const UCHAR*, SLONG);
void BLB_put_segment(Jrd::thread_db*, Jrd::blb*, const UCHAR*, USHORT);
void BLB_put_slice(Jrd::thread_db*, Jrd::jrd_tra*, Jrd::bid*, const UCHAR*, USHORT,
const SLONG*, SLONG, UCHAR*);

View File

@ -3645,7 +3645,7 @@ static dsc* low_up_case(thread_db* tdbb, const dsc* value, impure_value* impure,
if (len)
{
len = (textType->*tt_str_to_case)(len, buffer.begin(), len, buffer.begin());
BLB_put_segment(tdbb, newBlob, buffer.begin(), len);
BLB_put_data(tdbb, newBlob, buffer.begin(), len);
}
}
@ -5077,7 +5077,7 @@ static dsc* trim(thread_db* tdbb, jrd_nod* node, impure_value* impure)
blb* newBlob = BLB_create(tdbb, tdbb->tdbb_request->req_transaction,
&impure->vlu_misc.vlu_bid);
BLB_put_segment(tdbb, newBlob, valueCanonical.begin(), len);
BLB_put_data(tdbb, newBlob, valueCanonical.begin(), len);
BLB_close(tdbb, newBlob);
}