chaisql / chai

Modern embedded SQL database
MIT License
1.56k stars 95 forks source link

fix: deep copy strings during scan #499

Closed asdine closed 1 year ago

asdine commented 1 year ago

When decoding a document from the disk, fields of type TEXT are not copied on purpose to avoid doing unnecessary copies. However, when the data reaches the upper layers, usually when it's about to get scanned (i.e. document.Scan, document.StructScan), strings must always get deep cloned before being returned to the user.

Fixes #497

codecov[bot] commented 1 year ago

Codecov Report

Merging #499 (a558b23) into main (5397cbc) will increase coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head a558b23 differs from pull request most recent head 9d1940d. Consider uploading reports for the commit 9d1940d to get more accurate results

@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   78.81%   78.81%           
=======================================
  Files         129      129           
  Lines       10947    10948    +1     
=======================================
+ Hits         8628     8629    +1     
  Misses       1599     1599           
  Partials      720      720           
Impacted Files Coverage Δ
document/scan.go 59.62% <100.00%> (+0.15%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more