@Test public void testMysqlNativeType() { try { for (MysqlType mysqlType : MysqlType.values()) { if (mysqlType.isValid()) { MysqlNativeType mnType = new MysqlNativeType(mysqlType); for (String name : mnType.getNames()) { assertTrue("Type " + name + " should be lower case", name.equals(name.toLowerCase(Locale.ENGLISH))); MysqlNativeType actualType = new MysqlNativeType(MysqlType.toMysqlType(name)); String msg = "Should find correct type for alias: " + name; if (mnType.getTypeName().equals(name)) { msg = "Should find correct type for actual type: " + name; } assertEquals(msg, mnType, actualType); } } } } catch (Exception e) { failWithStackTrace(e); } }
public MysqlNativeType(MysqlType mysqlType) { super(mysqlType.toString(), mysqlType.getMysqlFieldType().getByteValue(), mysqlType.getSqlType(), mysqlType.isJdbcType(), mysqlType.getAliases()); this.mysqlType = mysqlType; setNullability((short) DatabaseMetaData.typeNullable); setProperCaseSensitive(); setProperUnsignedAttribute(); if (mysqlType == MysqlType.UNKNOWN) { throw new PECodingException("Type name " + mysqlType + " is not a valid MySQL type"); } }
MysqlNativeType extends NativeType { public MysqlNativeType(MysqlType mysqlType) { super(mysqlType.toString(), mysqlType.getMysqlFieldType().getByteValue(), mysqlType.getSqlType(), mysqlType.isJdbcType(), mysqlType.getAliases()); this.mysqlType = mysqlType; setNullability((short) DatabaseMetaData.typeNullable); setProperCaseSensitive(); setProperUnsignedAttribute(); if (mysqlType == MysqlType.UNKNOWN) { throw new PECodingException("Type name " + mysqlType + " is not a valid MySQL type"); } } }
MysqlNativeType extends NativeType { public MysqlNativeType(MysqlType mysqlType) { super(mysqlType.toString(), mysqlType.getMysqlFieldType().getByteValue(), mysqlType.getSqlType(), mysqlType.isJdbcType(), mysqlType.getAliases()); this.mysqlType = mysqlType; setNullability((short) DatabaseMetaData.typeNullable); setProperCaseSensitive(); setProperUnsignedAttribute(); if (mysqlType == MysqlType.UNKNOWN) { throw new PECodingException("Type name " + mysqlType + " is not a valid MySQL type"); } } MysqlNativeType(MysqlType mysqlType); }
MysqlNativeType extends NativeType { public MysqlNativeType(MysqlType mysqlType) { super(mysqlType.toString(), mysqlType.getMysqlFieldType().getByteValue(), mysqlType.getSqlType(), mysqlType.isJdbcType(), mysqlType.getAliases()); this.mysqlType = mysqlType; setNullability((short) DatabaseMetaData.typeNullable); setProperCaseSensitive(); setProperUnsignedAttribute(); if (mysqlType == MysqlType.UNKNOWN) { throw new PECodingException("Type name " + mysqlType + " is not a valid MySQL type"); } } MysqlNativeType(MysqlType mysqlType); MysqlType getMysqlType(); byte getCharSet(); void setCharSet(byte charSet); @SuppressWarnings("hiding") MysqlNativeType withCharSet(byte charSet); short getFieldTypeFlags(); void setFieldTypeFlags(short fieldTypeFlags); @SuppressWarnings("hiding") MysqlNativeType withFieldTypeFlags(short fieldTypeFlags); @SuppressWarnings("hiding") MysqlNativeType withFieldTypeFlags(Integer fieldTypeFlags); @Override void setCaseSensitive(boolean caseSensitive); @Override void setUnsignedAttribute(boolean unsignedAttribute); @Override boolean asKeyRequiresPrefix(); @Override Object getZeroValue(); @Override boolean supportsDefaultValue(); @Override boolean isTimestampType(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int getDefaultColumnAttrFlags(); }
MysqlNativeType extends NativeType { public MysqlNativeType(MysqlType mysqlType) { super(mysqlType.toString(), mysqlType.getMysqlFieldType().getByteValue(), mysqlType.getSqlType(), mysqlType.isJdbcType(), mysqlType.getAliases()); this.mysqlType = mysqlType; setNullability((short) DatabaseMetaData.typeNullable); setProperCaseSensitive(); setProperUnsignedAttribute(); if (mysqlType == MysqlType.UNKNOWN) { throw new PECodingException("Type name " + mysqlType + " is not a valid MySQL type"); } } MysqlNativeType(MysqlType mysqlType); MysqlType getMysqlType(); byte getCharSet(); void setCharSet(byte charSet); @SuppressWarnings("hiding") MysqlNativeType withCharSet(byte charSet); short getFieldTypeFlags(); void setFieldTypeFlags(short fieldTypeFlags); @SuppressWarnings("hiding") MysqlNativeType withFieldTypeFlags(short fieldTypeFlags); @SuppressWarnings("hiding") MysqlNativeType withFieldTypeFlags(Integer fieldTypeFlags); @Override void setCaseSensitive(boolean caseSensitive); @Override void setUnsignedAttribute(boolean unsignedAttribute); @Override boolean asKeyRequiresPrefix(); @Override Object getZeroValue(); @Override boolean supportsDefaultValue(); @Override boolean isTimestampType(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int getDefaultColumnAttrFlags(); static final String MODIFIER_UNSIGNED; static final String MODIFIER_SIGNED; static final String MODIFIER_ZEROFILL; }