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

Length of the blob received by "select" #546

Closed
YukunXia opened this issue Nov 27, 2023 · 2 comments
Closed

Length of the blob received by "select" #546

YukunXia opened this issue Nov 27, 2023 · 2 comments

Comments

@YukunXia
Copy link

YukunXia commented Nov 27, 2023

Hi Roland,

First of all, thank you so much for writing and maintaining such an awesome library!

I have a question about the mechanism of receiving objects with dynamic length. Specifically, let's say, the blobs. Sending a std::vector<uint8> to a key foo is straightforward. But as I tried to read the same content back via select, there were two seemingly equivalent ways, either blob with len, or simply value(). In the test with sqlite3 and pgsql, blob with len is used, rather than value(), Is there any particular reason why this version is preferred?

Best,
Yukun

@rbock
Copy link
Owner

rbock commented Nov 27, 2023

Hi Yukun,

Thanks for the praise :-)

And thanks for the question, of course. Both variants work just fine. value() returns a copy of the value, though.

Background:
In the early days, I decided to return a default-constructed value if you asked for the value of a NULL result. From today's perspective, that was probably a mistake. Every now and then I am thinking of changing that, but it is hard to do so without breaking everybody.

Cheers,
Roland

@YukunXia
Copy link
Author

Thank you for the timely reply! Now I understand it much better :)

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

No branches or pull requests

2 participants