@@ -219,30 +219,33 @@ void UnlistFunctionScan::internalOpen(thread_db* tdbb) const
219
219
}
220
220
else
221
221
{
222
- const string& separatorStr = *impure->m_separatorStr ;
222
+ const std::string_view separatorView (impure->m_separatorStr ->data (),
223
+ impure->m_separatorStr ->length ());
223
224
string valueStr (MOV_make_string2 (tdbb, valueDesc, textType, true ));
224
- auto end = AbstractString::npos;
225
+ std::string_view valueView (valueStr.data (), valueStr.length ());
226
+ auto end = std::string_view::npos;
225
227
do
226
228
{
227
- auto size = end = valueStr .find (separatorStr );
228
- if (end == AbstractString ::npos)
229
+ auto size = end = valueView .find (separatorView );
230
+ if (end == std::string_view ::npos)
229
231
{
230
- if (valueStr. hasData ())
231
- size = valueStr. size ();
232
+ if (!valueView. empty ())
233
+ size = valueView. length ();
232
234
else
233
235
break ;
234
236
}
235
237
236
238
if (size > 0 )
237
239
{
238
240
dsc fromDesc;
239
- fromDesc.makeText (size, textType, (UCHAR*)(IPTR)(valueStr. c_str () ));
241
+ fromDesc.makeText (size, textType, (UCHAR*)(IPTR) valueView. data ( ));
240
242
assignParameter (tdbb, &fromDesc, toDesc, 0 , record);
241
243
impure->m_recordBuffer ->store (record);
242
244
}
243
245
244
- valueStr.erase (valueStr.begin (), valueStr.begin () + end + separatorStr.length ());
245
- } while (end != AbstractString::npos);
246
+ valueView.remove_prefix (size + separatorView.length ());
247
+
248
+ } while (end != std::string_view::npos);
246
249
}
247
250
}
248
251
@@ -278,15 +281,24 @@ bool UnlistFunctionScan::nextBuffer(thread_db* tdbb) const
278
281
impure->m_recordBuffer ->store (record);
279
282
};
280
283
281
- MoveBuffer buffer;
282
- const auto address = buffer.getBuffer (MAX_COLUMN_SIZE);
283
- const auto length = impure->m_blob ->BLB_get_data (tdbb, address, MAX_COLUMN_SIZE, false );
284
- if (length > 0 )
284
+ string bufferString;
285
+
286
+ if (impure->m_resultStr ->hasData ())
287
+ bufferString = *impure->m_resultStr ;
288
+
289
+ const auto resultLength = impure->m_resultStr ->length ();
290
+ bufferString.reserve (MAX_COLUMN_SIZE + resultLength);
291
+ const auto address = bufferString.begin () + resultLength;
292
+
293
+ const auto blobLength = impure->m_blob ->BLB_get_data (tdbb, reinterpret_cast <UCHAR*>(address),
294
+ MAX_COLUMN_SIZE, false );
295
+ if (blobLength)
285
296
{
286
297
const std::string_view separatorView (impure->m_separatorStr ->data (),
287
298
impure->m_separatorStr ->length ());
288
- std::string_view valueView (reinterpret_cast < char *>(address ), length );
299
+ std::string_view valueView (bufferString. data ( ), blobLength + resultLength );
289
300
auto end = std::string_view::npos;
301
+ impure->m_resultStr ->erase ();
290
302
do
291
303
{
292
304
auto size = end = valueView.find (separatorView);
0 commit comments