@@ -279,15 +279,7 @@ class query_json_scanner {
279279 bool visit_value (Str key, R* value, threadinfo& ti) {
280280 if (row_is_marker (value))
281281 return true ;
282- // NB the `key` is not stable! We must save space for it.
283- while (q_.scankeypos_ + key.length () > q_.scankey_ .length ()) {
284- q_.scankey_ = lcdf::String::make_uninitialized (q_.scankey_ .length () ? q_.scankey_ .length () * 2 : 1024 );
285- q_.scankeypos_ = 0 ;
286- }
287- memcpy (const_cast <char *>(q_.scankey_ .data () + q_.scankeypos_ ),
288- key.data (), key.length ());
289- request_.push_back (q_.scankey_ .substr (q_.scankeypos_ , key.length ()));
290- q_.scankeypos_ += key.length ();
282+ request_.push_back (*(new lcdf::String (key)));
291283 request_.push_back (lcdf::Json ());
292284 q_.emit_fields1 (value, request_.back (), ti);
293285 --nleft_;
@@ -337,15 +329,7 @@ void query<R>::run_iscan(T& table, Json& request, threadinfo& ti) {
337329 R* value = it->second ;
338330 if (row_is_marker (value))
339331 break ;
340- // NB the `key` is not stable! We must save space for it.
341- while (scankeypos_ + key.length () > scankey_.length ()) {
342- scankey_ = lcdf::String::make_uninitialized (scankey_.length () ? scankey_.length () * 2 : 1024 );
343- scankeypos_ = 0 ;
344- }
345- memcpy (const_cast <char *>(scankey_.data () + scankeypos_),
346- key.data (), key.length ());
347- request.push_back (scankey_.substr (scankeypos_, key.length ()));
348- scankeypos_ += key.length ();
332+ request.push_back (*(new lcdf::String (key)));
349333 request.push_back (lcdf::Json ());
350334 emit_fields1 (value, request.back (), ti);
351335 it++;
0 commit comments