@Test public void executeCqlScriptTwoStatementsNoFinalSemicolon() { final Session session = mock(Session.class); CassandraUtils.executeCqlScript(session, "MY STATEMENT;\n\nOTHER STATEMENT"); verify(session).execute("MY STATEMENT"); verify(session).execute("OTHER STATEMENT"); verifyNoMoreInteractions(session); }
public static void executeCqlScript(final Session session, final String script) { if (script == null) { return; } final List<String> lines = new ArrayList<String>(); for (final String line : Splitter.on("\n").split(script)) { lines.add(line.trim()); } for (String cql : Joiner.on(" ").join(lines).split(";")) { cql = cql.trim(); if (cql.isEmpty()) { continue; } session.execute(cql); } }
CassandraUtils { public static void executeCqlScript(final Session session, final String script) { if (script == null) { return; } final List<String> lines = new ArrayList<String>(); for (final String line : Splitter.on("\n").split(script)) { lines.add(line.trim()); } for (String cql : Joiner.on(" ").join(lines).split(";")) { cql = cql.trim(); if (cql.isEmpty()) { continue; } session.execute(cql); } } }
CassandraUtils { public static void executeCqlScript(final Session session, final String script) { if (script == null) { return; } final List<String> lines = new ArrayList<String>(); for (final String line : Splitter.on("\n").split(script)) { lines.add(line.trim()); } for (String cql : Joiner.on(" ").join(lines).split(";")) { cql = cql.trim(); if (cql.isEmpty()) { continue; } session.execute(cql); } } private  CassandraUtils(); }
CassandraUtils { public static void executeCqlScript(final Session session, final String script) { if (script == null) { return; } final List<String> lines = new ArrayList<String>(); for (final String line : Splitter.on("\n").split(script)) { lines.add(line.trim()); } for (String cql : Joiner.on(" ").join(lines).split(";")) { cql = cql.trim(); if (cql.isEmpty()) { continue; } session.execute(cql); } } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value); }
CassandraUtils { public static void executeCqlScript(final Session session, final String script) { if (script == null) { return; } final List<String> lines = new ArrayList<String>(); for (final String line : Splitter.on("\n").split(script)) { lines.add(line.trim()); } for (String cql : Joiner.on(" ").join(lines).split(";")) { cql = cql.trim(); if (cql.isEmpty()) { continue; } session.execute(cql); } } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value);  }