| 548 | } |
| 549 | |
| 550 | bool StringVal::Resize(FunctionContext* ctx, int new_len) noexcept { |
| 551 | if (new_len <= len) { |
| 552 | len = new_len; |
| 553 | return true; |
| 554 | } |
| 555 | |
| 556 | if (UNLIKELY(new_len > StringVal::MAX_LENGTH)) { |
| 557 | ctx->SetError("String length larger than allowed limit of 1 GB character data."); |
| 558 | len = 0; |
| 559 | is_null = true; |
| 560 | return false; |
| 561 | } |
| 562 | auto* new_ptr = ctx->impl()->AllocateForResults(new_len); |
| 563 | if (new_ptr != nullptr) { |
| 564 | memcpy(new_ptr, ptr, len); |
| 565 | ptr = new_ptr; |
| 566 | len = new_len; |
| 567 | return true; |
| 568 | } |
| 569 | return false; |
| 570 | } |
| 571 | |
| 572 | void StringVal::AllocateStringValWithLenCheck(FunctionContext* ctx, uint64_t str_len, |
| 573 | StringVal* res) { |
no test coverage detected