@Test public void queryTypeTest() { String sql = null; String typeQuery = instance.getTypeQuery(sql); Assert.assertNull(typeQuery); sql = " "; typeQuery = instance.getTypeQuery(sql); Assert.assertNull(typeQuery); sql = "toto"; typeQuery = instance.getTypeQuery(sql); Assert.assertNull(typeQuery); sql = "select Price from products;"; typeQuery = instance.getTypeQuery(sql); Assert.assertEquals(typeQuery, "select"); sql = " select Price from products;"; typeQuery = instance.getTypeQuery(sql); Assert.assertEquals(typeQuery, "select"); sql = " select Price from products; "; typeQuery = instance.getTypeQuery(sql); Assert.assertEquals(typeQuery, "select"); }
public String getTypeQuery(String sql) { sql = removeComment(sql); if (sql == null) { return null; } sql = sql.trim(); if (sql.length() < 6) { return null; } String type = sql.substring(0, 6).toLowerCase(); return type.intern(); }
GenericRdbmsSpecifics implements RdbmsSpecifics { public String getTypeQuery(String sql) { sql = removeComment(sql); if (sql == null) { return null; } sql = sql.trim(); if (sql.length() < 6) { return null; } String type = sql.substring(0, 6).toLowerCase(); return type.intern(); } }
GenericRdbmsSpecifics implements RdbmsSpecifics { public String getTypeQuery(String sql) { sql = removeComment(sql); if (sql == null) { return null; } sql = sql.trim(); if (sql.length() < 6) { return null; } String type = sql.substring(0, 6).toLowerCase(); return type.intern(); } private  GenericRdbmsSpecifics(); }
GenericRdbmsSpecifics implements RdbmsSpecifics { public String getTypeQuery(String sql) { sql = removeComment(sql); if (sql == null) { return null; } sql = sql.trim(); if (sql.length() < 6) { return null; } String type = sql.substring(0, 6).toLowerCase(); return type.intern(); } private  GenericRdbmsSpecifics(); static RdbmsSpecifics getInstance(); boolean isRdbms(final String classType); DataRdbms getData(final Object object); String getTypeQuery(String sql); int beginQuery(String sql, int index); String removeComment(String sql); boolean isCaseSensitive(); String toString(); }
GenericRdbmsSpecifics implements RdbmsSpecifics { public String getTypeQuery(String sql) { sql = removeComment(sql); if (sql == null) { return null; } sql = sql.trim(); if (sql.length() < 6) { return null; } String type = sql.substring(0, 6).toLowerCase(); return type.intern(); } private  GenericRdbmsSpecifics(); static RdbmsSpecifics getInstance(); boolean isRdbms(final String classType); DataRdbms getData(final Object object); String getTypeQuery(String sql); int beginQuery(String sql, int index); String removeComment(String sql); boolean isCaseSensitive(); String toString();  }