datajoint / mym

MySQL API for MATLAB with support for BLOB objects
Other
8 stars 17 forks source link

some string fields in the information schema are returned as uint8 vertical arrays instead of character strings #2

Closed dimitri-yatsenko closed 11 years ago

dimitri-yatsenko commented 11 years ago

Example

>> s=mym('SELECT column_type from information_schema.columns')
>> s.column_type{1}

ans =

  118
   97
  114
   99
  104
   97
  114
   40
   51
   50
   41

>> fprintf('%s\n',s.column_type{1})
varchar(32)
aecker commented 11 years ago

It's probably because column_type is of type LONGTEXT. Probably mym doesn't properly interpret that as a string.

dimitri-yatsenko commented 11 years ago

No, this seems to be specific to the information schema. LONGTEXT attributes in user-defined tables work fine.

ahoenselaar commented 11 years ago

Dimitri, are you sure about this? Based on the source code, mym will treat a LONGTEXT column just like a BLOB column and then try to deserialize it as MATLAB data. Unless the first characters in the blob happen to be "mYm" or "ZL123", mym will then decide that it cannot deserialize the data and return it as a uint8 array.

Correcting this behavior should be possible by inspecting the charsetnr field in the MYSQL_FIELD structure. This field is set to 63 for binary data.