package org.springblade.sqlfly.type;

/**
 * oracle数据类型映射到Java
 * 
 * @author William
 * @date 2022年10月28日 上午11:31:25
 */
public class OracleType extends JavaType {

	public OracleType() {
	}

	@Override
	public String get(String sqlType) {
		return null;
	}

	@Override
	public String get(String sqlType, int size, int scale) {
		if (sqlType.equals("integer")) {
			return "Integer";
		} else if (sqlType.equals("long")) {
			return "Long";
		} else if (sqlType.equals("float") || sqlType.equals("float precision") || sqlType.equals("double")
				|| sqlType.equals("double precision")) {
			return "BigDecimal";
		} else if (sqlType.equals("number") || sqlType.equals("decimal") || sqlType.equals("numeric")
				|| sqlType.equals("real")) {
			return scale == 0 ? (size < 10 ? "Integer" : "Long") : "BigDecimal";
		} else if (sqlType.equals("varchar") || sqlType.equals("varchar2") || sqlType.equals("char")
				|| sqlType.equals("nvarchar") || sqlType.equals("nchar")) {
			return "String";
		} else if (sqlType.equals("datetime") || sqlType.equals("date") || sqlType.equals("timestamp")) {
			return "Date";
		}
		return "String";
	}

}
