- java.lang.Object
-
- com.aoindustries.aoserv.client.sql.Parser
-
public class Parser extends Object
Static utilities for use in SQL parsing.- Author:
- AO Industries, Inc.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intindexOfNotQuoted(String expr, char ch)Find a match only outside quoted section of the expressions.static intindexOfNotQuoted(String expr, char ch, int fromIndex)Find a match only outside quoted section of the expressions.static intindexOfNotQuoted(String expr, String str)Find a match only outside quoted section of the expressions.static intindexOfNotQuoted(String expr, String str, int fromIndex)Find a match only outside quoted section of the expressions.static SQLExpressionparseSQLExpression(AOServTable<?,?> table, String expr)static Stringquote(String str)Quotes a string if needed.static Stringunquote(String str)Unquotes a string, removing " characters, except "" being the escape for a " within a quoted section.
-
-
-
Method Detail
-
indexOfNotQuoted
public static int indexOfNotQuoted(String expr, char ch, int fromIndex)
Find a match only outside quoted section of the expressions. Quoted by ", with "" being the escape for a " within the quoted section.
-
indexOfNotQuoted
public static int indexOfNotQuoted(String expr, char ch)
Find a match only outside quoted section of the expressions. Quoted by ", with "" being the escape for a " within the quoted section.
-
indexOfNotQuoted
public static int indexOfNotQuoted(String expr, String str, int fromIndex)
Find a match only outside quoted section of the expressions. Quoted by ", with "" being the escape for a " within the quoted section.
-
indexOfNotQuoted
public static int indexOfNotQuoted(String expr, String str)
Find a match only outside quoted section of the expressions. Quoted by ", with "" being the escape for a " within the quoted section.
-
unquote
public static String unquote(String str)
Unquotes a string, removing " characters, except "" being the escape for a " within a quoted section.
-
quote
public static String quote(String str)
Quotes a string if needed. Currently this only when is empty, contains " or . or a character outside normal ASCII range. Unicode is not considered for use without quoting, since this is only used to quote AOServ table/column names, which are all ASCII.
-
parseSQLExpression
public static SQLExpression parseSQLExpression(AOServTable<?,?> table, String expr) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
-