Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite3: don't copy string in bind() #1158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charlievieth
Copy link
Contributor

Change bind() to pass sqlite3_bind_text() a pointer to the strings data instead of converting it to a []byte just so a pointer to &b[0] can be passed to unsafe.Pointer. Basically, this saves a needless allocation. and passing a pointer to that.

This is safe because sqlite3_bind_text does not keep a copy of the provided string.

@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.16%. Comparing base (18cdded) to head (6bd4c94).
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1158   +/-   ##
=======================================
  Coverage   47.16%   47.16%           
=======================================
  Files          12       12           
  Lines        1533     1533           
=======================================
  Hits          723      723           
  Misses        669      669           
  Partials      141      141           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Change bind() to pass sqlite3_bind_text() a pointer to the strings data
instead of converting it to a []byte just so a pointer to `&b[0]` can be
passed to unsafe.Pointer. Basically, this saves a needless allocation.
and passing a pointer to that.

This is safe because sqlite3_bind_text does not keep a copy of the
provided string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants