The BLOB support in the MySQL driver is completely messed up:
- During field type determination MySQL FIELD_TYPE_BLOB is assigned as OFTString (ogrmysqlresultlayer.cpp: 163).
- The MySQL types FIELD_TYPE_TINY_BLOB, FIELD_TYPE_MEDIUM_BLOB, and FIELD_TYPE_LONG_BLOB are not handled (ogrmysqlresultlayer.cpp: 163).
- In CreateField?() the case of OFTBinary is not handled (ogrmysqltablelayer.cpp: 887).
- In CreateFeature?() (ogrmysqltablelayer.cpp: 735) the call to GetFieldAsString?() will truncate binary data to something about 40 bytes (~80 hex digits => see TEMP_BUFFER_SIZE in ogrfeature.cpp: 949).
- Binary data must/should be supplied to MySQL via "x'<hex digits>'".
A patch fixing the above issues is attached...
The patch also fixes another issue: