filters.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | filters.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#include "../jrd/blob_filter.h" | #include "../jrd/blob_filter.h" | |||
#include "../jrd/intl.h" | #include "../jrd/intl.h" | |||
#include "../jrd/intl_classes.h" | #include "../jrd/intl_classes.h" | |||
#include "../intl/charsets.h" | #include "../intl/charsets.h" | |||
#include "../common/gdsassert.h" | #include "../common/gdsassert.h" | |||
#include "../jrd/err_proto.h" | #include "../jrd/err_proto.h" | |||
#include "../jrd/filte_proto.h" | #include "../jrd/filte_proto.h" | |||
#include "../yvalve/gds_proto.h" | #include "../yvalve/gds_proto.h" | |||
#include "../jrd/intl_proto.h" | #include "../jrd/intl_proto.h" | |||
#include "../jrd/DebugInterface.h" | #include "../jrd/DebugInterface.h" | |||
#include "../jrd/mov_proto.h" | ||||
using namespace Firebird; | using namespace Firebird; | |||
using namespace Jrd; | using namespace Jrd; | |||
static ISC_STATUS caller(USHORT, BlobControl*, USHORT, UCHAR*, USHORT*); | static ISC_STATUS caller(USHORT, BlobControl*, USHORT, UCHAR*, USHORT*); | |||
static void dump_blr(void*, SSHORT, const char*); | static void dump_blr(void*, SSHORT, const char*); | |||
static ISC_STATUS string_filter(USHORT, BlobControl*); | static ISC_STATUS string_filter(USHORT, BlobControl*); | |||
static void string_put(BlobControl*, const char*); | static void string_put(BlobControl*, const char*); | |||
/* Note: This table is used to indicate which bytes could represent | /* Note: This table is used to indicate which bytes could represent | |||
skipping to change at line 296 | skipping to change at line 297 | |||
/************************************** | /************************************** | |||
* | * | |||
* f i l t e r _ f o r m a t | * f i l t e r _ f o r m a t | |||
* | * | |||
************************************** | ************************************** | |||
* | * | |||
* Functional description | * Functional description | |||
* Get next segment from a record format blob. | * Get next segment from a record format blob. | |||
* | * | |||
**************************************/ | **************************************/ | |||
// Unless this is a get segment call, just return success | ||||
if (action != isc_blob_filter_get_segment) | if (action != isc_blob_filter_open) | |||
return FB_SUCCESS; | return string_filter(action, control); | |||
// 1 2 3 4 5 | ||||
6 | ||||
// 12345678901234567890123456789012345678901234567890123 | ||||
456789012345678 | ||||
const char* head1 = " id offset type length sub_type flags"; / | ||||
/ descriptors | ||||
const char* sep1 = "--- ------ -------------- ------ -------- -----"; | ||||
const char* head2 = " id type length default value"; | ||||
// defaults | ||||
const char* sep2 = "--- -------------- ------ -------------------------- | ||||
---------"; | ||||
// Try to get next descriptor | const char* fmt1 = "%3d %6d %2d %-11s %6d %8d 0x%02x"; // descri | |||
Ods::Descriptor desc; | ptors | |||
memset(&desc, 0, sizeof(desc)); | const char* fmt2 = "%3d %2d %-11s %6d %s"; | |||
// defaults | ||||
USHORT length; | ||||
const ISC_STATUS status = caller(isc_blob_filter_get_segment, control, | const char* name1 = "Fields:"; | |||
sizeof(d | const char* name2 = "Defaults:"; | |||
esc), reinterpret_cast<UCHAR*>(&desc), &length); | ||||
string str; | ||||
USHORT length; | ||||
ISC_STATUS status; | ||||
// read number of fields descriptors | ||||
USHORT num; | ||||
status = caller(isc_blob_filter_get_segment, control, | ||||
sizeof(USHORT), reinterpret_cast<UCHAR*>(&num), &length); | ||||
if (status != FB_SUCCESS && status != isc_segment) | if (status != FB_SUCCESS && status != isc_segment) | |||
return status; | return status; | |||
char buffer[256]; | if (num) | |||
{ | ||||
string_put(control, name1); | ||||
string_put(control, head1); | ||||
string_put(control, sep1); | ||||
} | ||||
sprintf(buffer, "%5d: type=%d (%s) length=%d sub_type=%d flags=0x%X", | // read fields descriptors | |||
desc.dsc_offset, | for (int id = 0; num; --num, id++) | |||
desc.dsc_dtype, | { | |||
desc.dsc_dtype >= DTYPE_TYPE_MAX ? "unknown" : dtypes[desc.dsc_dt | Ods::Descriptor desc; | |||
ype], | memset(&desc, 0, sizeof(desc)); | |||
desc.dsc_length, | ||||
desc.dsc_sub_type, | ||||
desc.dsc_flags); | ||||
length = static_cast<USHORT>(strlen(buffer)); | ||||
if (length > control->ctl_buffer_length) | ||||
length = control->ctl_buffer_length; | ||||
control->ctl_segment_length = length; | status = caller(isc_blob_filter_get_segment, control, | |||
memcpy(control->ctl_buffer, buffer, length); | sizeof(desc), reinterpret_cast<UCHAR*>(&desc), &length); | |||
if (status != FB_SUCCESS && status != isc_segment) | ||||
return status; | ||||
str.printf(fmt1, | ||||
id, | ||||
desc.dsc_offset, | ||||
desc.dsc_dtype, | ||||
desc.dsc_dtype >= DTYPE_TYPE_MAX ? "unknown" : dtypes[des | ||||
c.dsc_dtype], | ||||
desc.dsc_length, | ||||
desc.dsc_sub_type, | ||||
desc.dsc_flags); | ||||
string_put(control, str.c_str()); | ||||
} | ||||
// read number of default values | ||||
num = 0; | ||||
status = caller(isc_blob_filter_get_segment, control, | ||||
sizeof(USHORT), reinterpret_cast<UCHAR*>(&num), &length); | ||||
if (status != FB_SUCCESS && status != isc_segment) | ||||
return status; | ||||
if (num) | ||||
{ | ||||
string_put(control, ""); | ||||
string_put(control, name2); | ||||
string_put(control, head2); | ||||
string_put(control, sep2); | ||||
} | ||||
// defaults descriptors and values | ||||
for (; num; --num) | ||||
{ | ||||
USHORT fieldId; | ||||
status = caller(isc_blob_filter_get_segment, control, | ||||
sizeof(fieldId), reinterpret_cast<UCHAR*>(&fieldId), &len | ||||
gth); | ||||
if (status != FB_SUCCESS && status != isc_segment) | ||||
return status; | ||||
Ods::Descriptor desc; | ||||
memset(&desc, 0, sizeof(desc)); | ||||
status = caller(isc_blob_filter_get_segment, control, | ||||
sizeof(desc), reinterpret_cast<UCHAR*>(&desc), &length); | ||||
if (status != FB_SUCCESS && status != isc_segment) | ||||
return status; | ||||
UCharBuffer buff; | ||||
UCHAR* pBuff = buff.getBuffer(desc.dsc_length); | ||||
status = caller(isc_blob_filter_get_segment, control, | ||||
desc.dsc_length, pBuff, &length); | ||||
if (status != FB_SUCCESS && status != isc_segment) | ||||
return status; | ||||
dsc d; | ||||
d = desc; | ||||
d.dsc_address = pBuff; | ||||
DescPrinter val(JRD_get_thread_data(), &d, 32); | ||||
str.printf(fmt2, | ||||
fieldId, | ||||
desc.dsc_dtype, | ||||
desc.dsc_dtype >= DTYPE_TYPE_MAX ? "unknown" : dtypes[des | ||||
c.dsc_dtype], | ||||
desc.dsc_length, | ||||
val.get().c_str()); | ||||
string_put(control, str.c_str()); | ||||
} | ||||
control->ctl_data[1] = control->ctl_data[0]; | ||||
return FB_SUCCESS; | return FB_SUCCESS; | |||
} | } | |||
ISC_STATUS filter_runtime(USHORT action, BlobControl* control) | ISC_STATUS filter_runtime(USHORT action, BlobControl* control) | |||
{ | { | |||
/************************************** | /************************************** | |||
* | * | |||
* f i l t e r _ r u n t i m e | * f i l t e r _ r u n t i m e | |||
* | * | |||
************************************** | ************************************** | |||
End of changes. 8 change blocks. | ||||
26 lines changed or deleted | 120 lines changed or added |