@Test public void isSameTypeTest () { Assert.assertTrue (TypeMap.isSameType ("CHAR", "char")); Assert.assertFalse (TypeMap.isSameType ("CHAR", "VARCHAR")); Assert.assertTrue (TypeMap.isSameType ("VARCHAR", "CHAR")); Assert.assertTrue (TypeMap.isSameType ("VARCHAR(100)", "VARCHAR")); Assert.assertTrue (TypeMap.isSameType ("VARCHAR(100) CHARACTER SET LATIN", "VARCHAR")); Assert.assertTrue (TypeMap.isSameType ("VARCHAR(100) CHARACTER SET LATIN", "VARCHAR CHARACTER SET LATIN")); Assert.assertTrue (TypeMap.isSameType ("CHAR(100) FOR BIT DATA", "CHAR() FOR BIT DATA")); }
public static boolean isSameType (String src, String sub) { if (src.length () < sub.length ()) return false; if (src.length () == sub.length ()) return src.equalsIgnoreCase (sub); src = src.toLowerCase (); sub = sub.toLowerCase (); if (src.indexOf (sub) >= 0) return true; int i; for (i = 0; i < sub.length (); ++i) { if (src.charAt (i) != sub.charAt (i)) break; } if (i == 0) return false; return src.substring (i).indexOf (sub.substring (i)) >= 0; }
TypeMap { public static boolean isSameType (String src, String sub) { if (src.length () < sub.length ()) return false; if (src.length () == sub.length ()) return src.equalsIgnoreCase (sub); src = src.toLowerCase (); sub = sub.toLowerCase (); if (src.indexOf (sub) >= 0) return true; int i; for (i = 0; i < sub.length (); ++i) { if (src.charAt (i) != sub.charAt (i)) break; } if (i == 0) return false; return src.substring (i).indexOf (sub.substring (i)) >= 0; } }
TypeMap { public static boolean isSameType (String src, String sub) { if (src.length () < sub.length ()) return false; if (src.length () == sub.length ()) return src.equalsIgnoreCase (sub); src = src.toLowerCase (); sub = sub.toLowerCase (); if (src.indexOf (sub) >= 0) return true; int i; for (i = 0; i < sub.length (); ++i) { if (src.charAt (i) != sub.charAt (i)) break; } if (i == 0) return false; return src.substring (i).indexOf (sub.substring (i)) >= 0; } TypeMap(Map<Integer, TypeInfo> map); }
TypeMap { public static boolean isSameType (String src, String sub) { if (src.length () < sub.length ()) return false; if (src.length () == sub.length ()) return src.equalsIgnoreCase (sub); src = src.toLowerCase (); sub = sub.toLowerCase (); if (src.indexOf (sub) >= 0) return true; int i; for (i = 0; i < sub.length (); ++i) { if (src.charAt (i) != sub.charAt (i)) break; } if (i == 0) return false; return src.substring (i).indexOf (sub.substring (i)) >= 0; } TypeMap(Map<Integer, TypeInfo> map); TypeInfo getType(int type, int precision, boolean exact); void setCustomMap(Map<Integer, TypeInfo> customMap); String getTypeName(int type, int precision, int scale, boolean exact); static boolean isSameType(String src, String sub); }
TypeMap { public static boolean isSameType (String src, String sub) { if (src.length () < sub.length ()) return false; if (src.length () == sub.length ()) return src.equalsIgnoreCase (sub); src = src.toLowerCase (); sub = sub.toLowerCase (); if (src.indexOf (sub) >= 0) return true; int i; for (i = 0; i < sub.length (); ++i) { if (src.charAt (i) != sub.charAt (i)) break; } if (i == 0) return false; return src.substring (i).indexOf (sub.substring (i)) >= 0; } TypeMap(Map<Integer, TypeInfo> map); TypeInfo getType(int type, int precision, boolean exact); void setCustomMap(Map<Integer, TypeInfo> customMap); String getTypeName(int type, int precision, int scale, boolean exact); static boolean isSameType(String src, String sub);  }