//CRM-13417 to avoid fatal error "Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys, 1089"
$schemaQuery="SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = '{$database}' AND
TABLE_NAME = '{$table}' AND COLUMN_NAME = '{$field}';";
$dao=CRM_Core_DAO::executeQuery($schemaQuery);
if($dao->fetch()){
// set the length to null for all the fields where prefix length is not supported. eg. int,tinyint,date,enum etc dataTypes.