Package org.codehaus.mojo.sql
Class SqlSplitter
java.lang.Object
org.codehaus.mojo.sql.SqlSplitter
Utility class to split a long sql batch script into single SQL commands.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intValue indicating the sql has no end-delimiter like i.e.static final intparsed sql started a comment with /_* which continues on the next line (did not end)static final intparsed sql started a double quote static text which continues on the next line (did not end)static final intparsed sql started a single quote static text which continues on the next line (did not end) -
Method Summary
Modifier and TypeMethodDescriptionstatic intcontainsSqlEnd(String line, String delimiter, int overflowValue) Check if the given sql line contains a delimiter representing the end of the command.
-
Field Details
-
NO_END
public static final int NO_ENDValue indicating the sql has no end-delimiter like i.e. the semicolon.- See Also:
-
OVERFLOW_SINGLE_QUOTE
public static final int OVERFLOW_SINGLE_QUOTEparsed sql started a single quote static text which continues on the next line (did not end)- See Also:
-
OVERFLOW_DOUBLE_QUOTE
public static final int OVERFLOW_DOUBLE_QUOTEparsed sql started a double quote static text which continues on the next line (did not end)- See Also:
-
OVERFLOW_COMMENT
public static final int OVERFLOW_COMMENTparsed sql started a comment with /_* which continues on the next line (did not end)- See Also:
-
-
Method Details
-
containsSqlEnd
Check if the given sql line contains a delimiter representing the end of the command. Please note that we do not fully parse the SQL, so if we get a malformed statement, we cannot detect it.- Parameters:
line- to parsedelimiter- which should be used to split SQL commandsoverflowValue- 0=none,OVERFLOW_COMMENT,OVERFLOW_SINGLE_QUOTEorOVERFLOW_DOUBLE_QUOTE- Returns:
- position after the end character if the given line contains the end of a SQL script,
NO_ENDif it doesn't contain an end char.OVERFLOW_SINGLE_QUOTEwill be returned if a single quote didn't get closed,OVERFLOW_DOUBLE_QUOTElikewise for not closed double quotes.
-