@Test public void splitOngo() { String sql = "some sql\ngo\nmore sql"; String[] result = StringUtils.splitSQL(sql, null); assertEquals(2,result.length); assertEquals("some sql",result[0]); assertEquals("more sql",result[1]); }
public static String[] splitSQL(String multiLineSQL, String endDelimiter) { if (endDelimiter == null) { endDelimiter = ";\\s*\n|;$|\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } else { if (endDelimiter.equalsIgnoreCase("go")) { endDelimiter = "\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } } String[] initialSplit = multiLineSQL.split(endDelimiter); List<String> strings = new ArrayList<String>(); for (String anInitialSplit : initialSplit) { String singleLineSQL = anInitialSplit.trim(); if (singleLineSQL.length() > 0) { strings.add(singleLineSQL); } } return strings.toArray(new String[strings.size()]); }
StringUtils { public static String[] splitSQL(String multiLineSQL, String endDelimiter) { if (endDelimiter == null) { endDelimiter = ";\\s*\n|;$|\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } else { if (endDelimiter.equalsIgnoreCase("go")) { endDelimiter = "\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } } String[] initialSplit = multiLineSQL.split(endDelimiter); List<String> strings = new ArrayList<String>(); for (String anInitialSplit : initialSplit) { String singleLineSQL = anInitialSplit.trim(); if (singleLineSQL.length() > 0) { strings.add(singleLineSQL); } } return strings.toArray(new String[strings.size()]); } }
StringUtils { public static String[] splitSQL(String multiLineSQL, String endDelimiter) { if (endDelimiter == null) { endDelimiter = ";\\s*\n|;$|\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } else { if (endDelimiter.equalsIgnoreCase("go")) { endDelimiter = "\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } } String[] initialSplit = multiLineSQL.split(endDelimiter); List<String> strings = new ArrayList<String>(); for (String anInitialSplit : initialSplit) { String singleLineSQL = anInitialSplit.trim(); if (singleLineSQL.length() > 0) { strings.add(singleLineSQL); } } return strings.toArray(new String[strings.size()]); }  }
StringUtils { public static String[] splitSQL(String multiLineSQL, String endDelimiter) { if (endDelimiter == null) { endDelimiter = ";\\s*\n|;$|\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } else { if (endDelimiter.equalsIgnoreCase("go")) { endDelimiter = "\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } } String[] initialSplit = multiLineSQL.split(endDelimiter); List<String> strings = new ArrayList<String>(); for (String anInitialSplit : initialSplit) { String singleLineSQL = anInitialSplit.trim(); if (singleLineSQL.length() > 0) { strings.add(singleLineSQL); } } return strings.toArray(new String[strings.size()]); }  static String trimToEmpty(String string); static String trimToNull(String string); static String[] processMutliLineSQL(String multiLineSQL,boolean stripComments, boolean splitStatements, String endDelimiter); static String[] splitSQL(String multiLineSQL, String endDelimiter); static String stripComments(String multiLineSQL); static String join(String[] array, String delimiter); static String join(Collection<String> collection, String delimiter); static List<String> splitAndTrim(String s, String regex); static String repeat(String string, int times); static String join(Integer[] array, String delimiter); static String join(int[] array, String delimiter); }
StringUtils { public static String[] splitSQL(String multiLineSQL, String endDelimiter) { if (endDelimiter == null) { endDelimiter = ";\\s*\n|;$|\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } else { if (endDelimiter.equalsIgnoreCase("go")) { endDelimiter = "\n[gG][oO]\\s*\n|\n[Gg][oO]\\s*$"; } } String[] initialSplit = multiLineSQL.split(endDelimiter); List<String> strings = new ArrayList<String>(); for (String anInitialSplit : initialSplit) { String singleLineSQL = anInitialSplit.trim(); if (singleLineSQL.length() > 0) { strings.add(singleLineSQL); } } return strings.toArray(new String[strings.size()]); }  static String trimToEmpty(String string); static String trimToNull(String string); static String[] processMutliLineSQL(String multiLineSQL,boolean stripComments, boolean splitStatements, String endDelimiter); static String[] splitSQL(String multiLineSQL, String endDelimiter); static String stripComments(String multiLineSQL); static String join(String[] array, String delimiter); static String join(Collection<String> collection, String delimiter); static List<String> splitAndTrim(String s, String regex); static String repeat(String string, int times); static String join(Integer[] array, String delimiter); static String join(int[] array, String delimiter);  }