23
23
*/
24
24
25
25
#include " firebird.h"
26
+ #include < algorithm>
27
+ #include < iterator>
26
28
#include < string.h>
27
29
#include < stdio.h>
28
30
@@ -60,6 +62,7 @@ static const FPTR_BFILTER_CALLBACK filters[] =
60
62
filter_trans,
61
63
filter_trans, // should be filter_external_file
62
64
filter_debug_info
65
+ // Add new entries to isInternalFilter
63
66
};
64
67
65
68
@@ -69,6 +72,26 @@ static void open_blob(thread_db*, jrd_tra*, BlobControl**, bid*,
69
72
USHORT, BlobFilter*);
70
73
71
74
75
+ // Check if this is an internal filter.
76
+ static bool isInternalFilter (BlobControl* control)
77
+ {
78
+ const auto routine = control->ctl_source ;
79
+ const bool isInternal =
80
+ routine == filter_text ||
81
+ routine == filter_transliterate_text ||
82
+ routine == filter_blr ||
83
+ routine == filter_acl ||
84
+ routine == filter_runtime ||
85
+ routine == filter_format ||
86
+ routine == filter_trans ||
87
+ routine == filter_debug_info;
88
+
89
+ fb_assert (isInternal == (std::find (std::begin (filters), std::end (filters), routine) != std::end (filters)));
90
+
91
+ return isInternal;
92
+ }
93
+
94
+
72
95
void BLF_close_blob (thread_db* tdbb, BlobControl** filter_handle)
73
96
{
74
97
/* *************************************
@@ -170,9 +193,14 @@ ISC_STATUS BLF_get_segment(thread_db* tdbb,
170
193
171
194
ISC_STATUS status;
172
195
173
- START_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
174
- status = (*control->ctl_source ) (isc_blob_filter_get_segment, control);
175
- END_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
196
+ if (isInternalFilter (control))
197
+ status = (*control->ctl_source )(isc_blob_filter_get_segment, control);
198
+ else
199
+ {
200
+ START_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
201
+ status = (*control->ctl_source )(isc_blob_filter_get_segment, control);
202
+ END_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
203
+ }
176
204
177
205
if (!status || status == isc_segment)
178
206
*length = control->ctl_segment_length ;
@@ -284,9 +312,14 @@ void BLF_put_segment(thread_db* tdbb,
284
312
285
313
ISC_STATUS status;
286
314
287
- START_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
288
- status = (*control->ctl_source ) (isc_blob_filter_put_segment, control);
289
- END_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
315
+ if (isInternalFilter (control))
316
+ status = (*control->ctl_source )(isc_blob_filter_put_segment, control);
317
+ else
318
+ {
319
+ START_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
320
+ status = (*control->ctl_source )(isc_blob_filter_put_segment, control);
321
+ END_CHECK_FOR_EXCEPTIONS (control->ctl_exception_message .c_str ())
322
+ }
290
323
291
324
if (status)
292
325
{
0 commit comments