@Test public void testMySQLSpecCommentsRemoval() { String sql_with_mysql_spec_comments = "CREATE TABLE t1(a INT, KEY (a)) "; String sql_with_mysql_spec_comments2 = ""; String expected_sql = "CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024 "; String stripped_sql = MysqlSchemaUtil.removeCommentsFromDDL(sql_with_mysql_spec_comments); assertEquals(expected_sql, stripped_sql); expected_sql = "CREATE TABLE t1(a INT, KEY (a))"; stripped_sql = MysqlSchemaUtil.removeCommentsFromDDL(sql_with_mysql_spec_comments2); assertEquals(expected_sql, stripped_sql); }
String removeCommentsFromDDL(final String ddl) { return ddl .replaceAll("/\\*!(?:\\d{5})?(.*?)\\*/", "$1") .replaceAll("/\\*[^*]*\\*+(?:[^", " ") .replaceAll("\\h+", " ") .replaceAll("^\\s+", ""); }
MysqlSchemaUtil { String removeCommentsFromDDL(final String ddl) { return ddl .replaceAll("/\\*!(?:\\d{5})?(.*?)\\*/", "$1") .replaceAll("/\\*[^*]*\\*+(?:[^", " ") .replaceAll("\\h+", " ") .replaceAll("^\\s+", ""); } }
MysqlSchemaUtil { String removeCommentsFromDDL(final String ddl) { return ddl .replaceAll("/\\*!(?:\\d{5})?(.*?)\\*/", "$1") .replaceAll("/\\*[^*]*\\*+(?:[^", " ") .replaceAll("\\h+", " ") .replaceAll("^\\s+", ""); }  }
MysqlSchemaUtil { String removeCommentsFromDDL(final String ddl) { return ddl .replaceAll("/\\*!(?:\\d{5})?(.*?)\\*/", "$1") .replaceAll("/\\*[^*]*\\*+(?:[^", " ") .replaceAll("\\h+", " ") .replaceAll("^\\s+", ""); }  void executeWithJdbc(
      @NonNull final Handle handle, final String database, @NonNull final String sql); String escapeBackQuote(@NonNull final String name); }
MysqlSchemaUtil { String removeCommentsFromDDL(final String ddl) { return ddl .replaceAll("/\\*!(?:\\d{5})?(.*?)\\*/", "$1") .replaceAll("/\\*[^*]*\\*+(?:[^", " ") .replaceAll("\\h+", " ") .replaceAll("^\\s+", ""); }  void executeWithJdbc(
      @NonNull final Handle handle, final String database, @NonNull final String sql); String escapeBackQuote(@NonNull final String name); final Retryer<Void> VOID_RETRYER; final Retryer<List<MysqlColumn>> LIST_COLUMN_RETRYER; final Retryer<List<MysqlTableSchema>> LIST_TABLE_SCHEMA_RETRYER; final Retryer<List<String>> LIST_STRING_RETRYER; }