Class StatementParser (0.6.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
NameDescription
commandString
queryString
Returns
TypeDescription
boolean

parseCommand(String sql)

public static String parseCommand(String sql)

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

Parameter
NameDescription
sqlString
Returns
TypeDescription
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
NameDescription
sqlString
Returns
TypeDescription
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
NameDescription
sqlString
Returns
TypeDescription
com.google.common.collect.ImmutableList<String>

Constructors

StatementParser()

public StatementParser()