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

1) Prepare the blobs mover to be ready for dtype_blob variables.

2) Fix the string routines to work with PSQL blobs.
This commit is contained in:
dimitr 2005-11-25 15:20:26 +00:00
parent 1b0c8b2226
commit 3f5bb7564d
2 changed files with 33 additions and 13 deletions

View File

@ -844,22 +844,14 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
**************************************/
SET_TDBB(tdbb);
if (field->nod_type != nod_field)
BUGCHECK(199); /* msg 199 expected field node */
if (from_desc->dsc_dtype != dtype_quad
&& from_desc->dsc_dtype != dtype_blob)
{
ERR_post(isc_convert_error, isc_arg_string, "BLOB", 0);
}
jrd_req* request = tdbb->tdbb_request;
bid* source = (bid*) from_desc->dsc_address;
bid* destination = (bid*) to_desc->dsc_address;
const USHORT id = (USHORT) (IPTR) field->nod_arg[e_fld_id];
record_param* rpb = &request->req_rpb[(IPTR)field->nod_arg[e_fld_stream]];
jrd_rel* relation = rpb->rpb_relation;
Record* record = rpb->rpb_record;
/* If nothing changed, do nothing. If it isn't broken,
don't fix it. */
@ -869,6 +861,26 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
return;
}
/* If the target node is not a field, just copy the blob id
and return. */
switch (field->nod_type) {
case nod_field:
break;
case nod_argument:
case nod_variable:
*destination = *source;
return;
default:
BUGCHECK(199); /* msg 199 expected field node */
}
jrd_req* request = tdbb->tdbb_request;
const USHORT id = (USHORT) (IPTR) field->nod_arg[e_fld_id];
record_param* rpb = &request->req_rpb[(IPTR)field->nod_arg[e_fld_stream]];
jrd_rel* relation = rpb->rpb_relation;
Record* record = rpb->rpb_record;
/* If either the source value is null or the blob id itself is null (all
zeros, then the blob is null. */

View File

@ -4268,7 +4268,9 @@ static bool sleuth(thread_db* tdbb, jrd_nod* node, const dsc* desc1, const dsc*
/* Choose interpretation for the operation */
USHORT ttype;
if (desc1->dsc_dtype == dtype_blob) {
if (desc1->dsc_dtype == dtype_blob ||
desc1->dsc_dtype == dtype_quad)
{
if (desc1->dsc_sub_type == isc_blob_text)
ttype = desc1->dsc_blob_ttype(); /* Load blob character set and collation */
else
@ -4302,7 +4304,9 @@ static bool sleuth(thread_db* tdbb, jrd_nod* node, const dsc* desc1, const dsc*
and never Multibyte (see note in EVL_mb_sleuth_check) */
bool ret_val;
MoveBuffer data_str;
if (desc1->dsc_dtype != dtype_blob) {
if (desc1->dsc_dtype != dtype_blob &&
desc1->dsc_dtype != dtype_quad)
{
/* Source is not a blob, do a simple search */
l1 = MOV_make_string2(desc1, ttype, &p1, data_str);
@ -4360,7 +4364,9 @@ static bool string_boolean(thread_db* tdbb, jrd_nod* node, dsc* desc1,
DEV_BLKCHK(node, type_nod);
if (desc1->dsc_dtype != dtype_blob) {
if (desc1->dsc_dtype != dtype_blob &&
desc1->dsc_dtype != dtype_quad)
{
/* Source is not a blob, do a simple search */
/* Get text type of data string */
@ -4733,7 +4739,8 @@ static dsc* string_length(thread_db* tdbb, jrd_nod* node, impure_value* impure)
ULONG length;
if (value->dsc_dtype == dtype_blob)
if (value->dsc_dtype == dtype_blob ||
value->dsc_dtype == dtype_quad)
{
blb* blob = BLB_open(tdbb, tdbb->tdbb_request->req_transaction,
reinterpret_cast<bid*>(value->dsc_address));
@ -4852,7 +4859,8 @@ static dsc* substring(thread_db* tdbb, impure_value* impure,
const ULONG length = (ULONG) length_arg;
ULONG ul;
if (value->dsc_dtype == dtype_blob)
if (value->dsc_dtype == dtype_blob ||
value->dsc_dtype == dtype_quad)
{
/* Source string is a blob, things get interesting. */