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

MySQL BLOB appears to be unsupported #985

Closed
Krzmbrzl opened this issue Sep 13, 2022 · 6 comments · Fixed by #992
Closed

MySQL BLOB appears to be unsupported #985

Krzmbrzl opened this issue Sep 13, 2022 · 6 comments · Fixed by #992
Labels

Comments

@Krzmbrzl
Copy link
Contributor

I had a look at https://github.com/SOCI/soci/blob/master/src/backends/mysql/blob.cpp and I noticed that the implementation is essentially just a wrapper around throwing an exception stating that BLOB was not supported.

I am wondering why this is the case? At first I thought that this might be due to MySQL not supporting BLOBs, but this doesn't seem to be the case: https://dev.mysql.com/doc/refman/8.0/en/blob.html

Is this just something that nobody has implemented yet?

@vadz
Copy link
Member

vadz commented Sep 13, 2022

Yes, BLOB support is not implemented in all backends. Contributing it for MySQL would be welcome, of course.

@vadz vadz added the MySQL label Sep 13, 2022
@Krzmbrzl
Copy link
Contributor Author

Alright - Given that I'll need this (unless I am willing to rethink my DB design), chances are that I might give this a shot.

I am wondering though: Why do we even have backend-specific BLOB implementations? My naive assumption was that a BLOB is essentially a wrapper around a std::vector< char > that is used to hold the buffer. But looking at the implementations, this does not seem to be what is done?
Do you happen to know why?

@vadz
Copy link
Member

vadz commented Sep 13, 2022

If you look at the existing implementation for e.g. Oracle you can see that using blobs requires using database-specific types. Using vector<byte> or whatever would require copying huge amounts of data, which would rather defeat the purpose of using BLOBs in the first place.

@Krzmbrzl
Copy link
Contributor Author

Okay, but if I look at e.g. the implementation for sqlite3, this seems like it is essentially a custom implementation of a std::vector (more or less). Thus, I am wondering why there is no "generic" blob implementation that uses an internal buffer to which the data is written and read from and then provide backend-specific implementations where appropriate 🤔

@Krzmbrzl
Copy link
Contributor Author

After having looked at different implementations, it seems like sqlite3 is essentially the exception here, so that explains why it probably doesn't make a lot of sense to have such a standard implementation...

@vadz
Copy link
Member

vadz commented Sep 14, 2022

After having looked at different implementations, it seems like sqlite3 is essentially the exception here

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants