Class StatementParser (0.5.1)

public class StatementParser

Inheritance

java.lang.Object > StatementParser

Static Methods

isCommand(String command, String query)

public static boolean isCommand(String command, String query)

Returns true if the given sql string is the given command.

Parameters
Name Description
command String
query String
Returns
Type Description
boolean

parseCommand(String sql)

public static String parseCommand(String sql)

Determines the (update) command that was received from the sql string.

Parameter
Name Description
sql String
Returns
Type Description
String

singleQuoteEscape(String sql)

public static String singleQuoteEscape(String sql)

Simple method to escape SQL. Ultimately it is preferred that a user uses PreparedStatements but for the case of psql emulation, we apply this to provide a simple layer of protection to the user. This method simply duplicates all single quotes (i.e. ' becomes '').

Parameter
Name Description
sql String
Returns
Type Description
String

splitStatements(String sql)

public static ImmutableList<String> splitStatements(String sql)

Splits the given sql string into multiple sql statements. A semi-colon (;) indicates the end of a statement.

Parameter
Name Description
sql String
Returns
Type Description
com.google.common.collect.ImmutableList<String>

Constructors

StatementParser()

public StatementParser()