@Test public void testLoad() { try { MysqlNativeTypeCatalog mntCatalog = new MysqlNativeTypeCatalog(); mntCatalog.load(); for (MysqlType mysqlType : MysqlType.values()) { if (mysqlType.isValid()) { MysqlNativeType mysqlNativeType = (MysqlNativeType) mntCatalog.findType(mysqlType.toString(), true); MysqlNativeType mnType = new MysqlNativeType(mysqlType); assertTrue("Type " + mysqlNativeType + " should be the same as the catalog type", mysqlNativeType.getMysqlType().equals(mnType.getMysqlType())); } } } catch (Exception e) { failWithStackTrace(e); } }
@Override public MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except) throws PEException { MyFieldDataKind dataKind = null; if (mft.isBinaryFlagDependent()) { final boolean keepText = (flags & MysqlNativeConstants.FLDPKT_FLAG_BINARY) == 0; if (keepText) { dataKind = MyFieldDataKind.TEXT; } else { dataKind = MyFieldDataKind.BINARY; } } else { dataKind = MyFieldDataKind.ANY; } final NativeType type = findSmallestSuitableType(mft.getByteValue(), dataKind, maxLength, (maxLength == 0) ? Collections.<NativeType> singleton(PARAMETER) : Collections.EMPTY_SET); if (type == null) { throw new PECodingException("Cannot find native type for field type " + mft + " with flags " + flags + " and length " + maxLength); } return (MysqlNativeType) type; }
MysqlNativeTypeCatalog extends NativeTypeCatalog { @Override public MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except) throws PEException { MyFieldDataKind dataKind = null; if (mft.isBinaryFlagDependent()) { final boolean keepText = (flags & MysqlNativeConstants.FLDPKT_FLAG_BINARY) == 0; if (keepText) { dataKind = MyFieldDataKind.TEXT; } else { dataKind = MyFieldDataKind.BINARY; } } else { dataKind = MyFieldDataKind.ANY; } final NativeType type = findSmallestSuitableType(mft.getByteValue(), dataKind, maxLength, (maxLength == 0) ? Collections.<NativeType> singleton(PARAMETER) : Collections.EMPTY_SET); if (type == null) { throw new PECodingException("Cannot find native type for field type " + mft + " with flags " + flags + " and length " + maxLength); } return (MysqlNativeType) type; } }
MysqlNativeTypeCatalog extends NativeTypeCatalog { @Override public MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except) throws PEException { MyFieldDataKind dataKind = null; if (mft.isBinaryFlagDependent()) { final boolean keepText = (flags & MysqlNativeConstants.FLDPKT_FLAG_BINARY) == 0; if (keepText) { dataKind = MyFieldDataKind.TEXT; } else { dataKind = MyFieldDataKind.BINARY; } } else { dataKind = MyFieldDataKind.ANY; } final NativeType type = findSmallestSuitableType(mft.getByteValue(), dataKind, maxLength, (maxLength == 0) ? Collections.<NativeType> singleton(PARAMETER) : Collections.EMPTY_SET); if (type == null) { throw new PECodingException("Cannot find native type for field type " + mft + " with flags " + flags + " and length " + maxLength); } return (MysqlNativeType) type; }  }
MysqlNativeTypeCatalog extends NativeTypeCatalog { @Override public MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except) throws PEException { MyFieldDataKind dataKind = null; if (mft.isBinaryFlagDependent()) { final boolean keepText = (flags & MysqlNativeConstants.FLDPKT_FLAG_BINARY) == 0; if (keepText) { dataKind = MyFieldDataKind.TEXT; } else { dataKind = MyFieldDataKind.BINARY; } } else { dataKind = MyFieldDataKind.ANY; } final NativeType type = findSmallestSuitableType(mft.getByteValue(), dataKind, maxLength, (maxLength == 0) ? Collections.<NativeType> singleton(PARAMETER) : Collections.EMPTY_SET); if (type == null) { throw new PECodingException("Cannot find native type for field type " + mft + " with flags " + flags + " and length " + maxLength); } return (MysqlNativeType) type; }  @Override MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except); }
MysqlNativeTypeCatalog extends NativeTypeCatalog { @Override public MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except) throws PEException { MyFieldDataKind dataKind = null; if (mft.isBinaryFlagDependent()) { final boolean keepText = (flags & MysqlNativeConstants.FLDPKT_FLAG_BINARY) == 0; if (keepText) { dataKind = MyFieldDataKind.TEXT; } else { dataKind = MyFieldDataKind.BINARY; } } else { dataKind = MyFieldDataKind.ANY; } final NativeType type = findSmallestSuitableType(mft.getByteValue(), dataKind, maxLength, (maxLength == 0) ? Collections.<NativeType> singleton(PARAMETER) : Collections.EMPTY_SET); if (type == null) { throw new PECodingException("Cannot find native type for field type " + mft + " with flags " + flags + " and length " + maxLength); } return (MysqlNativeType) type; }  @Override MysqlNativeType findType(final MyFieldType mft, final int flags, final long maxLength, final boolean except);  }