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.

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 Report

Patch coverage: 100.00% and project coverage change: -0.14 ⚠️

Comparison is base (edc3bb6) 46.72% compared to head (e4ab09f) 46.59%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1158      +/-   ##
==========================================
- Coverage   46.72%   46.59%   -0.14%     
==========================================
  Files          12       12              
  Lines        1526     1526              
==========================================
- Hits          713      711       -2     
- Misses        671      672       +1     
- Partials      142      143       +1     
Impacted Files Coverage Δ
sqlite3.go 52.64% <100.00%> (-0.23%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

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.

None yet

2 participants