* @param string $columnName
* @param $length
*
- * @throws Exception
+ * @throws CRM_Core_Exception
*/
public static function alterFieldLength($customFieldID, $tableName, $columnName, $length) {
// first update the custom field tables
CRM_Core_DAO::executeQuery($sql);
}
else {
- CRM_Core_Error::fatal(ts('Could Not Find Custom Field Details for %1, %2, %3',
+ throw new CRM_Core_Exception(ts('Could Not Find Custom Field Details for %1, %2, %3',
[
1 => $tableName,
2 => $columnName,
public static function checkIfFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
$query = "SHOW COLUMNS FROM $tableName LIKE '%1'";
$dao = CRM_Core_DAO::executeQuery($query, [1 => [$columnName, 'Alphanumeric']], TRUE, NULL, FALSE, $i18nRewrite);
- $result = $dao->fetch() ? TRUE : FALSE;
- return $result;
+ return (bool) $dao->fetch();
}
/**
}
$query .= " CHARACTER SET = $newCharSet COLLATE = $tableCollation";
if ($param['Engine'] === 'InnoDB') {
- $query .= ' ROW_FORMAT = Dynamic';
+ $query .= ' ROW_FORMAT = Dynamic KEY_BLOCK_SIZE = 0';
}
// Disable i18n rewrite.
CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE);