Here you can find the source of splitCQLStatements(String source)
Parameter | Description |
---|---|
source | the source script |
public static List<String> splitCQLStatements(String source)
//package com.java2s; /******************************************************************************* * * Pentaho Big Data/* w ww .ja v a 2s. c o m*/ * * Copyright (C) 2002-2013 by Pentaho : http://www.pentaho.com * ******************************************************************************* * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************/ import java.util.ArrayList; import java.util.List; public class Main { /** * Split a script containing one or more CQL statements (terminated by ;'s) into a list of individual statements. * * @param source * the source script * @return a list of individual CQL statements */ public static List<String> splitCQLStatements(String source) { String[] cqlStatements = source.split(";"); //$NON-NLS-1$ List<String> individualStatements = new ArrayList<String>(); if (cqlStatements.length > 0) { for (String cqlC : cqlStatements) { cqlC = cqlC.trim(); if (!cqlC.endsWith(";")) { //$NON-NLS-1$ cqlC += ";"; //$NON-NLS-1$ } individualStatements.add(cqlC); } } return individualStatements; } }