I
I
Ivan Melnikov2018-04-11 13:57:23
MySQL
Ivan Melnikov, 2018-04-11 13:57:23

How is the BLOB type arranged in MySQL 5.7? In what format is the data stored in a BLOB field?

The documentation says that this type is intended for storing binary data, that is, as I understand it, this is an array filled with 0 and 1.
But then it is written that BLOB is TEXT, but only with the difference that in BLOB sorting and comparison data are case-sensitive. But TEXT is a type for storing data in character form. Something I'm completely confused.
Explain, please, in what form is the data stored in a BLOB? Can I put a picture into a BLOB field directly (indicating the location of the image file on the hard disk) or do I first need to encode the picture into a text format (for example, BASE64) and only then write this string to the BLOB field?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman MySQL, 2018-04-11
@immelnikoff

blob is a sequence of bytes, and text is a sequence of characters, which, depending on the encoding, can take more than one byte, and even have their own sorting rules depending on the collation further ...
any file can be interpreted in different ways. including as a sequence of bytes. therefore, no additional steps are required to store it in a field of type "sequence of bytes"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question