#1622 closed defect (fixed)
BLOB support in MySQL driver not working
Reported by: | Kosta | Owned by: | Mateusz Łoskot |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.2 |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | MySQL BLOB |
Cc: | warmerdam, hobu |
Description
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:
- Before doing an SQL command to delete a feature, InterruptLongTransaction() has to be called (ogrmysqltablelayer.cpp: 634), otherwise I get an MySQL error Commands out of sync.
Attachments (2)
Change History (6)
by , 17 years ago
Attachment: | mysql_blob.patch added |
---|
comment:1 by , 17 years ago
Cc: | added |
---|---|
Milestone: | → 1.4.2 |
Owner: | changed from | to
Severity: | major → normal |
Mateusz,
Please verify, incorporate and test.
I don't know if there is a mysql test script currently. If not, I'd suggest you add a long term todo item to create one rather than do it immediately. I've added Howard to the cc list in case he would like to take this ticket or has some opinions on the change.
by , 17 years ago
Attachment: | mysql_blob_simple_test.zip added |
---|
This is simple test of read and write BLOB data to MySQL database. This test uses WKB stream read from multipoint.wkb file, as a sample binary data.
comment:2 by , 17 years ago
Status: | new → assigned |
---|
comment:4 by , 17 years ago
Also applied to the stable branch 1.4, so it will be included in new coming 1.4.2 (r11523).
bug fixes for BLOB support in MySQL driver