001package io.ebean.config.dbplatform.mysql; 002 003import io.ebean.config.dbplatform.DbPlatformType; 004 005/** 006 * Support for text, mediumtext or longtext selection based on the deployment 007 * length. 008 * <p> 009 * If no deployment length is defined longtext is used. 010 * </p> 011 */ 012public class MySqlClob extends DbPlatformType { 013 014 private static final int POWER_2_16 = 65536; 015 private static final int POWER_2_24 = 16777216; 016 017 public MySqlClob() { 018 super("text"); 019 } 020 021 @Override 022 public String renderType(int deployLength, int deployScale) { 023 024 if (deployLength >= POWER_2_24) { 025 return "longtext"; 026 } 027 if (deployLength >= POWER_2_16) { 028 return "mediumtext"; 029 } 030 if (deployLength < 1) { 031 // length not explicitly defined 032 return "longtext"; 033 } 034 return "text"; 035 } 036 037}