def normalize_type(self, field_name, field_type):
if field_name.endswith("_ref"):
return TYPE_REFERENCE
elif field_type.startswith("tinyint(1)") or field_type.startswith("bit"):
return TYPE_BOOL
elif field_type.startswith("varchar"):
return TYPE_STR
elif field_type.startswith("int") or field_type.startswith("tinyint"):
return TYPE_INT
else:
return field_type
------------------
def mysql_to_rocket(self, field_type, mysql_value):
.....
.....
.....
elif field_type == TYPE_BLOB:
rocket_value = base64.b64encode(mysql_value)
elif field_type == TYPE_BOOL and ord(mysql_value) < 2: # field is of type BIT
rocket_value = str(ord(mysql_value)).encode('utf-8')
else:
rocket_value = (u'%s' % mysql_value).replace('|', '|').encode('utf-8')