@Test public void test_isDeleteSql() throws Throwable{ boolean result = sqlTypeChecker.isDeleteSql("delete from userinfo" ); assertTrue(result); result = sqlTypeChecker.isDeleteSql("sdelete from userinfo" ); assertFalse(result); assertTrue(sqlTypeChecker.isDeleteSql("<![CDATA[ delete from userinfo ]]>" )); assertTrue(sqlTypeChecker.isDeleteSql("<![CDATA[ \ndelete\n from\n userinfo ]]>" )); assertTrue(sqlTypeChecker.isDeleteSql("<![CDATA[ \ndelete air_ld_config\n where config_name = ?\n \n]]>" )); }
public static boolean isDeleteSql(String sourceSql) { String processedSql = StringHelper.removeXMLCdataTag(SqlParseHelper.removeSqlComments(sourceSql)).trim().toLowerCase(); return processedSql.matches("(?is)\\s*delete\\s+from\\s.*") || processedSql.matches("(?is)\\s*delete\\s+.*"); }
SqlTypeChecker { public static boolean isDeleteSql(String sourceSql) { String processedSql = StringHelper.removeXMLCdataTag(SqlParseHelper.removeSqlComments(sourceSql)).trim().toLowerCase(); return processedSql.matches("(?is)\\s*delete\\s+from\\s.*") || processedSql.matches("(?is)\\s*delete\\s+.*"); } }
SqlTypeChecker { public static boolean isDeleteSql(String sourceSql) { String processedSql = StringHelper.removeXMLCdataTag(SqlParseHelper.removeSqlComments(sourceSql)).trim().toLowerCase(); return processedSql.matches("(?is)\\s*delete\\s+from\\s.*") || processedSql.matches("(?is)\\s*delete\\s+.*"); }  }
SqlTypeChecker { public static boolean isDeleteSql(String sourceSql) { String processedSql = StringHelper.removeXMLCdataTag(SqlParseHelper.removeSqlComments(sourceSql)).trim().toLowerCase(); return processedSql.matches("(?is)\\s*delete\\s+from\\s.*") || processedSql.matches("(?is)\\s*delete\\s+.*"); }  static boolean isSelectSql(String sourceSql); static boolean isUpdateSql(String sourceSql); static boolean isDeleteSql(String sourceSql); static boolean isInsertSql(String sourceSql); }
SqlTypeChecker { public static boolean isDeleteSql(String sourceSql) { String processedSql = StringHelper.removeXMLCdataTag(SqlParseHelper.removeSqlComments(sourceSql)).trim().toLowerCase(); return processedSql.matches("(?is)\\s*delete\\s+from\\s.*") || processedSql.matches("(?is)\\s*delete\\s+.*"); }  static boolean isSelectSql(String sourceSql); static boolean isUpdateSql(String sourceSql); static boolean isDeleteSql(String sourceSql); static boolean isInsertSql(String sourceSql);  }