From 5f8dc174b5781277ca68b139545b56badde62be1 Mon Sep 17 00:00:00 2001 From: akwei Date: Sun, 30 Sep 2012 22:25:05 +0800 Subject: [PATCH] =?UTF-8?q?2012-09-30=201,=E5=A2=9E=E5=8A=A0=E5=AF=B9betwe?= =?UTF-8?q?en=20and=20=E7=9A=84=E6=94=AF=E6=8C=81=202,=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E8=A7=A3=E6=9E=90=E7=9A=84bug=203,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A3=E6=9E=90=E5=99=A8delegate=204,?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9db2=E5=88=86=E9=A1=B5=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- releasenote.md | 5 + .../analysis/antlr/AntlrParserDelegate.java | 78 +- .../java/halo/dal/analysis/antlr/ColExpr.java | 82 +- .../antlr/DefAntlrParserDelegate.java | 71 +- .../antlr/MockAntlrParserDelegate.java | 52 - .../halo/dal/analysis/antlr/v3/AntlrV3SQL.g | 87 +- .../analysis/antlr/v3/AntlrV3SQLAnalyzer.java | 186 +- .../analysis/antlr/v3/AntlrV3SQLLexer.java | 4607 ++++++------- .../analysis/antlr/v3/AntlrV3SQLParser.java | 5743 ++++++++--------- .../antlr/v3/CopyOfAntlrV3SQLAnalyzer.java | 131 - .../java/halo/dal/analysis/antlr/v3/sql.txt | 7 +- src/main/java/halo/dal/sql/DALConnection.java | 691 +- .../halo/dal/sql/DALPreparedStatement.java | 1576 ++--- 13 files changed, 6486 insertions(+), 6830 deletions(-) delete mode 100644 src/main/java/halo/dal/analysis/antlr/MockAntlrParserDelegate.java delete mode 100644 src/main/java/halo/dal/analysis/antlr/v3/CopyOfAntlrV3SQLAnalyzer.java diff --git a/releasenote.md b/releasenote.md index aedd637..70b6839 100644 --- a/releasenote.md +++ b/releasenote.md @@ -1,3 +1,8 @@ +2012-09-30 +1,增加对between and 的支持 +2,修改不需要解析的bug +3,修改解析器delegate +4,增加对db2分页获取数据的支持 2012-07-18 1,支持sql中使用column_name='a' column_name=sysdate() 的赋值方式,但是此column_name的值不能作为分区关键字使用 2,添加当使用 PartitionParser 进行解析时,返回null的提示 diff --git a/src/main/java/halo/dal/analysis/antlr/AntlrParserDelegate.java b/src/main/java/halo/dal/analysis/antlr/AntlrParserDelegate.java index 8bd75ba..7aca8ce 100644 --- a/src/main/java/halo/dal/analysis/antlr/AntlrParserDelegate.java +++ b/src/main/java/halo/dal/analysis/antlr/AntlrParserDelegate.java @@ -9,61 +9,45 @@ */ public interface AntlrParserDelegate { - int SQLOP_INSERT = 1; + int SQLOP_INSERT = 1; - int SQLOP_UPDATE = 2; + int SQLOP_UPDATE = 2; - int SQLOP_DELETE = 3; + int SQLOP_DELETE = 3; - int SQLOP_SELECT = 4; + int SQLOP_SELECT = 4; - /** - * 设置当前sql操作的方式 - * - * @param sqlOp - */ - void setSqlOp(int sqlOp); + /** + * 设置当前sql操作的方式 + * + * @param sqlOp + */ + void setSqlOp(int sqlOp); - int getSqlOp(); + int getSqlOp(); - /** - * 是否含有from关键字 - * - * @param hasSelectFrom - */ - void setHasSelectFrom(boolean hasSelectFrom); + boolean isHasTable(); - boolean isHasSelectFrom(); + /** + * 当获得表信息时,触发的方法 + * + * @param name + * 表名称 + * @param alias + */ + void onFindTable(String name, String alias); - /** - * 是否含有between and 关键字 - * - * @param hasBetweenAnd - */ - void setHasBetweenAnd(boolean hasBetweenAnd); + /** + * 当获得insert update where 表达式时触发的方法 + * + * @param column + * 表达式列名 + * @param op + * 表达式符号例如 = >= ... + */ + void onFindColExper(String column, String op); - boolean isHasBetweenAnd(); + List getTables(); - /** - * 当获得表信息时,触发的方法 - * - * @param name - * 表名称 - * @param alias - */ - void onFindTable(String name, String alias); - - /** - * 当获得insert update where 表达式时触发的方法 - * - * @param column - * 表达式列名 - * @param op - * 表达式符号例如 = >= ... - */ - void onFindColExper(String column, String op); - - List
getTables(); - - List getColExprs(); + List getColExprs(); } \ No newline at end of file diff --git a/src/main/java/halo/dal/analysis/antlr/ColExpr.java b/src/main/java/halo/dal/analysis/antlr/ColExpr.java index b0b5505..22f7c94 100644 --- a/src/main/java/halo/dal/analysis/antlr/ColExpr.java +++ b/src/main/java/halo/dal/analysis/antlr/ColExpr.java @@ -2,46 +2,44 @@ public class ColExpr { - private String column; - - private String op; - - public ColExpr() { - } - - /** - * @param column - * columnName不能含有"." - * @param op - */ - public ColExpr(String column, String op) { - this.setColumn(column); - this.setOp(op); - } - - public String getColumn() { - return column; - } - - /** - * @param column - * columnName不能含有"." - */ - public void setColumn(String column) { - int idx = column.indexOf("."); - if (idx == -1) { - this.column = column; - } - else { - this.column = column.substring(idx + 1); - } - } - - public String getOp() { - return op; - } - - public void setOp(String op) { - this.op = op; - } + private String column; + + private String op; + + public ColExpr() { + } + + /** + * @param column + * @param op + */ + public ColExpr(String column, String op) { + this.setColumn(column); + this.setOp(op); + } + + public String getColumn() { + return column; + } + + /** + * @param column + */ + public void setColumn(String column) { + int idx = column.indexOf("."); + if (idx == -1) { + this.column = column; + } + else { + this.column = column.substring(idx + 1); + } + } + + public String getOp() { + return op; + } + + public void setOp(String op) { + this.op = op; + } } diff --git a/src/main/java/halo/dal/analysis/antlr/DefAntlrParserDelegate.java b/src/main/java/halo/dal/analysis/antlr/DefAntlrParserDelegate.java index 3763344..f9b4fb6 100644 --- a/src/main/java/halo/dal/analysis/antlr/DefAntlrParserDelegate.java +++ b/src/main/java/halo/dal/analysis/antlr/DefAntlrParserDelegate.java @@ -5,53 +5,50 @@ public class DefAntlrParserDelegate implements AntlrParserDelegate { - private List
tables = new ArrayList
(); + private List
tables = new ArrayList
(); - private List colExprs = new ArrayList(); + private List colExprs = new ArrayList(); - private boolean hasBetweenAnd; + private boolean hasBetweenAnd; - private boolean hasSelectFrom; + private int sqlOp; - private int sqlOp; + public void setSqlOp(int sqlOp) { + this.sqlOp = sqlOp; + } - public void setSqlOp(int sqlOp) { - this.sqlOp = sqlOp; - } + public int getSqlOp() { + return sqlOp; + } - public int getSqlOp() { - return sqlOp; - } + public boolean isHasBetweenAnd() { + return this.hasBetweenAnd; + } - public boolean isHasBetweenAnd() { - return this.hasBetweenAnd; - } + public boolean isHasTable() { + if (this.tables.isEmpty()) { + return false; + } + return true; + } - public boolean isHasSelectFrom() { - return hasSelectFrom; - } + public void setHasBetweenAnd(boolean hasBetweenAnd) { + this.hasBetweenAnd = hasBetweenAnd; + } - public void setHasSelectFrom(boolean hasSelectFrom) { - this.hasSelectFrom = hasSelectFrom; - } + public void onFindTable(String name, String alias) { + tables.add(new Table(name, alias)); + } - public void setHasBetweenAnd(boolean hasBetweenAnd) { - this.hasBetweenAnd = hasBetweenAnd; - } + public void onFindColExper(String column, String op) { + colExprs.add(new ColExpr(column, op)); + } - public void onFindTable(String name, String alias) { - tables.add(new Table(name, alias)); - } + public List getColExprs() { + return colExprs; + } - public void onFindColExper(String column, String op) { - colExprs.add(new ColExpr(column, op)); - } - - public List getColExprs() { - return colExprs; - } - - public List
getTables() { - return tables; - } + public List
getTables() { + return tables; + } } \ No newline at end of file diff --git a/src/main/java/halo/dal/analysis/antlr/MockAntlrParserDelegate.java b/src/main/java/halo/dal/analysis/antlr/MockAntlrParserDelegate.java deleted file mode 100644 index 153f790..0000000 --- a/src/main/java/halo/dal/analysis/antlr/MockAntlrParserDelegate.java +++ /dev/null @@ -1,52 +0,0 @@ -package halo.dal.analysis.antlr; - -import java.util.List; - - -public class MockAntlrParserDelegate implements AntlrParserDelegate { - - public void setSqlOp(int sqlOp) { - // TODO Auto-generated method stub - } - - public int getSqlOp() { - // TODO Auto-generated method stub - return 0; - } - - public void setHasSelectFrom(boolean hasSelectFrom) { - // TODO Auto-generated method stub - } - - public boolean isHasSelectFrom() { - // TODO Auto-generated method stub - return false; - } - - public void setHasBetweenAnd(boolean hasBetweenAnd) { - // TODO Auto-generated method stub - } - - public boolean isHasBetweenAnd() { - // TODO Auto-generated method stub - return false; - } - - public void onFindTable(String name, String alias) { - // TODO Auto-generated method stub - } - - public void onFindColExper(String column, String op) { - // TODO Auto-generated method stub - } - - public List
getTables() { - // TODO Auto-generated method stub - return null; - } - - public List getColExprs() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQL.g b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQL.g index 4f6875c..0397b60 100644 --- a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQL.g +++ b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQL.g @@ -6,17 +6,15 @@ import java.util.ArrayList; } @members { -List tables = new ArrayList(); -List colExprs=new ArrayList(); -// private AntlrParserDelegate antlrParserDelegate; -// -// public void setAntlrParserDelegate(AntlrParserDelegate antlrParserDelegate) { -// this.antlrParserDelegate = antlrParserDelegate; -// } + private AntlrParserDelegate antlrParserDelegate; -//@Override -// public void reportError(RecognitionException e) { -// } + public void setAntlrParserDelegate(AntlrParserDelegate antlrParserDelegate) { + this.antlrParserDelegate = antlrParserDelegate; + } + +@Override + public void reportError(RecognitionException e) { + } } @@ -25,19 +23,26 @@ start : sql_insert : - INSERT INTO table '\(' insertColumn (',' insertColumn)* '\)' VALUES '\(' (PRE_SET|(',' PRE_SET))* '\)' ; + INSERT INTO table '\(' insertColumn (',' insertColumn)* '\)' VALUES '\(' (PRE_SET|(',' PRE_SET))* '\)' + {this.antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_INSERT);} + ; sql_delete : - DELETE FROM table (WHERE kv (and_or kv)*)?; + DELETE FROM table (WHERE kv (and_or kv)*)? + {this.antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_DELETE);} + ; sql_update : - UPDATE table SET kv (',' kv)* (WHERE kv (and_or kv)*)?; + UPDATE table SET kv (',' kv)* (WHERE kv (and_or kv)*)? + {this.antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_UPDATE);} + ; sql_select : - SELECT select_columns FROM (sqlAfterFrom|inner_select) (WHERE kv_sql)? (orderby|groupby|having)* + SELECT select_columns (','db2_paging)? FROM (sqlAfterFrom|inner_select) (WHERE kv_sql)? (orderby|groupby|having)* + {this.antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_SELECT);} ; sqlAfterFrom @@ -54,7 +59,7 @@ kv_sql : inner_select : - '\(' sql_select '\)' + '\(' sql_select '\)' AS? BASIC_NAME? ; func @@ -88,16 +93,9 @@ and_or : table : table_name ((AS)? alias)? { - tables.add(new String[]{$table_name.text,$alias.text}); - /** -if (this.antlrParserDelegate != null) { - this.antlrParserDelegate.onFindTable( - (table_name1 != null ? input.toString(table_name1.start, - table_name1.stop) : null), - (alias2 != null ? input.toString(alias2.start, - alias2.stop) : null)); - } - **/ + if (this.antlrParserDelegate != null) { + this.antlrParserDelegate.onFindTable( $table_name.text, $alias.text); + } }; tables : @@ -122,13 +120,10 @@ insertColumn : column_name { - colExprs.add(new String[]{$column_name.text,"="}); - /** if (this.antlrParserDelegate != null) { - this.antlrParserDelegate.onFindColExper( - (column_name3!=null?input.toString(column_name3.start,column_name3.stop):null), "="); - } - **/ + this.antlrParserDelegate.onFindColExper( + $column_name.text, "="); + } } ; @@ -136,17 +131,18 @@ insertColumn kv : (column_name op (PRE_SET|'\(' PRE_SET '\)')) { - colExprs.add(new String[]{$column_name.text,$op.text}); - /** if (this.antlrParserDelegate != null) { - this.antlrParserDelegate.onFindColExper( - (column_name4!=null?input.toString(column_name4.start,column_name4.stop):null), - (op5!=null?input.toString(op5.start,op5.stop):null)); - } - **/ + this.antlrParserDelegate.onFindColExper( $column_name.text, $op.text); + } } | - (column_name op TEXT_STRING) + column_name op TEXT_STRING + | + (column_name BETWEEN PRE_SET AND PRE_SET) + { + this.antlrParserDelegate.onFindColExper($column_name.text, ">="); + this.antlrParserDelegate.onFindColExper($column_name.text, "=<"); + } | column_name op column_name | @@ -181,12 +177,19 @@ having : HAVING (column_name|func) op (column_name|func|TEXT_STRING|PRE_SET) ; - +db2_paging + : + ROWNUMBER'\(''\)' OVER'\('orderby '\)' (AS)? BASIC_NAME + ; SELECT :S E L E C T; INSERT :I N S E R T; UPDATE :U P D A T E; DELETE :D E L E T E; +ROWNUMBER + :R O W N U M B E R; +OVER :O V E R; +BETWEEN :B E T W E E N; AND :A N D; OR :O R; WHERE :W H E R E; @@ -220,8 +223,8 @@ TEXT_STRING: ('\'' ( options{greedy=true;}: ~('\'' | '\r' | '\n' ) | '\'' '\'' - )* - '\'' ) + )* + '\'' ) ; diff --git a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLAnalyzer.java b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLAnalyzer.java index ab380ab..f398e9d 100644 --- a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLAnalyzer.java +++ b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLAnalyzer.java @@ -23,102 +23,98 @@ public class AntlrV3SQLAnalyzer implements SQLAnalyzer { - protected final static String SQL_BLANK = " "; + protected final static String SQL_BLANK = " "; - public SQLInfo analyse(String sql, SQLStruct sqlStruct, Object[] values, - Map context) { - SQLInfoImpl info = new SQLInfoImpl(); - SQLExpression sqlExpression; - int i = 0; - for (ColumnExper o : sqlStruct.getColumnExpers()) { - sqlExpression = new SQLExpression(); - sqlExpression.setColumn(o.getColumn()); - sqlExpression.setSqlExpressionSymbol(o.getSqlExpressionSymbol()); - sqlExpression.setValue(values[i]); - info.addSQLExpression(o.getLogicTableName(), sqlExpression); - i++; - } - return info; - } + public SQLInfo analyse(String sql, SQLStruct sqlStruct, Object[] values, + Map context) { + SQLInfoImpl info = new SQLInfoImpl(); + SQLExpression sqlExpression; + int i = 0; + for (ColumnExper o : sqlStruct.getColumnExpers()) { + sqlExpression = new SQLExpression(); + sqlExpression.setColumn(o.getColumn()); + sqlExpression.setSqlExpressionSymbol(o.getSqlExpressionSymbol()); + sqlExpression.setValue(values[i]); + info.addSQLExpression(o.getLogicTableName(), sqlExpression); + i++; + } + return info; + } - public SQLStruct parse(String sql, Map context) { - AntlrV3SQLLexer lexer = new AntlrV3SQLLexer(new ANTLRStringStream(sql)); - CommonTokenStream tokens = new CommonTokenStream(lexer); - AntlrV3SQLParser parser = new AntlrV3SQLParser(tokens); - AntlrParserDelegate delegate = new DefAntlrParserDelegate(); - parser.setAntlrParserDelegate(delegate); - try { - parser.start(); - } - catch (RecognitionException e) { - throw new RuntimeException(e); - } - // if (delegate.isHasBetweenAnd()) { - // throw new SQLKeyErrException("not supported sql key: between "); - // } - SQLStruct sqlStruct = new SQLStruct(); - if (delegate.getSqlOp() == AntlrParserDelegate.SQLOP_SELECT - && !delegate.isHasSelectFrom()) { - sqlStruct.setCanParse(false); - return sqlStruct; - } - sqlStruct.setCanParse(true); - Table table; - for (int i = 0; i < delegate.getTables().size(); i++) { - table = delegate.getTables().get(i); - sqlStruct.addTable(table.getName(), table.getAlias()); - } - ColumnExper columnExper; - for (ColExpr colExpr : delegate.getColExprs()) { - columnExper = new ColumnExper(); - columnExper.setColumn(colExpr.getColumn()); - columnExper.setSqlExpressionSymbol(colExpr.getOp()); - sqlStruct.addColumnExper(columnExper); - } - return sqlStruct; - } + public SQLStruct parse(String sql, Map context) { + AntlrV3SQLLexer lexer = new AntlrV3SQLLexer(new ANTLRStringStream(sql)); + CommonTokenStream tokens = new CommonTokenStream(lexer); + AntlrV3SQLParser parser = new AntlrV3SQLParser(tokens); + AntlrParserDelegate delegate = new DefAntlrParserDelegate(); + parser.setAntlrParserDelegate(delegate); + try { + parser.start(); + } + catch (RecognitionException e) { + throw new RuntimeException(e); + } + SQLStruct sqlStruct = new SQLStruct(); + if (!delegate.isHasTable()) { + sqlStruct.setCanParse(false); + return sqlStruct; + } + sqlStruct.setCanParse(true); + Table table; + for (int i = 0; i < delegate.getTables().size(); i++) { + table = delegate.getTables().get(i); + sqlStruct.addTable(table.getName(), table.getAlias()); + } + ColumnExper columnExper; + for (ColExpr colExpr : delegate.getColExprs()) { + columnExper = new ColumnExper(); + columnExper.setColumn(colExpr.getColumn()); + columnExper.setSqlExpressionSymbol(colExpr.getOp()); + sqlStruct.addColumnExper(columnExper); + } + return sqlStruct; + } - public String outPutSQL(String sql, SQLStruct sqlStruct, SQLInfo sqlInfo, - ParsedTableInfo parsedTableInfo) { - List list = new ArrayList(); - List newList = new ArrayList(); - String realTableName; - for (String tableName : sqlStruct.getTableNames()) { - realTableName = parsedTableInfo.getRealTable(tableName); - if (realTableName != null) { - String alias = sqlStruct.getAliasByTableName(tableName); - boolean isSame = alias != null && alias.endsWith(tableName); - if (!isSame) { - list.add(SQL_BLANK + tableName + "."); - newList.add(SQL_BLANK + realTableName + "."); - } - list.add(SQL_BLANK + tableName + SQL_BLANK); - newList.add(SQL_BLANK + realTableName + SQL_BLANK); - list.add(SQL_BLANK + tableName + "("); - newList.add(" " + realTableName + "("); - list.add("," + tableName + SQL_BLANK); - newList.add("," + realTableName + SQL_BLANK); - } - } - String fmtSql = sql.replaceAll("\\. {1,}", "\\.").trim(); - String _sql = StringUtils.replaceEach(fmtSql, - list.toArray(new String[list.size()]), - newList.toArray(new String[newList.size()])); - // 解决sql结束字符串为表名,无法解析的问题例如 delete form user - String str; - for (String tableName : sqlStruct.getTableNames()) { - realTableName = parsedTableInfo.getRealTable(tableName); - if (realTableName != null) { - str = SQL_BLANK + tableName; - int idx = _sql.lastIndexOf(str); - if (idx == -1) { - continue; - } - if (_sql.substring(idx).equals(str)) { - _sql = _sql.substring(0, idx) + SQL_BLANK + realTableName; - } - } - } - return _sql; - } + public String outPutSQL(String sql, SQLStruct sqlStruct, SQLInfo sqlInfo, + ParsedTableInfo parsedTableInfo) { + List list = new ArrayList(); + List newList = new ArrayList(); + String realTableName; + for (String tableName : sqlStruct.getTableNames()) { + realTableName = parsedTableInfo.getRealTable(tableName); + if (realTableName != null) { + String alias = sqlStruct.getAliasByTableName(tableName); + boolean isSame = alias != null && alias.endsWith(tableName); + if (!isSame) { + list.add(SQL_BLANK + tableName + "."); + newList.add(SQL_BLANK + realTableName + "."); + } + list.add(SQL_BLANK + tableName + SQL_BLANK); + newList.add(SQL_BLANK + realTableName + SQL_BLANK); + list.add(SQL_BLANK + tableName + "("); + newList.add(" " + realTableName + "("); + list.add("," + tableName + SQL_BLANK); + newList.add("," + realTableName + SQL_BLANK); + } + } + String fmtSql = sql.replaceAll("\\. {1,}", "\\.").trim(); + String _sql = StringUtils.replaceEach(fmtSql, + list.toArray(new String[list.size()]), + newList.toArray(new String[newList.size()])); + // 解决sql结束字符串为表名,无法解析的问题例如 delete form user + String str; + for (String tableName : sqlStruct.getTableNames()) { + realTableName = parsedTableInfo.getRealTable(tableName); + if (realTableName != null) { + str = SQL_BLANK + tableName; + int idx = _sql.lastIndexOf(str); + if (idx == -1) { + continue; + } + if (_sql.substring(idx).equals(str)) { + _sql = _sql.substring(0, idx) + SQL_BLANK + realTableName; + } + } + } + return _sql; + } } diff --git a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLLexer.java b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLLexer.java index 49ef4b2..5db7297 100644 --- a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLLexer.java +++ b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLLexer.java @@ -1,2289 +1,2484 @@ package halo.dal.analysis.antlr.v3; -// $ANTLR 3.4 /Users/akwei/antlrpro/sql2/AntlrV3SQL.g 2012-07-18 22:36:23 -import org.antlr.runtime.*; -import java.util.Stack; -import java.util.List; -import java.util.ArrayList; +// $ANTLR 3.4 /Users/akwei/antlrpro/sql2/AntlrV3SQL.g 2012-09-30 22:04:52 +import org.antlr.runtime.BaseRecognizer; +import org.antlr.runtime.CharStream; +import org.antlr.runtime.DFA; +import org.antlr.runtime.EarlyExitException; +import org.antlr.runtime.Lexer; +import org.antlr.runtime.MismatchedSetException; +import org.antlr.runtime.RecognitionException; +import org.antlr.runtime.RecognizerSharedState; @SuppressWarnings({ "all", "warnings", "unchecked" }) public class AntlrV3SQLLexer extends Lexer { - public static final int EOF = -1; + public static final int EOF = -1; - public static final int T__62 = 62; + public static final int T__64 = 64; - public static final int T__63 = 63; + public static final int T__65 = 65; - public static final int T__64 = 64; + public static final int T__66 = 66; - public static final int T__65 = 65; + public static final int T__67 = 67; - public static final int T__66 = 66; + public static final int T__68 = 68; - public static final int T__67 = 67; + public static final int T__69 = 69; - public static final int T__68 = 68; + public static final int T__70 = 70; - public static final int T__69 = 69; + public static final int T__71 = 71; - public static final int T__70 = 70; + public static final int T__72 = 72; - public static final int T__71 = 71; + public static final int T__73 = 73; - public static final int T__72 = 72; + public static final int T__74 = 74; - public static final int T__73 = 73; + public static final int T__75 = 75; - public static final int A = 4; + public static final int A = 4; - public static final int AND = 5; + public static final int AND = 5; - public static final int AS = 6; + public static final int AS = 6; - public static final int ASC = 7; + public static final int ASC = 7; - public static final int B = 8; + public static final int B = 8; - public static final int BASIC_NAME = 9; + public static final int BASIC_NAME = 9; - public static final int BETWEEN = 10; + public static final int BETWEEN = 10; - public static final int BY = 11; + public static final int BY = 11; - public static final int C = 12; + public static final int C = 12; - public static final int CROSS = 13; + public static final int CROSS = 13; - public static final int D = 14; + public static final int D = 14; - public static final int DELETE = 15; + public static final int DELETE = 15; - public static final int DESC = 16; + public static final int DESC = 16; - public static final int E = 17; + public static final int E = 17; - public static final int EXISTS = 18; + public static final int EXISTS = 18; - public static final int F = 19; + public static final int F = 19; - public static final int FROM = 20; + public static final int FROM = 20; - public static final int FULL = 21; + public static final int FULL = 21; - public static final int G = 22; + public static final int G = 22; - public static final int GROUP = 23; + public static final int GROUP = 23; - public static final int H = 24; + public static final int H = 24; - public static final int HAVING = 25; + public static final int HAVING = 25; - public static final int I = 26; + public static final int I = 26; - public static final int IN = 27; + public static final int IN = 27; - public static final int INNER = 28; + public static final int INNER = 28; - public static final int INSERT = 29; + public static final int INSERT = 29; - public static final int INTO = 30; + public static final int INTO = 30; - public static final int J = 31; + public static final int J = 31; - public static final int JOIN = 32; + public static final int JOIN = 32; - public static final int K = 33; + public static final int K = 33; - public static final int L = 34; + public static final int L = 34; - public static final int LEFT = 35; + public static final int LEFT = 35; - public static final int M = 36; + public static final int M = 36; - public static final int N = 37; + public static final int N = 37; - public static final int O = 38; + public static final int O = 38; - public static final int ON = 39; + public static final int ON = 39; - public static final int OR = 40; + public static final int OR = 40; - public static final int ORDER = 41; + public static final int ORDER = 41; - public static final int P = 42; + public static final int OVER = 42; - public static final int PRE_SET = 43; + public static final int P = 43; - public static final int Q = 44; + public static final int PRE_SET = 44; - public static final int R = 45; + public static final int Q = 45; - public static final int RIGHT = 46; + public static final int R = 46; - public static final int S = 47; + public static final int RIGHT = 47; - public static final int SELECT = 48; + public static final int ROWNUMBER = 48; - public static final int SET = 49; + public static final int S = 49; - public static final int T = 50; + public static final int SELECT = 50; - public static final int TEXT_STRING = 51; + public static final int SET = 51; - public static final int U = 52; + public static final int T = 52; - public static final int UPDATE = 53; + public static final int TEXT_STRING = 53; - public static final int V = 54; + public static final int U = 54; - public static final int VALUES = 55; + public static final int UPDATE = 55; - public static final int W = 56; + public static final int V = 56; - public static final int WHERE = 57; + public static final int VALUES = 57; - public static final int WS = 58; + public static final int W = 58; - public static final int X = 59; + public static final int WHERE = 59; - public static final int Y = 60; + public static final int WS = 60; - public static final int Z = 61; + public static final int X = 61; - // delegates - // delegators - public Lexer[] getDelegates() { - return new Lexer[] {}; - } + public static final int Y = 62; - public AntlrV3SQLLexer() { - } + public static final int Z = 63; - public AntlrV3SQLLexer(CharStream input) { - this(input, new RecognizerSharedState()); - } + // delegates + // delegators + public Lexer[] getDelegates() { + return new Lexer[] {}; + } - public AntlrV3SQLLexer(CharStream input, RecognizerSharedState state) { - super(input, state); - } + public AntlrV3SQLLexer() { + } - public String getGrammarFileName() { - return "/Users/akwei/antlrpro/sql2/AntlrV3SQL.g"; - } + public AntlrV3SQLLexer(CharStream input) { + this(input, new RecognizerSharedState()); + } - // $ANTLR start "T__62" - public final void mT__62() throws RecognitionException { - try { - int _type = T__62; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:2:7: ( '!=' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:2:9: '!=' - { - match("!="); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__62" - // $ANTLR start "T__63" - public final void mT__63() throws RecognitionException { - try { - int _type = T__63; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:3:7: ( '*' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:3:9: '*' - { - match('*'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__63" - // $ANTLR start "T__64" - public final void mT__64() throws RecognitionException { - try { - int _type = T__64; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:4:7: ( ',' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:4:9: ',' - { - match(','); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__64" - // $ANTLR start "T__65" - public final void mT__65() throws RecognitionException { - try { - int _type = T__65; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:5:7: ( '.' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:5:9: '.' - { - match('.'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__65" - // $ANTLR start "T__66" - public final void mT__66() throws RecognitionException { - try { - int _type = T__66; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:6:7: ( '<' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:6:9: '<' - { - match('<'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__66" - // $ANTLR start "T__67" - public final void mT__67() throws RecognitionException { - try { - int _type = T__67; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:7:7: ( '<=' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:7:9: '<=' - { - match("<="); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__67" - // $ANTLR start "T__68" - public final void mT__68() throws RecognitionException { - try { - int _type = T__68; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:8:7: ( '<>' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:8:9: '<>' - { - match("<>"); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__68" - // $ANTLR start "T__69" - public final void mT__69() throws RecognitionException { - try { - int _type = T__69; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:9:7: ( '=' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:9:9: '=' - { - match('='); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__69" - // $ANTLR start "T__70" - public final void mT__70() throws RecognitionException { - try { - int _type = T__70; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:10:7: ( '>' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:10:9: '>' - { - match('>'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__70" - // $ANTLR start "T__71" - public final void mT__71() throws RecognitionException { - try { - int _type = T__71; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:11:7: ( '>=' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:11:9: '>=' - { - match(">="); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__71" - // $ANTLR start "T__72" - public final void mT__72() throws RecognitionException { - try { - int _type = T__72; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:12:7: ( '\\(' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:12:9: '\\(' - { - match('('); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__72" - // $ANTLR start "T__73" - public final void mT__73() throws RecognitionException { - try { - int _type = T__73; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:13:7: ( '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:13:9: '\\)' - { - match(')'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T__73" - // $ANTLR start "SELECT" - public final void mSELECT() throws RecognitionException { - try { - int _type = SELECT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:236:8: ( S E L E C T ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:236:9: S E L E C T - { - mS(); - mE(); - mL(); - mE(); - mC(); - mT(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "SELECT" - // $ANTLR start "INSERT" - public final void mINSERT() throws RecognitionException { - try { - int _type = INSERT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:237:9: ( I N S E R T ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:237:10: I N S E R T - { - mI(); - mN(); - mS(); - mE(); - mR(); - mT(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "INSERT" - // $ANTLR start "UPDATE" - public final void mUPDATE() throws RecognitionException { - try { - int _type = UPDATE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:238:8: ( U P D A T E ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:238:9: U P D A T E - { - mU(); - mP(); - mD(); - mA(); - mT(); - mE(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "UPDATE" - // $ANTLR start "DELETE" - public final void mDELETE() throws RecognitionException { - try { - int _type = DELETE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:239:8: ( D E L E T E ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:239:9: D E L E T E - { - mD(); - mE(); - mL(); - mE(); - mT(); - mE(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "DELETE" - // $ANTLR start "AND" - public final void mAND() throws RecognitionException { - try { - int _type = AND; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:240:5: ( A N D ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:240:6: A N D - { - mA(); - mN(); - mD(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "AND" - // $ANTLR start "OR" - public final void mOR() throws RecognitionException { - try { - int _type = OR; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:241:4: ( O R ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:241:5: O R - { - mO(); - mR(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "OR" - // $ANTLR start "WHERE" - public final void mWHERE() throws RecognitionException { - try { - int _type = WHERE; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:242:7: ( W H E R E ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:242:8: W H E R E - { - mW(); - mH(); - mE(); - mR(); - mE(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "WHERE" - // $ANTLR start "GROUP" - public final void mGROUP() throws RecognitionException { - try { - int _type = GROUP; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:243:7: ( G R O U P ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:243:8: G R O U P - { - mG(); - mR(); - mO(); - mU(); - mP(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "GROUP" - // $ANTLR start "HAVING" - public final void mHAVING() throws RecognitionException { - try { - int _type = HAVING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:244:8: ( H A V I N G ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:244:9: H A V I N G - { - mH(); - mA(); - mV(); - mI(); - mN(); - mG(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "HAVING" - // $ANTLR start "BY" - public final void mBY() throws RecognitionException { - try { - int _type = BY; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:245:4: ( B Y ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:245:5: B Y - { - mB(); - mY(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "BY" - // $ANTLR start "ORDER" - public final void mORDER() throws RecognitionException { - try { - int _type = ORDER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:246:7: ( O R D E R ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:246:8: O R D E R - { - mO(); - mR(); - mD(); - mE(); - mR(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "ORDER" - // $ANTLR start "DESC" - public final void mDESC() throws RecognitionException { - try { - int _type = DESC; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:247:6: ( D E S C ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:247:7: D E S C - { - mD(); - mE(); - mS(); - mC(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "DESC" - // $ANTLR start "ASC" - public final void mASC() throws RecognitionException { - try { - int _type = ASC; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:248:5: ( A S C ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:248:6: A S C - { - mA(); - mS(); - mC(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "ASC" - // $ANTLR start "SET" - public final void mSET() throws RecognitionException { - try { - int _type = SET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:249:5: ( S E T ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:249:6: S E T - { - mS(); - mE(); - mT(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "SET" - // $ANTLR start "ON" - public final void mON() throws RecognitionException { - try { - int _type = ON; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:250:4: ( O N ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:250:5: O N - { - mO(); - mN(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "ON" - // $ANTLR start "FULL" - public final void mFULL() throws RecognitionException { - try { - int _type = FULL; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:251:6: ( F U L L ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:251:7: F U L L - { - mF(); - mU(); - mL(); - mL(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "FULL" - // $ANTLR start "INNER" - public final void mINNER() throws RecognitionException { - try { - int _type = INNER; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:252:7: ( I N N E R ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:252:8: I N N E R - { - mI(); - mN(); - mN(); - mE(); - mR(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "INNER" - // $ANTLR start "AS" - public final void mAS() throws RecognitionException { - try { - int _type = AS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:253:4: ( A S ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:253:5: A S - { - mA(); - mS(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "AS" - // $ANTLR start "FROM" - public final void mFROM() throws RecognitionException { - try { - int _type = FROM; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:254:6: ( F R O M ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:254:7: F R O M - { - mF(); - mR(); - mO(); - mM(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "FROM" - // $ANTLR start "LEFT" - public final void mLEFT() throws RecognitionException { - try { - int _type = LEFT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:255:6: ( L E F T ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:255:7: L E F T - { - mL(); - mE(); - mF(); - mT(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "LEFT" - // $ANTLR start "RIGHT" - public final void mRIGHT() throws RecognitionException { - try { - int _type = RIGHT; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:256:7: ( R I G H T ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:256:8: R I G H T - { - mR(); - mI(); - mG(); - mH(); - mT(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "RIGHT" - // $ANTLR start "CROSS" - public final void mCROSS() throws RecognitionException { - try { - int _type = CROSS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:257:7: ( C R O S S ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:257:8: C R O S S - { - mC(); - mR(); - mO(); - mS(); - mS(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "CROSS" - // $ANTLR start "JOIN" - public final void mJOIN() throws RecognitionException { - try { - int _type = JOIN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:258:6: ( J O I N ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:258:7: J O I N - { - mJ(); - mO(); - mI(); - mN(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "JOIN" - // $ANTLR start "VALUES" - public final void mVALUES() throws RecognitionException { - try { - int _type = VALUES; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:259:8: ( V A L U E S ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:259:9: V A L U E S - { - mV(); - mA(); - mL(); - mU(); - mE(); - mS(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "VALUES" - // $ANTLR start "INTO" - public final void mINTO() throws RecognitionException { - try { - int _type = INTO; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:260:6: ( I N T O ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:260:7: I N T O - { - mI(); - mN(); - mT(); - mO(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "INTO" - // $ANTLR start "IN" - public final void mIN() throws RecognitionException { - try { - int _type = IN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:261:4: ( I N ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:261:5: I N - { - mI(); - mN(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "IN" - // $ANTLR start "EXISTS" - public final void mEXISTS() throws RecognitionException { - try { - int _type = EXISTS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:262:8: ( E X I S T S ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:262:9: E X I S T S - { - mE(); - mX(); - mI(); - mS(); - mT(); - mS(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "EXISTS" - // $ANTLR start "BETWEEN" - public final void mBETWEEN() throws RecognitionException { - try { - int _type = BETWEEN; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:263:9: ( B E T W E E N ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:263:10: B E T W E E N - { - mB(); - mE(); - mT(); - mW(); - mE(); - mE(); - mN(); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "BETWEEN" - // $ANTLR start "PRE_SET" - public final void mPRE_SET() throws RecognitionException { - try { - int _type = PRE_SET; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:264:9: ( '?' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:264:10: '?' - { - match('?'); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "PRE_SET" - // $ANTLR start "BASIC_NAME" - public final void mBASIC_NAME() throws RecognitionException { - try { - int _type = BASIC_NAME; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:267:2: ( ( 'a' .. 'z' | - // 'A' .. 'Z' | '0' .. '9' | '_' )+ ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:268:2: ( 'a' .. 'z' | 'A' - // .. 'Z' | '0' .. '9' | '_' )+ - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:268:2: ( 'a' .. 'z' | - // 'A' .. 'Z' | '0' .. '9' | '_' )+ - int cnt1 = 0; - loop1: do { - int alt1 = 2; - int LA1_0 = input.LA(1); - if (((LA1_0 >= '0' && LA1_0 <= '9') - || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { - alt1 = 1; - } - switch (alt1) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if ((input.LA(1) >= '0' && input.LA(1) <= '9') - || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') - || input.LA(1) == '_' - || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - break; - default: - if (cnt1 >= 1) - break loop1; - EarlyExitException eee = new EarlyExitException(1, - input); - throw eee; - } - cnt1++; - } - while (true); - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "BASIC_NAME" - // $ANTLR start "TEXT_STRING" - public final void mTEXT_STRING() throws RecognitionException { - try { - int _type = TEXT_STRING; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:270:12: ( ( '\\'' ( - // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | - // '\\'' '\\'' )* '\\'' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:271:4: ( '\\'' ( options - // {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | '\\'' '\\'' )* - // '\\'' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:271:4: ( '\\'' ( - // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | - // '\\'' '\\'' )* '\\'' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:272:4: '\\'' ( - // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | - // '\\'' '\\'' )* '\\'' - { - match('\''); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:273:5: ( options - // {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | - // '\\'' '\\'' )* - loop2: do { - int alt2 = 3; - int LA2_0 = input.LA(1); - if ((LA2_0 == '\'')) { - int LA2_1 = input.LA(2); - if ((LA2_1 == '\'')) { - alt2 = 2; - } - } - else if (((LA2_0 >= '\u0000' && LA2_0 <= '\t') - || (LA2_0 >= '\u000B' && LA2_0 <= '\f') - || (LA2_0 >= '\u000E' && LA2_0 <= '&') || (LA2_0 >= '(' && LA2_0 <= '\uFFFF'))) { - alt2 = 1; - } - switch (alt2) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:273:30: ~ - // ( '\\'' | '\\r' | '\\n' ) - { - if ((input.LA(1) >= '\u0000' && input.LA(1) <= '\t') - || (input.LA(1) >= '\u000B' && input - .LA(1) <= '\f') - || (input.LA(1) >= '\u000E' && input - .LA(1) <= '&') - || (input.LA(1) >= '(' && input.LA(1) <= '\uFFFF')) { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:273:55: - // '\\'' '\\'' - { - match('\''); - match('\''); - } - break; - default: - break loop2; - } - } - while (true); - match('\''); - } - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "TEXT_STRING" - // $ANTLR start "WS" - public final void mWS() throws RecognitionException { - try { - int _type = WS; - int _channel = DEFAULT_TOKEN_CHANNEL; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:278:5: ( ( ' ' | '\\t' | - // '\\r' | '\\n' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:278:9: ( ' ' | '\\t' | - // '\\r' | '\\n' ) - { - if ((input.LA(1) >= '\t' && input.LA(1) <= '\n') - || input.LA(1) == '\r' || input.LA(1) == ' ') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - _channel = HIDDEN; - } - state.type = _type; - state.channel = _channel; - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "WS" - // $ANTLR start "A" - public final void mA() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:286:11: ( ( 'a' | 'A' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'A' || input.LA(1) == 'a') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "A" - // $ANTLR start "B" - public final void mB() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:287:11: ( ( 'b' | 'B' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'B' || input.LA(1) == 'b') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "B" - // $ANTLR start "C" - public final void mC() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:288:11: ( ( 'c' | 'C' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'C' || input.LA(1) == 'c') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "C" - // $ANTLR start "D" - public final void mD() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:289:11: ( ( 'd' | 'D' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'D' || input.LA(1) == 'd') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "D" - // $ANTLR start "E" - public final void mE() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:290:11: ( ( 'e' | 'E' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'E' || input.LA(1) == 'e') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "E" - // $ANTLR start "F" - public final void mF() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:291:11: ( ( 'f' | 'F' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'F' || input.LA(1) == 'f') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "F" - // $ANTLR start "G" - public final void mG() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:292:11: ( ( 'g' | 'G' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'G' || input.LA(1) == 'g') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "G" - // $ANTLR start "H" - public final void mH() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:293:11: ( ( 'h' | 'H' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'H' || input.LA(1) == 'h') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "H" - // $ANTLR start "I" - public final void mI() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:294:11: ( ( 'i' | 'I' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'I' || input.LA(1) == 'i') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "I" - // $ANTLR start "J" - public final void mJ() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:295:11: ( ( 'j' | 'J' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'J' || input.LA(1) == 'j') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "J" - // $ANTLR start "K" - public final void mK() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:296:11: ( ( 'k' | 'K' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'K' || input.LA(1) == 'k') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "K" - // $ANTLR start "L" - public final void mL() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:297:11: ( ( 'l' | 'L' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'L' || input.LA(1) == 'l') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "L" - // $ANTLR start "M" - public final void mM() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:298:11: ( ( 'm' | 'M' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'M' || input.LA(1) == 'm') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "M" - // $ANTLR start "N" - public final void mN() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:299:11: ( ( 'n' | 'N' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'N' || input.LA(1) == 'n') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "N" - // $ANTLR start "O" - public final void mO() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:300:11: ( ( 'o' | 'O' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'O' || input.LA(1) == 'o') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "O" - // $ANTLR start "P" - public final void mP() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:301:11: ( ( 'p' | 'P' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'P' || input.LA(1) == 'p') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "P" - // $ANTLR start "Q" - public final void mQ() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:302:11: ( ( 'q' | 'Q' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'Q' || input.LA(1) == 'q') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "Q" - // $ANTLR start "R" - public final void mR() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:303:11: ( ( 'r' | 'R' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'R' || input.LA(1) == 'r') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "R" - // $ANTLR start "S" - public final void mS() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:304:11: ( ( 's' | 'S' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'S' || input.LA(1) == 's') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "S" - // $ANTLR start "T" - public final void mT() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:305:11: ( ( 't' | 'T' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'T' || input.LA(1) == 't') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "T" - // $ANTLR start "U" - public final void mU() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:306:11: ( ( 'u' | 'U' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'U' || input.LA(1) == 'u') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "U" - // $ANTLR start "V" - public final void mV() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:307:11: ( ( 'v' | 'V' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'V' || input.LA(1) == 'v') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "V" - // $ANTLR start "W" - public final void mW() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:308:11: ( ( 'w' | 'W' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'W' || input.LA(1) == 'w') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "W" - // $ANTLR start "X" - public final void mX() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:309:11: ( ( 'x' | 'X' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'X' || input.LA(1) == 'x') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "X" - // $ANTLR start "Y" - public final void mY() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:310:11: ( ( 'y' | 'Y' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'Y' || input.LA(1) == 'y') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "Y" - // $ANTLR start "Z" - public final void mZ() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:311:11: ( ( 'z' | 'Z' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == 'Z' || input.LA(1) == 'z') { - input.consume(); - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - recover(mse); - throw mse; - } - } - } - finally { - // do for sure before leaving - } - } - - // $ANTLR end "Z" - public void mTokens() throws RecognitionException { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:8: ( T__62 | T__63 | T__64 - // | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | - // T__73 | SELECT | INSERT | UPDATE | DELETE | AND | OR | WHERE | GROUP - // | HAVING | BY | ORDER | DESC | ASC | SET | ON | FULL | INNER | AS | - // FROM | LEFT | RIGHT | CROSS | JOIN | VALUES | INTO | IN | EXISTS | - // BETWEEN | PRE_SET | BASIC_NAME | TEXT_STRING | WS ) - int alt3 = 44; - alt3 = dfa3.predict(input); - switch (alt3) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:10: T__62 - { - mT__62(); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:16: T__63 - { - mT__63(); - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:22: T__64 - { - mT__64(); - } - break; - case 4: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:28: T__65 - { - mT__65(); - } - break; - case 5: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:34: T__66 - { - mT__66(); - } - break; - case 6: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:40: T__67 - { - mT__67(); - } - break; - case 7: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:46: T__68 - { - mT__68(); - } - break; - case 8: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:52: T__69 - { - mT__69(); - } - break; - case 9: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:58: T__70 - { - mT__70(); - } - break; - case 10: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:64: T__71 - { - mT__71(); - } - break; - case 11: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:70: T__72 - { - mT__72(); - } - break; - case 12: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:76: T__73 - { - mT__73(); - } - break; - case 13: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:82: SELECT - { - mSELECT(); - } - break; - case 14: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:89: INSERT - { - mINSERT(); - } - break; - case 15: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:96: UPDATE - { - mUPDATE(); - } - break; - case 16: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:103: DELETE - { - mDELETE(); - } - break; - case 17: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:110: AND - { - mAND(); - } - break; - case 18: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:114: OR - { - mOR(); - } - break; - case 19: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:117: WHERE - { - mWHERE(); - } - break; - case 20: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:123: GROUP - { - mGROUP(); - } - break; - case 21: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:129: HAVING - { - mHAVING(); - } - break; - case 22: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:136: BY - { - mBY(); - } - break; - case 23: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:139: ORDER - { - mORDER(); - } - break; - case 24: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:145: DESC - { - mDESC(); - } - break; - case 25: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:150: ASC - { - mASC(); - } - break; - case 26: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:154: SET - { - mSET(); - } - break; - case 27: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:158: ON - { - mON(); - } - break; - case 28: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:161: FULL - { - mFULL(); - } - break; - case 29: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:166: INNER - { - mINNER(); - } - break; - case 30: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:172: AS - { - mAS(); - } - break; - case 31: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:175: FROM - { - mFROM(); - } - break; - case 32: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:180: LEFT - { - mLEFT(); - } - break; - case 33: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:185: RIGHT - { - mRIGHT(); - } - break; - case 34: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:191: CROSS - { - mCROSS(); - } - break; - case 35: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:197: JOIN - { - mJOIN(); - } - break; - case 36: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:202: VALUES - { - mVALUES(); - } - break; - case 37: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:209: INTO - { - mINTO(); - } - break; - case 38: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:214: IN - { - mIN(); - } - break; - case 39: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:217: EXISTS - { - mEXISTS(); - } - break; - case 40: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:224: BETWEEN - { - mBETWEEN(); - } - break; - case 41: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:232: PRE_SET - { - mPRE_SET(); - } - break; - case 42: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:240: BASIC_NAME - { - mBASIC_NAME(); - } - break; - case 43: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:251: TEXT_STRING - { - mTEXT_STRING(); - } - break; - case 44: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:263: WS - { - mWS(); - } - break; - } - } - - protected DFA3 dfa3 = new DFA3(this); - - static final String DFA3_eotS = "\5\uffff\1\41\1\uffff\1\43\2\uffff\21\34\11\uffff\1\34\1\73\3\34" - + "\1\103\1\105\1\107\3\34\1\113\12\34\1\126\1\uffff\6\34\1\135\1\uffff" - + "\1\136\1\uffff\1\34\1\uffff\3\34\1\uffff\12\34\1\uffff\2\34\1\157" - + "\2\34\1\162\2\uffff\5\34\1\170\1\171\1\172\2\34\1\175\4\34\1\u0082" - + "\1\uffff\2\34\1\uffff\1\u0085\1\u0086\1\u0087\2\34\3\uffff\1\u008a" - + "\1\u008b\1\uffff\2\34\1\u008e\1\u008f\1\uffff\1\u0090\1\u0091\3" - + "\uffff\1\u0092\1\34\2\uffff\1\u0094\1\u0095\5\uffff\1\u0096\3\uffff"; - - static final String DFA3_eofS = "\u0097\uffff"; - - static final String DFA3_minS = "\1\11\4\uffff\1\75\1\uffff\1\75\2\uffff\1\105\1\116\1\120\1\105" - + "\2\116\1\110\1\122\1\101\1\105\1\122\1\105\1\111\1\122\1\117\1\101" - + "\1\130\11\uffff\1\114\1\60\1\104\1\114\1\104\3\60\1\105\1\117\1" - + "\126\1\60\1\124\1\114\1\117\1\106\1\107\1\117\1\111\1\114\1\111" - + "\1\105\1\60\1\uffff\2\105\1\117\1\101\1\105\1\103\1\60\1\uffff\1" - + "\60\1\uffff\1\105\1\uffff\1\122\1\125\1\111\1\uffff\1\127\1\114" - + "\1\115\1\124\1\110\1\123\1\116\1\125\1\123\1\103\1\uffff\2\122\1" - + "\60\2\124\1\60\2\uffff\1\122\1\105\1\120\1\116\1\105\3\60\1\124" - + "\1\123\1\60\1\105\3\124\1\60\1\uffff\2\105\1\uffff\3\60\1\107\1" - + "\105\3\uffff\2\60\1\uffff\2\123\2\60\1\uffff\2\60\3\uffff\1\60\1" - + "\116\2\uffff\2\60\5\uffff\1\60\3\uffff"; - - static final String DFA3_maxS = "\1\172\4\uffff\1\76\1\uffff\1\75\2\uffff\1\145\1\156\1\160\1\145" - + "\1\163\1\162\1\150\1\162\1\141\1\171\1\165\1\145\1\151\1\162\1\157" - + "\1\141\1\170\11\uffff\1\164\1\172\1\144\1\163\1\144\3\172\1\145" - + "\1\157\1\166\1\172\1\164\1\154\1\157\1\146\1\147\1\157\1\151\1\154" - + "\1\151\1\145\1\172\1\uffff\2\145\1\157\1\141\1\145\1\143\1\172\1" - + "\uffff\1\172\1\uffff\1\145\1\uffff\1\162\1\165\1\151\1\uffff\1\167" - + "\1\154\1\155\1\164\1\150\1\163\1\156\1\165\1\163\1\143\1\uffff\2" - + "\162\1\172\2\164\1\172\2\uffff\1\162\1\145\1\160\1\156\1\145\3\172" - + "\1\164\1\163\1\172\1\145\3\164\1\172\1\uffff\2\145\1\uffff\3\172" - + "\1\147\1\145\3\uffff\2\172\1\uffff\2\163\2\172\1\uffff\2\172\3\uffff" - + "\1\172\1\156\2\uffff\2\172\5\uffff\1\172\3\uffff"; - - static final String DFA3_acceptS = "\1\uffff\1\1\1\2\1\3\1\4\1\uffff\1\10\1\uffff\1\13\1\14\21\uffff" - + "\1\51\1\52\1\53\1\54\1\6\1\7\1\5\1\12\1\11\27\uffff\1\46\7\uffff" - + "\1\36\1\uffff\1\22\1\uffff\1\33\3\uffff\1\26\12\uffff\1\32\6\uffff" - + "\1\21\1\31\20\uffff\1\45\2\uffff\1\30\5\uffff\1\34\1\37\1\40\2\uffff" - + "\1\43\4\uffff\1\35\2\uffff\1\27\1\23\1\24\2\uffff\1\41\1\42\2\uffff" - + "\1\15\1\16\1\17\1\20\1\25\1\uffff\1\44\1\47\1\50"; - - static final String DFA3_specialS = "\u0097\uffff}>"; - - static final String[] DFA3_transitionS = { - "\2\36\2\uffff\1\36\22\uffff\1\36\1\1\5\uffff\1\35\1\10\1\11" - + "\1\2\1\uffff\1\3\1\uffff\1\4\1\uffff\12\34\2\uffff\1\5\1\6\1" - + "\7\1\33\1\uffff\1\16\1\23\1\27\1\15\1\32\1\24\1\21\1\22\1\13" - + "\1\30\1\34\1\25\2\34\1\17\2\34\1\26\1\12\1\34\1\14\1\31\1\20" - + "\3\34\4\uffff\1\34\1\uffff\1\16\1\23\1\27\1\15\1\32\1\24\1\21" - + "\1\22\1\13\1\30\1\34\1\25\2\34\1\17\2\34\1\26\1\12\1\34\1\14" - + "\1\31\1\20\3\34", - "", - "", - "", - "", - "\1\37\1\40", - "", - "\1\42", - "", - "", - "\1\44\37\uffff\1\44", - "\1\45\37\uffff\1\45", - "\1\46\37\uffff\1\46", - "\1\47\37\uffff\1\47", - "\1\50\4\uffff\1\51\32\uffff\1\50\4\uffff\1\51", - "\1\53\3\uffff\1\52\33\uffff\1\53\3\uffff\1\52", - "\1\54\37\uffff\1\54", - "\1\55\37\uffff\1\55", - "\1\56\37\uffff\1\56", - "\1\60\23\uffff\1\57\13\uffff\1\60\23\uffff\1\57", - "\1\62\2\uffff\1\61\34\uffff\1\62\2\uffff\1\61", - "\1\63\37\uffff\1\63", - "\1\64\37\uffff\1\64", - "\1\65\37\uffff\1\65", - "\1\66\37\uffff\1\66", - "\1\67\37\uffff\1\67", - "\1\70\37\uffff\1\70", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "\1\71\7\uffff\1\72\27\uffff\1\71\7\uffff\1\72", - "\12\34\7\uffff\15\34\1\75\4\34\1\74\1\76\6\34\4\uffff\1\34" - + "\1\uffff\15\34\1\75\4\34\1\74\1\76\6\34", - "\1\77\37\uffff\1\77", - "\1\100\6\uffff\1\101\30\uffff\1\100\6\uffff\1\101", - "\1\102\37\uffff\1\102", - "\12\34\7\uffff\2\34\1\104\27\34\4\uffff\1\34\1\uffff\2\34\1" - + "\104\27\34", - "\12\34\7\uffff\3\34\1\106\26\34\4\uffff\1\34\1\uffff\3\34\1" - + "\106\26\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\110\37\uffff\1\110", "\1\111\37\uffff\1\111", - "\1\112\37\uffff\1\112", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\114\37\uffff\1\114", "\1\115\37\uffff\1\115", - "\1\116\37\uffff\1\116", "\1\117\37\uffff\1\117", - "\1\120\37\uffff\1\120", "\1\121\37\uffff\1\121", - "\1\122\37\uffff\1\122", "\1\123\37\uffff\1\123", - "\1\124\37\uffff\1\124", "\1\125\37\uffff\1\125", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\1\127\37\uffff\1\127", "\1\130\37\uffff\1\130", - "\1\131\37\uffff\1\131", "\1\132\37\uffff\1\132", - "\1\133\37\uffff\1\133", "\1\134\37\uffff\1\134", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\1\137\37\uffff\1\137", "", "\1\140\37\uffff\1\140", - "\1\141\37\uffff\1\141", "\1\142\37\uffff\1\142", "", - "\1\143\37\uffff\1\143", "\1\144\37\uffff\1\144", - "\1\145\37\uffff\1\145", "\1\146\37\uffff\1\146", - "\1\147\37\uffff\1\147", "\1\150\37\uffff\1\150", - "\1\151\37\uffff\1\151", "\1\152\37\uffff\1\152", - "\1\153\37\uffff\1\153", "\1\154\37\uffff\1\154", "", - "\1\155\37\uffff\1\155", "\1\156\37\uffff\1\156", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\160\37\uffff\1\160", "\1\161\37\uffff\1\161", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", "", - "\1\163\37\uffff\1\163", "\1\164\37\uffff\1\164", - "\1\165\37\uffff\1\165", "\1\166\37\uffff\1\166", - "\1\167\37\uffff\1\167", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\173\37\uffff\1\173", "\1\174\37\uffff\1\174", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\176\37\uffff\1\176", "\1\177\37\uffff\1\177", - "\1\u0080\37\uffff\1\u0080", "\1\u0081\37\uffff\1\u0081", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\1\u0083\37\uffff\1\u0083", "\1\u0084\37\uffff\1\u0084", "", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\u0088\37\uffff\1\u0088", "\1\u0089\37\uffff\1\u0089", "", "", - "", "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\1\u008c\37\uffff\1\u008c", "\1\u008d\37\uffff\1\u008d", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", "", "", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\1\u0093\37\uffff\1\u0093", "", "", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", - "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", "", "", "", - "", "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", "", "", "" }; - - static final short[] DFA3_eot = DFA.unpackEncodedString(DFA3_eotS); - - static final short[] DFA3_eof = DFA.unpackEncodedString(DFA3_eofS); - - static final char[] DFA3_min = DFA - .unpackEncodedStringToUnsignedChars(DFA3_minS); - - static final char[] DFA3_max = DFA - .unpackEncodedStringToUnsignedChars(DFA3_maxS); - - static final short[] DFA3_accept = DFA.unpackEncodedString(DFA3_acceptS); - - static final short[] DFA3_special = DFA.unpackEncodedString(DFA3_specialS); - - static final short[][] DFA3_transition; - static { - int numStates = DFA3_transitionS.length; - DFA3_transition = new short[numStates][]; - for (int i = 0; i < numStates; i++) { - DFA3_transition[i] = DFA.unpackEncodedString(DFA3_transitionS[i]); - } - } - - class DFA3 extends DFA { - - public DFA3(BaseRecognizer recognizer) { - this.recognizer = recognizer; - this.decisionNumber = 3; - this.eot = DFA3_eot; - this.eof = DFA3_eof; - this.min = DFA3_min; - this.max = DFA3_max; - this.accept = DFA3_accept; - this.special = DFA3_special; - this.transition = DFA3_transition; - } - - public String getDescription() { - return "1:1: Tokens : ( T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | SELECT | INSERT | UPDATE | DELETE | AND | OR | WHERE | GROUP | HAVING | BY | ORDER | DESC | ASC | SET | ON | FULL | INNER | AS | FROM | LEFT | RIGHT | CROSS | JOIN | VALUES | INTO | IN | EXISTS | BETWEEN | PRE_SET | BASIC_NAME | TEXT_STRING | WS );"; - } - } + public AntlrV3SQLLexer(CharStream input, RecognizerSharedState state) { + super(input, state); + } + + public String getGrammarFileName() { + return "/Users/akwei/antlrpro/sql2/AntlrV3SQL.g"; + } + + // $ANTLR start "T__64" + public final void mT__64() throws RecognitionException { + try { + int _type = T__64; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:2:7: ( '!=' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:2:9: '!=' + { + match("!="); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__64" + // $ANTLR start "T__65" + public final void mT__65() throws RecognitionException { + try { + int _type = T__65; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:3:7: ( '*' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:3:9: '*' + { + match('*'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__65" + // $ANTLR start "T__66" + public final void mT__66() throws RecognitionException { + try { + int _type = T__66; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:4:7: ( ',' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:4:9: ',' + { + match(','); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__66" + // $ANTLR start "T__67" + public final void mT__67() throws RecognitionException { + try { + int _type = T__67; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:5:7: ( '.' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:5:9: '.' + { + match('.'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__67" + // $ANTLR start "T__68" + public final void mT__68() throws RecognitionException { + try { + int _type = T__68; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:6:7: ( '<' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:6:9: '<' + { + match('<'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__68" + // $ANTLR start "T__69" + public final void mT__69() throws RecognitionException { + try { + int _type = T__69; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:7:7: ( '<=' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:7:9: '<=' + { + match("<="); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__69" + // $ANTLR start "T__70" + public final void mT__70() throws RecognitionException { + try { + int _type = T__70; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:8:7: ( '<>' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:8:9: '<>' + { + match("<>"); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__70" + // $ANTLR start "T__71" + public final void mT__71() throws RecognitionException { + try { + int _type = T__71; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:9:7: ( '=' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:9:9: '=' + { + match('='); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__71" + // $ANTLR start "T__72" + public final void mT__72() throws RecognitionException { + try { + int _type = T__72; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:10:7: ( '>' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:10:9: '>' + { + match('>'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__72" + // $ANTLR start "T__73" + public final void mT__73() throws RecognitionException { + try { + int _type = T__73; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:11:7: ( '>=' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:11:9: '>=' + { + match(">="); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__73" + // $ANTLR start "T__74" + public final void mT__74() throws RecognitionException { + try { + int _type = T__74; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:12:7: ( '\\(' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:12:9: '\\(' + { + match('('); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__74" + // $ANTLR start "T__75" + public final void mT__75() throws RecognitionException { + try { + int _type = T__75; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:13:7: ( '\\)' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:13:9: '\\)' + { + match(')'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T__75" + // $ANTLR start "SELECT" + public final void mSELECT() throws RecognitionException { + try { + int _type = SELECT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:185:8: ( S E L E C T ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:185:9: S E L E C T + { + mS(); + mE(); + mL(); + mE(); + mC(); + mT(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "SELECT" + // $ANTLR start "INSERT" + public final void mINSERT() throws RecognitionException { + try { + int _type = INSERT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:186:9: ( I N S E R T ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:186:10: I N S E R T + { + mI(); + mN(); + mS(); + mE(); + mR(); + mT(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "INSERT" + // $ANTLR start "UPDATE" + public final void mUPDATE() throws RecognitionException { + try { + int _type = UPDATE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:8: ( U P D A T E ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:9: U P D A T E + { + mU(); + mP(); + mD(); + mA(); + mT(); + mE(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "UPDATE" + // $ANTLR start "DELETE" + public final void mDELETE() throws RecognitionException { + try { + int _type = DELETE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:188:8: ( D E L E T E ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:188:9: D E L E T E + { + mD(); + mE(); + mL(); + mE(); + mT(); + mE(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "DELETE" + // $ANTLR start "ROWNUMBER" + public final void mROWNUMBER() throws RecognitionException { + try { + int _type = ROWNUMBER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:190:2: ( R O W N U M B E + // R ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:190:3: R O W N U M B E R + { + mR(); + mO(); + mW(); + mN(); + mU(); + mM(); + mB(); + mE(); + mR(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "ROWNUMBER" + // $ANTLR start "OVER" + public final void mOVER() throws RecognitionException { + try { + int _type = OVER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:191:6: ( O V E R ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:191:7: O V E R + { + mO(); + mV(); + mE(); + mR(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "OVER" + // $ANTLR start "BETWEEN" + public final void mBETWEEN() throws RecognitionException { + try { + int _type = BETWEEN; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:192:9: ( B E T W E E N ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:192:10: B E T W E E N + { + mB(); + mE(); + mT(); + mW(); + mE(); + mE(); + mN(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "BETWEEN" + // $ANTLR start "AND" + public final void mAND() throws RecognitionException { + try { + int _type = AND; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:193:5: ( A N D ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:193:6: A N D + { + mA(); + mN(); + mD(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "AND" + // $ANTLR start "OR" + public final void mOR() throws RecognitionException { + try { + int _type = OR; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:194:4: ( O R ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:194:5: O R + { + mO(); + mR(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "OR" + // $ANTLR start "WHERE" + public final void mWHERE() throws RecognitionException { + try { + int _type = WHERE; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:195:7: ( W H E R E ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:195:8: W H E R E + { + mW(); + mH(); + mE(); + mR(); + mE(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "WHERE" + // $ANTLR start "GROUP" + public final void mGROUP() throws RecognitionException { + try { + int _type = GROUP; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:196:7: ( G R O U P ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:196:8: G R O U P + { + mG(); + mR(); + mO(); + mU(); + mP(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "GROUP" + // $ANTLR start "HAVING" + public final void mHAVING() throws RecognitionException { + try { + int _type = HAVING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:197:8: ( H A V I N G ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:197:9: H A V I N G + { + mH(); + mA(); + mV(); + mI(); + mN(); + mG(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "HAVING" + // $ANTLR start "BY" + public final void mBY() throws RecognitionException { + try { + int _type = BY; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:198:4: ( B Y ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:198:5: B Y + { + mB(); + mY(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "BY" + // $ANTLR start "ORDER" + public final void mORDER() throws RecognitionException { + try { + int _type = ORDER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:199:7: ( O R D E R ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:199:8: O R D E R + { + mO(); + mR(); + mD(); + mE(); + mR(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "ORDER" + // $ANTLR start "DESC" + public final void mDESC() throws RecognitionException { + try { + int _type = DESC; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:200:6: ( D E S C ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:200:7: D E S C + { + mD(); + mE(); + mS(); + mC(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "DESC" + // $ANTLR start "ASC" + public final void mASC() throws RecognitionException { + try { + int _type = ASC; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:201:5: ( A S C ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:201:6: A S C + { + mA(); + mS(); + mC(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "ASC" + // $ANTLR start "SET" + public final void mSET() throws RecognitionException { + try { + int _type = SET; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:202:5: ( S E T ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:202:6: S E T + { + mS(); + mE(); + mT(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "SET" + // $ANTLR start "ON" + public final void mON() throws RecognitionException { + try { + int _type = ON; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:203:4: ( O N ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:203:5: O N + { + mO(); + mN(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "ON" + // $ANTLR start "FULL" + public final void mFULL() throws RecognitionException { + try { + int _type = FULL; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:204:6: ( F U L L ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:204:7: F U L L + { + mF(); + mU(); + mL(); + mL(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "FULL" + // $ANTLR start "INNER" + public final void mINNER() throws RecognitionException { + try { + int _type = INNER; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:205:7: ( I N N E R ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:205:8: I N N E R + { + mI(); + mN(); + mN(); + mE(); + mR(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "INNER" + // $ANTLR start "AS" + public final void mAS() throws RecognitionException { + try { + int _type = AS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:206:4: ( A S ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:206:5: A S + { + mA(); + mS(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "AS" + // $ANTLR start "FROM" + public final void mFROM() throws RecognitionException { + try { + int _type = FROM; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:6: ( F R O M ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:7: F R O M + { + mF(); + mR(); + mO(); + mM(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "FROM" + // $ANTLR start "LEFT" + public final void mLEFT() throws RecognitionException { + try { + int _type = LEFT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:208:6: ( L E F T ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:208:7: L E F T + { + mL(); + mE(); + mF(); + mT(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "LEFT" + // $ANTLR start "RIGHT" + public final void mRIGHT() throws RecognitionException { + try { + int _type = RIGHT; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:209:7: ( R I G H T ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:209:8: R I G H T + { + mR(); + mI(); + mG(); + mH(); + mT(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "RIGHT" + // $ANTLR start "CROSS" + public final void mCROSS() throws RecognitionException { + try { + int _type = CROSS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:210:7: ( C R O S S ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:210:8: C R O S S + { + mC(); + mR(); + mO(); + mS(); + mS(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "CROSS" + // $ANTLR start "JOIN" + public final void mJOIN() throws RecognitionException { + try { + int _type = JOIN; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:211:6: ( J O I N ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:211:7: J O I N + { + mJ(); + mO(); + mI(); + mN(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "JOIN" + // $ANTLR start "VALUES" + public final void mVALUES() throws RecognitionException { + try { + int _type = VALUES; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:212:8: ( V A L U E S ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:212:9: V A L U E S + { + mV(); + mA(); + mL(); + mU(); + mE(); + mS(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "VALUES" + // $ANTLR start "INTO" + public final void mINTO() throws RecognitionException { + try { + int _type = INTO; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:213:6: ( I N T O ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:213:7: I N T O + { + mI(); + mN(); + mT(); + mO(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "INTO" + // $ANTLR start "IN" + public final void mIN() throws RecognitionException { + try { + int _type = IN; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:214:4: ( I N ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:214:5: I N + { + mI(); + mN(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "IN" + // $ANTLR start "EXISTS" + public final void mEXISTS() throws RecognitionException { + try { + int _type = EXISTS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:215:8: ( E X I S T S ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:215:9: E X I S T S + { + mE(); + mX(); + mI(); + mS(); + mT(); + mS(); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "EXISTS" + // $ANTLR start "PRE_SET" + public final void mPRE_SET() throws RecognitionException { + try { + int _type = PRE_SET; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:216:9: ( '?' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:216:10: '?' + { + match('?'); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "PRE_SET" + // $ANTLR start "BASIC_NAME" + public final void mBASIC_NAME() throws RecognitionException { + try { + int _type = BASIC_NAME; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:219:2: ( ( 'a' .. 'z' | + // 'A' .. 'Z' | '0' .. '9' | '_' )+ ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:220:2: ( 'a' .. 'z' | 'A' + // .. 'Z' | '0' .. '9' | '_' )+ + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:220:2: ( 'a' .. 'z' | + // 'A' .. 'Z' | '0' .. '9' | '_' )+ + int cnt1 = 0; + loop1: do { + int alt1 = 2; + int LA1_0 = input.LA(1); + if (((LA1_0 >= '0' && LA1_0 <= '9') + || (LA1_0 >= 'A' && LA1_0 <= 'Z') || LA1_0 == '_' || (LA1_0 >= 'a' && LA1_0 <= 'z'))) { + alt1 = 1; + } + switch (alt1) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if ((input.LA(1) >= '0' && input.LA(1) <= '9') + || (input.LA(1) >= 'A' && input.LA(1) <= 'Z') + || input.LA(1) == '_' + || (input.LA(1) >= 'a' && input.LA(1) <= 'z')) { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + break; + default: + if (cnt1 >= 1) + break loop1; + EarlyExitException eee = + new EarlyExitException(1, input); + throw eee; + } + cnt1++; + } + while (true); + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "BASIC_NAME" + // $ANTLR start "TEXT_STRING" + public final void mTEXT_STRING() throws RecognitionException { + try { + int _type = TEXT_STRING; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:222:12: ( ( '\\'' ( + // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | + // '\\'' '\\'' )* '\\'' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:223:4: ( '\\'' ( options + // {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | '\\'' '\\'' )* + // '\\'' ) + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:223:4: ( '\\'' ( + // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | + // '\\'' '\\'' )* '\\'' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:223:5: '\\'' ( + // options {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | + // '\\'' '\\'' )* '\\'' + { + match('\''); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:224:5: ( options + // {greedy=true; } :~ ( '\\'' | '\\r' | '\\n' ) | + // '\\'' '\\'' )* + loop2: do { + int alt2 = 3; + int LA2_0 = input.LA(1); + if ((LA2_0 == '\'')) { + int LA2_1 = input.LA(2); + if ((LA2_1 == '\'')) { + alt2 = 2; + } + } + else if (((LA2_0 >= '\u0000' && LA2_0 <= '\t') + || (LA2_0 >= '\u000B' && LA2_0 <= '\f') + || (LA2_0 >= '\u000E' && LA2_0 <= '&') || (LA2_0 >= '(' && LA2_0 <= '\uFFFF'))) { + alt2 = 1; + } + switch (alt2) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:31: ~ ( + // '\\'' | '\\r' | '\\n' ) + { + if ((input.LA(1) >= '\u0000' && input.LA(1) <= '\t') + || (input.LA(1) >= '\u000B' && input.LA(1) <= '\f') + || (input.LA(1) >= '\u000E' && input.LA(1) <= '&') + || (input.LA(1) >= '(' && input.LA(1) <= '\uFFFF')) { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:56: + // '\\'' '\\'' + { + match('\''); + match('\''); + } + break; + default: + break loop2; + } + } + while (true); + match('\''); + } + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "TEXT_STRING" + // $ANTLR start "WS" + public final void mWS() throws RecognitionException { + try { + int _type = WS; + int _channel = DEFAULT_TOKEN_CHANNEL; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:231:5: ( ( ' ' | '\\t' | + // '\\r' | '\\n' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:231:9: ( ' ' | '\\t' | + // '\\r' | '\\n' ) + { + if ((input.LA(1) >= '\t' && input.LA(1) <= '\n') + || input.LA(1) == '\r' || input.LA(1) == ' ') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + _channel = HIDDEN; + } + state.type = _type; + state.channel = _channel; + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "WS" + // $ANTLR start "A" + public final void mA() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:239:11: ( ( 'a' | 'A' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'A' || input.LA(1) == 'a') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "A" + // $ANTLR start "B" + public final void mB() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:240:11: ( ( 'b' | 'B' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'B' || input.LA(1) == 'b') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "B" + // $ANTLR start "C" + public final void mC() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:241:11: ( ( 'c' | 'C' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'C' || input.LA(1) == 'c') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "C" + // $ANTLR start "D" + public final void mD() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:242:11: ( ( 'd' | 'D' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'D' || input.LA(1) == 'd') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "D" + // $ANTLR start "E" + public final void mE() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:243:11: ( ( 'e' | 'E' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'E' || input.LA(1) == 'e') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "E" + // $ANTLR start "F" + public final void mF() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:244:11: ( ( 'f' | 'F' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'F' || input.LA(1) == 'f') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "F" + // $ANTLR start "G" + public final void mG() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:245:11: ( ( 'g' | 'G' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'G' || input.LA(1) == 'g') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "G" + // $ANTLR start "H" + public final void mH() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:246:11: ( ( 'h' | 'H' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'H' || input.LA(1) == 'h') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "H" + // $ANTLR start "I" + public final void mI() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:247:11: ( ( 'i' | 'I' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'I' || input.LA(1) == 'i') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "I" + // $ANTLR start "J" + public final void mJ() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:248:11: ( ( 'j' | 'J' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'J' || input.LA(1) == 'j') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "J" + // $ANTLR start "K" + public final void mK() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:249:11: ( ( 'k' | 'K' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'K' || input.LA(1) == 'k') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "K" + // $ANTLR start "L" + public final void mL() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:250:11: ( ( 'l' | 'L' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'L' || input.LA(1) == 'l') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "L" + // $ANTLR start "M" + public final void mM() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:251:11: ( ( 'm' | 'M' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'M' || input.LA(1) == 'm') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "M" + // $ANTLR start "N" + public final void mN() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:252:11: ( ( 'n' | 'N' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'N' || input.LA(1) == 'n') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "N" + // $ANTLR start "O" + public final void mO() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:253:11: ( ( 'o' | 'O' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'O' || input.LA(1) == 'o') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "O" + // $ANTLR start "P" + public final void mP() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:254:11: ( ( 'p' | 'P' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'P' || input.LA(1) == 'p') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "P" + // $ANTLR start "Q" + public final void mQ() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:255:11: ( ( 'q' | 'Q' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'Q' || input.LA(1) == 'q') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "Q" + // $ANTLR start "R" + public final void mR() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:256:11: ( ( 'r' | 'R' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'R' || input.LA(1) == 'r') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "R" + // $ANTLR start "S" + public final void mS() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:257:11: ( ( 's' | 'S' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'S' || input.LA(1) == 's') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "S" + // $ANTLR start "T" + public final void mT() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:258:11: ( ( 't' | 'T' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'T' || input.LA(1) == 't') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "T" + // $ANTLR start "U" + public final void mU() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:259:11: ( ( 'u' | 'U' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'U' || input.LA(1) == 'u') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "U" + // $ANTLR start "V" + public final void mV() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:260:11: ( ( 'v' | 'V' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'V' || input.LA(1) == 'v') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "V" + // $ANTLR start "W" + public final void mW() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:261:11: ( ( 'w' | 'W' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'W' || input.LA(1) == 'w') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "W" + // $ANTLR start "X" + public final void mX() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:262:11: ( ( 'x' | 'X' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'X' || input.LA(1) == 'x') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "X" + // $ANTLR start "Y" + public final void mY() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:263:11: ( ( 'y' | 'Y' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'Y' || input.LA(1) == 'y') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "Y" + // $ANTLR start "Z" + public final void mZ() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:264:11: ( ( 'z' | 'Z' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == 'Z' || input.LA(1) == 'z') { + input.consume(); + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + recover(mse); + throw mse; + } + } + } + finally { + // do for sure before leaving + } + } + + // $ANTLR end "Z" + public void mTokens() throws RecognitionException { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:8: ( T__64 | T__65 | T__66 + // | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | + // T__75 | SELECT | INSERT | UPDATE | DELETE | ROWNUMBER | OVER | + // BETWEEN | AND | OR | WHERE | GROUP | HAVING | BY | ORDER | DESC | ASC + // | SET | ON | FULL | INNER | AS | FROM | LEFT | RIGHT | CROSS | JOIN | + // VALUES | INTO | IN | EXISTS | PRE_SET | BASIC_NAME | TEXT_STRING | WS + // ) + int alt3 = 46; + alt3 = dfa3.predict(input); + switch (alt3) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:10: T__64 + { + mT__64(); + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:16: T__65 + { + mT__65(); + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:22: T__66 + { + mT__66(); + } + break; + case 4: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:28: T__67 + { + mT__67(); + } + break; + case 5: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:34: T__68 + { + mT__68(); + } + break; + case 6: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:40: T__69 + { + mT__69(); + } + break; + case 7: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:46: T__70 + { + mT__70(); + } + break; + case 8: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:52: T__71 + { + mT__71(); + } + break; + case 9: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:58: T__72 + { + mT__72(); + } + break; + case 10: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:64: T__73 + { + mT__73(); + } + break; + case 11: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:70: T__74 + { + mT__74(); + } + break; + case 12: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:76: T__75 + { + mT__75(); + } + break; + case 13: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:82: SELECT + { + mSELECT(); + } + break; + case 14: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:89: INSERT + { + mINSERT(); + } + break; + case 15: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:96: UPDATE + { + mUPDATE(); + } + break; + case 16: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:103: DELETE + { + mDELETE(); + } + break; + case 17: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:110: ROWNUMBER + { + mROWNUMBER(); + } + break; + case 18: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:120: OVER + { + mOVER(); + } + break; + case 19: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:125: BETWEEN + { + mBETWEEN(); + } + break; + case 20: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:133: AND + { + mAND(); + } + break; + case 21: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:137: OR + { + mOR(); + } + break; + case 22: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:140: WHERE + { + mWHERE(); + } + break; + case 23: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:146: GROUP + { + mGROUP(); + } + break; + case 24: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:152: HAVING + { + mHAVING(); + } + break; + case 25: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:159: BY + { + mBY(); + } + break; + case 26: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:162: ORDER + { + mORDER(); + } + break; + case 27: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:168: DESC + { + mDESC(); + } + break; + case 28: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:173: ASC + { + mASC(); + } + break; + case 29: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:177: SET + { + mSET(); + } + break; + case 30: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:181: ON + { + mON(); + } + break; + case 31: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:184: FULL + { + mFULL(); + } + break; + case 32: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:189: INNER + { + mINNER(); + } + break; + case 33: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:195: AS + { + mAS(); + } + break; + case 34: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:198: FROM + { + mFROM(); + } + break; + case 35: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:203: LEFT + { + mLEFT(); + } + break; + case 36: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:208: RIGHT + { + mRIGHT(); + } + break; + case 37: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:214: CROSS + { + mCROSS(); + } + break; + case 38: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:220: JOIN + { + mJOIN(); + } + break; + case 39: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:225: VALUES + { + mVALUES(); + } + break; + case 40: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:232: INTO + { + mINTO(); + } + break; + case 41: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:237: IN + { + mIN(); + } + break; + case 42: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:240: EXISTS + { + mEXISTS(); + } + break; + case 43: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:247: PRE_SET + { + mPRE_SET(); + } + break; + case 44: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:255: BASIC_NAME + { + mBASIC_NAME(); + } + break; + case 45: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:266: TEXT_STRING + { + mTEXT_STRING(); + } + break; + case 46: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:1:278: WS + { + mWS(); + } + break; + } + } + + protected DFA3 dfa3 = new DFA3(this); + + static final String DFA3_eotS = + "\5\uffff\1\41\1\uffff\1\43\2\uffff\21\34\11\uffff\1\34\1\75\5\34" + + + "\1\107\1\111\1\34\1\113\1\34\1\115\13\34\1\132\1\uffff\11\34\1\uffff" + + + "\1\34\1\uffff\1\34\1\uffff\1\146\1\uffff\1\147\13\34\1\uffff\2\34" + + + "\1\165\2\34\1\170\2\34\1\173\2\34\2\uffff\3\34\1\u0081\1\u0082\1" + + + "\u0083\1\34\1\u0085\4\34\1\u008a\1\uffff\2\34\1\uffff\1\34\1\u008e" + + + "\1\uffff\1\u008f\1\34\1\u0091\1\u0092\1\34\3\uffff\1\u0094\1\uffff" + + + "\2\34\1\u0097\1\u0098\1\uffff\1\u0099\1\u009a\1\34\2\uffff\1\34" + + + "\2\uffff\1\u009d\1\uffff\1\u009e\1\u009f\4\uffff\1\34\1\u00a1\3" + + + "\uffff\1\34\1\uffff\1\u00a3\1\uffff"; + + static final String DFA3_eofS = + "\u00a4\uffff"; + + static final String DFA3_minS = + "\1\11\4\uffff\1\75\1\uffff\1\75\2\uffff\1\105\1\116\1\120\1\105" + + + "\1\111\1\116\1\105\1\116\1\110\1\122\1\101\1\122\1\105\1\122\1\117" + + + "\1\101\1\130\11\uffff\1\114\1\60\1\104\1\114\1\127\1\107\1\105\2" + + + "\60\1\124\1\60\1\104\1\60\1\105\1\117\1\126\1\114\1\117\1\106\1" + + + "\117\1\111\1\114\1\111\1\105\1\60\1\uffff\2\105\1\117\1\101\1\105" + + + "\1\103\1\116\1\110\1\122\1\uffff\1\105\1\uffff\1\127\1\uffff\1\60" + + + "\1\uffff\1\60\1\122\1\125\1\111\1\114\1\115\1\124\1\123\1\116\1" + + + "\125\1\123\1\103\1\uffff\2\122\1\60\2\124\1\60\1\125\1\124\1\60" + + + "\1\122\1\105\2\uffff\1\105\1\120\1\116\3\60\1\123\1\60\1\105\3\124" + + + "\1\60\1\uffff\2\105\1\uffff\1\115\1\60\1\uffff\1\60\1\105\2\60\1" + + + "\107\3\uffff\1\60\1\uffff\2\123\2\60\1\uffff\2\60\1\102\2\uffff" + + + "\1\116\2\uffff\1\60\1\uffff\2\60\4\uffff\1\105\1\60\3\uffff\1\122" + + + "\1\uffff\1\60\1\uffff"; + + static final String DFA3_maxS = + "\1\172\4\uffff\1\76\1\uffff\1\75\2\uffff\1\145\1\156\1\160\1\145" + + + "\1\157\1\166\1\171\1\163\1\150\1\162\1\141\1\165\1\145\1\162\1\157" + + + "\1\141\1\170\11\uffff\1\164\1\172\1\144\1\163\1\167\1\147\1\145" + + + "\2\172\1\164\1\172\1\144\1\172\1\145\1\157\1\166\1\154\1\157\1\146" + + + "\1\157\1\151\1\154\1\151\1\145\1\172\1\uffff\2\145\1\157\1\141\1" + + + "\145\1\143\1\156\1\150\1\162\1\uffff\1\145\1\uffff\1\167\1\uffff" + + + "\1\172\1\uffff\1\172\1\162\1\165\1\151\1\154\1\155\1\164\1\163\1" + + + "\156\1\165\1\163\1\143\1\uffff\2\162\1\172\2\164\1\172\1\165\1\164" + + + "\1\172\1\162\1\145\2\uffff\1\145\1\160\1\156\3\172\1\163\1\172\1" + + + "\145\3\164\1\172\1\uffff\2\145\1\uffff\1\155\1\172\1\uffff\1\172" + + + "\1\145\2\172\1\147\3\uffff\1\172\1\uffff\2\163\2\172\1\uffff\2\172" + + + "\1\142\2\uffff\1\156\2\uffff\1\172\1\uffff\2\172\4\uffff\1\145\1" + + + "\172\3\uffff\1\162\1\uffff\1\172\1\uffff"; + + static final String DFA3_acceptS = + "\1\uffff\1\1\1\2\1\3\1\4\1\uffff\1\10\1\uffff\1\13\1\14\21\uffff" + + + "\1\53\1\54\1\55\1\56\1\6\1\7\1\5\1\12\1\11\31\uffff\1\51\11\uffff" + + + "\1\25\1\uffff\1\36\1\uffff\1\31\1\uffff\1\41\14\uffff\1\35\13\uffff" + + + "\1\24\1\34\15\uffff\1\50\2\uffff\1\33\2\uffff\1\22\5\uffff\1\37" + + + "\1\42\1\43\1\uffff\1\46\4\uffff\1\40\3\uffff\1\44\1\32\1\uffff\1" + + + "\26\1\27\1\uffff\1\45\2\uffff\1\15\1\16\1\17\1\20\2\uffff\1\30\1" + + + "\47\1\52\1\uffff\1\23\1\uffff\1\21"; + + static final String DFA3_specialS = + "\u00a4\uffff}>"; + + static final String[] DFA3_transitionS = { + "\2\36\2\uffff\1\36\22\uffff\1\36\1\1\5\uffff\1\35\1\10\1\11" + + + "\1\2\1\uffff\1\3\1\uffff\1\4\1\uffff\12\34\2\uffff\1\5\1\6\1" + + + "\7\1\33\1\uffff\1\21\1\20\1\27\1\15\1\32\1\25\1\23\1\24\1\13" + + + "\1\30\1\34\1\26\2\34\1\17\2\34\1\16\1\12\1\34\1\14\1\31\1\22" + + + "\3\34\4\uffff\1\34\1\uffff\1\21\1\20\1\27\1\15\1\32\1\25\1\23" + + + "\1\24\1\13\1\30\1\34\1\26\2\34\1\17\2\34\1\16\1\12\1\34\1\14" + + + "\1\31\1\22\3\34", + "", + "", + "", + "", + "\1\37\1\40", + "", + "\1\42", + "", + "", + "\1\44\37\uffff\1\44", + "\1\45\37\uffff\1\45", + "\1\46\37\uffff\1\46", + "\1\47\37\uffff\1\47", + "\1\51\5\uffff\1\50\31\uffff\1\51\5\uffff\1\50", + "\1\54\3\uffff\1\53\3\uffff\1\52\27\uffff\1\54\3\uffff\1\53" + + "\3\uffff\1\52", + "\1\55\23\uffff\1\56\13\uffff\1\55\23\uffff\1\56", + "\1\57\4\uffff\1\60\32\uffff\1\57\4\uffff\1\60", + "\1\61\37\uffff\1\61", + "\1\62\37\uffff\1\62", + "\1\63\37\uffff\1\63", + "\1\65\2\uffff\1\64\34\uffff\1\65\2\uffff\1\64", + "\1\66\37\uffff\1\66", + "\1\67\37\uffff\1\67", + "\1\70\37\uffff\1\70", + "\1\71\37\uffff\1\71", + "\1\72\37\uffff\1\72", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\1\73\7\uffff\1\74\27\uffff\1\73\7\uffff\1\74", + "\12\34\7\uffff\15\34\1\77\4\34\1\76\1\100\6\34\4\uffff\1\34" + + "\1\uffff\15\34\1\77\4\34\1\76\1\100\6\34", + "\1\101\37\uffff\1\101", + "\1\102\6\uffff\1\103\30\uffff\1\102\6\uffff\1\103", + "\1\104\37\uffff\1\104", + "\1\105\37\uffff\1\105", + "\1\106\37\uffff\1\106", + "\12\34\7\uffff\3\34\1\110\26\34\4\uffff\1\34\1\uffff\3\34\1" + + "\110\26\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\112\37\uffff\1\112", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\114\37\uffff\1\114", + "\12\34\7\uffff\2\34\1\116\27\34\4\uffff\1\34\1\uffff\2\34\1" + + "\116\27\34", + "\1\117\37\uffff\1\117", + "\1\120\37\uffff\1\120", + "\1\121\37\uffff\1\121", + "\1\122\37\uffff\1\122", + "\1\123\37\uffff\1\123", + "\1\124\37\uffff\1\124", + "\1\125\37\uffff\1\125", + "\1\126\37\uffff\1\126", + "\1\127\37\uffff\1\127", + "\1\130\37\uffff\1\130", + "\1\131\37\uffff\1\131", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\1\133\37\uffff\1\133", + "\1\134\37\uffff\1\134", + "\1\135\37\uffff\1\135", + "\1\136\37\uffff\1\136", + "\1\137\37\uffff\1\137", + "\1\140\37\uffff\1\140", + "\1\141\37\uffff\1\141", + "\1\142\37\uffff\1\142", + "\1\143\37\uffff\1\143", + "", + "\1\144\37\uffff\1\144", + "", + "\1\145\37\uffff\1\145", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\150\37\uffff\1\150", + "\1\151\37\uffff\1\151", + "\1\152\37\uffff\1\152", + "\1\153\37\uffff\1\153", + "\1\154\37\uffff\1\154", + "\1\155\37\uffff\1\155", + "\1\156\37\uffff\1\156", + "\1\157\37\uffff\1\157", + "\1\160\37\uffff\1\160", + "\1\161\37\uffff\1\161", + "\1\162\37\uffff\1\162", + "", + "\1\163\37\uffff\1\163", + "\1\164\37\uffff\1\164", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\166\37\uffff\1\166", + "\1\167\37\uffff\1\167", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\171\37\uffff\1\171", + "\1\172\37\uffff\1\172", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\174\37\uffff\1\174", + "\1\175\37\uffff\1\175", + "", + "", + "\1\176\37\uffff\1\176", + "\1\177\37\uffff\1\177", + "\1\u0080\37\uffff\1\u0080", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\u0084\37\uffff\1\u0084", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\u0086\37\uffff\1\u0086", + "\1\u0087\37\uffff\1\u0087", + "\1\u0088\37\uffff\1\u0088", + "\1\u0089\37\uffff\1\u0089", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\1\u008b\37\uffff\1\u008b", + "\1\u008c\37\uffff\1\u008c", + "", + "\1\u008d\37\uffff\1\u008d", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\u0090\37\uffff\1\u0090", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\u0093\37\uffff\1\u0093", + "", + "", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\1\u0095\37\uffff\1\u0095", + "\1\u0096\37\uffff\1\u0096", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\1\u009b\37\uffff\1\u009b", + "", + "", + "\1\u009c\37\uffff\1\u009c", + "", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "", + "", + "", + "\1\u00a0\37\uffff\1\u00a0", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "", + "", + "", + "\1\u00a2\37\uffff\1\u00a2", + "", + "\12\34\7\uffff\32\34\4\uffff\1\34\1\uffff\32\34", + "" + }; + + static final short[] DFA3_eot = DFA.unpackEncodedString(DFA3_eotS); + + static final short[] DFA3_eof = DFA.unpackEncodedString(DFA3_eofS); + + static final char[] DFA3_min = DFA + .unpackEncodedStringToUnsignedChars(DFA3_minS); + + static final char[] DFA3_max = DFA + .unpackEncodedStringToUnsignedChars(DFA3_maxS); + + static final short[] DFA3_accept = DFA.unpackEncodedString(DFA3_acceptS); + + static final short[] DFA3_special = DFA.unpackEncodedString(DFA3_specialS); + + static final short[][] DFA3_transition; + static { + int numStates = DFA3_transitionS.length; + DFA3_transition = new short[numStates][]; + for (int i = 0; i < numStates; i++) { + DFA3_transition[i] = DFA.unpackEncodedString(DFA3_transitionS[i]); + } + } + + class DFA3 extends DFA { + + public DFA3(BaseRecognizer recognizer) { + this.recognizer = recognizer; + this.decisionNumber = 3; + this.eot = DFA3_eot; + this.eof = DFA3_eof; + this.min = DFA3_min; + this.max = DFA3_max; + this.accept = DFA3_accept; + this.special = DFA3_special; + this.transition = DFA3_transition; + } + + public String getDescription() { + return "1:1: Tokens : ( T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | SELECT | INSERT | UPDATE | DELETE | ROWNUMBER | OVER | BETWEEN | AND | OR | WHERE | GROUP | HAVING | BY | ORDER | DESC | ASC | SET | ON | FULL | INNER | AS | FROM | LEFT | RIGHT | CROSS | JOIN | VALUES | INTO | IN | EXISTS | PRE_SET | BASIC_NAME | TEXT_STRING | WS );"; + } + } } \ No newline at end of file diff --git a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLParser.java b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLParser.java index 8bf060b..e9ed5fb 100644 --- a/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLParser.java +++ b/src/main/java/halo/dal/analysis/antlr/v3/AntlrV3SQLParser.java @@ -1,6 +1,6 @@ package halo.dal.analysis.antlr.v3; -// $ANTLR 3.4 /Users/akwei/antlrpro/sql2/AntlrV3SQL.g 2012-07-18 22:36:23 +//$ANTLR 3.4 /Users/akwei/antlrpro/sql2/AntlrV3SQL.g 2012-09-30 22:04:52 import halo.dal.analysis.antlr.AntlrParserDelegate; import org.antlr.runtime.BitSet; @@ -15,3266 +15,2927 @@ @SuppressWarnings({ "all", "warnings", "unchecked" }) public class AntlrV3SQLParser extends Parser { - public static final String[] tokenNames = new String[] { "", - "", "", "", "A", "AND", "AS", "ASC", "B", - "BASIC_NAME", "BETWEEN", "BY", "C", "CROSS", "D", "DELETE", "DESC", - "E", "EXISTS", "F", "FROM", "FULL", "G", "GROUP", "H", "HAVING", - "I", "IN", "INNER", "INSERT", "INTO", "J", "JOIN", "K", "L", - "LEFT", "M", "N", "O", "ON", "OR", "ORDER", "P", "PRE_SET", "Q", - "R", "RIGHT", "S", "SELECT", "SET", "T", "TEXT_STRING", "U", - "UPDATE", "V", "VALUES", "W", "WHERE", "WS", "X", "Y", "Z", "'!='", - "'*'", "','", "'.'", "'<'", "'<='", "'<>'", "'='", "'>'", "'>='", - "'\\('", "'\\)'" }; + public static final String[] tokenNames = new String[] { + "", "", "", "", "A", "AND", "AS", "ASC", + "B", "BASIC_NAME", "BETWEEN", "BY", "C", "CROSS", "D", "DELETE", + "DESC", "E", "EXISTS", "F", "FROM", "FULL", "G", "GROUP", "H", + "HAVING", "I", "IN", "INNER", "INSERT", "INTO", "J", "JOIN", "K", + "L", "LEFT", "M", "N", "O", "ON", "OR", "ORDER", "OVER", "P", + "PRE_SET", "Q", "R", "RIGHT", "ROWNUMBER", "S", "SELECT", "SET", + "T", "TEXT_STRING", "U", "UPDATE", "V", "VALUES", "W", "WHERE", + "WS", "X", "Y", "Z", "'!='", "'*'", "','", "'.'", "'<'", "'<='", + "'<>'", "'='", "'>'", "'>='", "'\\('", "'\\)'" + }; - public static final int EOF = -1; + public static final int EOF = -1; - public static final int T__62 = 62; + public static final int T__64 = 64; - public static final int T__63 = 63; + public static final int T__65 = 65; - public static final int T__64 = 64; + public static final int T__66 = 66; - public static final int T__65 = 65; + public static final int T__67 = 67; - public static final int T__66 = 66; + public static final int T__68 = 68; - public static final int T__67 = 67; + public static final int T__69 = 69; - public static final int T__68 = 68; + public static final int T__70 = 70; - public static final int T__69 = 69; + public static final int T__71 = 71; - public static final int T__70 = 70; + public static final int T__72 = 72; - public static final int T__71 = 71; + public static final int T__73 = 73; - public static final int T__72 = 72; + public static final int T__74 = 74; - public static final int T__73 = 73; + public static final int T__75 = 75; - public static final int A = 4; + public static final int A = 4; - public static final int AND = 5; + public static final int AND = 5; - public static final int AS = 6; + public static final int AS = 6; - public static final int ASC = 7; + public static final int ASC = 7; - public static final int B = 8; + public static final int B = 8; - public static final int BASIC_NAME = 9; + public static final int BASIC_NAME = 9; - public static final int BETWEEN = 10; + public static final int BETWEEN = 10; - public static final int BY = 11; + public static final int BY = 11; - public static final int C = 12; + public static final int C = 12; - public static final int CROSS = 13; + public static final int CROSS = 13; - public static final int D = 14; + public static final int D = 14; - public static final int DELETE = 15; + public static final int DELETE = 15; - public static final int DESC = 16; + public static final int DESC = 16; - public static final int E = 17; + public static final int E = 17; - public static final int EXISTS = 18; + public static final int EXISTS = 18; - public static final int F = 19; + public static final int F = 19; - public static final int FROM = 20; + public static final int FROM = 20; - public static final int FULL = 21; + public static final int FULL = 21; - public static final int G = 22; + public static final int G = 22; - public static final int GROUP = 23; + public static final int GROUP = 23; - public static final int H = 24; + public static final int H = 24; - public static final int HAVING = 25; + public static final int HAVING = 25; - public static final int I = 26; + public static final int I = 26; - public static final int IN = 27; + public static final int IN = 27; - public static final int INNER = 28; + public static final int INNER = 28; - public static final int INSERT = 29; + public static final int INSERT = 29; - public static final int INTO = 30; + public static final int INTO = 30; - public static final int J = 31; + public static final int J = 31; - public static final int JOIN = 32; + public static final int JOIN = 32; - public static final int K = 33; + public static final int K = 33; - public static final int L = 34; + public static final int L = 34; - public static final int LEFT = 35; + public static final int LEFT = 35; - public static final int M = 36; + public static final int M = 36; - public static final int N = 37; + public static final int N = 37; - public static final int O = 38; + public static final int O = 38; - public static final int ON = 39; + public static final int ON = 39; - public static final int OR = 40; + public static final int OR = 40; - public static final int ORDER = 41; + public static final int ORDER = 41; - public static final int P = 42; + public static final int OVER = 42; - public static final int PRE_SET = 43; + public static final int P = 43; - public static final int Q = 44; + public static final int PRE_SET = 44; - public static final int R = 45; + public static final int Q = 45; - public static final int RIGHT = 46; + public static final int R = 46; - public static final int S = 47; + public static final int RIGHT = 47; - public static final int SELECT = 48; + public static final int ROWNUMBER = 48; - public static final int SET = 49; + public static final int S = 49; - public static final int T = 50; + public static final int SELECT = 50; - public static final int TEXT_STRING = 51; + public static final int SET = 51; - public static final int U = 52; + public static final int T = 52; - public static final int UPDATE = 53; + public static final int TEXT_STRING = 53; - public static final int V = 54; + public static final int U = 54; - public static final int VALUES = 55; + public static final int UPDATE = 55; - public static final int W = 56; + public static final int V = 56; - public static final int WHERE = 57; + public static final int VALUES = 57; - public static final int WS = 58; + public static final int W = 58; - public static final int X = 59; + public static final int WHERE = 59; - public static final int Y = 60; + public static final int WS = 60; - public static final int Z = 61; + public static final int X = 61; - // delegates - public Parser[] getDelegates() { - return new Parser[] {}; - } + public static final int Y = 62; - // delegators - public AntlrV3SQLParser(TokenStream input) { - this(input, new RecognizerSharedState()); - } + public static final int Z = 63; - public AntlrV3SQLParser(TokenStream input, RecognizerSharedState state) { - super(input, state); - } + // delegates + public Parser[] getDelegates() { + return new Parser[] {}; + } - public String[] getTokenNames() { - return AntlrV3SQLParser.tokenNames; - } + // delegators + public AntlrV3SQLParser(TokenStream input) { + this(input, new RecognizerSharedState()); + } - public String getGrammarFileName() { - return "/Users/akwei/antlrpro/sql2/AntlrV3SQL.g"; - } - - private AntlrParserDelegate antlrParserDelegate; - - public void setAntlrParserDelegate(AntlrParserDelegate antlrParserDelegate) { - this.antlrParserDelegate = antlrParserDelegate; - } - - @Override - public void reportError(RecognitionException e) { - } - - // $ANTLR start "start" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:17:1: start : ( sql_insert | - // sql_delete | sql_update | sql_select ); - public final void start() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:17:7: ( sql_insert | - // sql_delete | sql_update | sql_select ) - int alt1 = 4; - switch (input.LA(1)) { - case INSERT: { - alt1 = 1; - } - break; - case DELETE: { - alt1 = 2; - } - break; - case UPDATE: { - alt1 = 3; - } - break; - case SELECT: { - alt1 = 4; - } - break; - default: - NoViableAltException nvae = new NoViableAltException("", 1, - 0, input); - throw nvae; - } - switch (alt1) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:18:2: sql_insert - { - pushFollow(FOLLOW_sql_insert_in_start18); - sql_insert(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:18:13: sql_delete - { - pushFollow(FOLLOW_sql_delete_in_start20); - sql_delete(); - state._fsp--; - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:18:24: sql_update - { - pushFollow(FOLLOW_sql_update_in_start22); - sql_update(); - state._fsp--; - } - break; - case 4: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:18:35: sql_select - { - pushFollow(FOLLOW_sql_select_in_start24); - sql_select(); - state._fsp--; - } - break; - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "start" - // $ANTLR start "sql_insert" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:20:1: sql_insert : INSERT INTO - // table '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( - // PRE_SET | ( ',' PRE_SET ) )* '\\)' ; - public final void sql_insert() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:21:2: ( INSERT INTO table - // '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( - // PRE_SET | ( ',' PRE_SET ) )* '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:2: INSERT INTO table - // '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( - // PRE_SET | ( ',' PRE_SET ) )* '\\)' - { - match(input, INSERT, FOLLOW_INSERT_in_sql_insert35); - match(input, INTO, FOLLOW_INTO_in_sql_insert37); - pushFollow(FOLLOW_table_in_sql_insert39); - table(); - state._fsp--; - match(input, 72, FOLLOW_72_in_sql_insert41); - pushFollow(FOLLOW_insertColumn_in_sql_insert43); - insertColumn(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:38: ( ',' - // insertColumn )* - loop2: do { - int alt2 = 2; - int LA2_0 = input.LA(1); - if ((LA2_0 == 64)) { - alt2 = 1; - } - switch (alt2) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:39: ',' - // insertColumn - { - match(input, 64, FOLLOW_64_in_sql_insert46); - pushFollow(FOLLOW_insertColumn_in_sql_insert48); - insertColumn(); - state._fsp--; - } - break; - default: - break loop2; - } - } - while (true); - match(input, 73, FOLLOW_73_in_sql_insert52); - match(input, VALUES, FOLLOW_VALUES_in_sql_insert54); - match(input, 72, FOLLOW_72_in_sql_insert56); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:75: ( PRE_SET | ( - // ',' PRE_SET ) )* - loop3: do { - int alt3 = 3; - int LA3_0 = input.LA(1); - if ((LA3_0 == PRE_SET)) { - alt3 = 1; - } - else if ((LA3_0 == 64)) { - alt3 = 2; - } - switch (alt3) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:76: - // PRE_SET - { - match(input, PRE_SET, - FOLLOW_PRE_SET_in_sql_insert59); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:84: ( ',' - // PRE_SET ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:84: ( - // ',' PRE_SET ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:85: - // ',' PRE_SET - { - match(input, 64, FOLLOW_64_in_sql_insert62); - match(input, PRE_SET, - FOLLOW_PRE_SET_in_sql_insert64); - } - } - break; - default: - break loop3; - } - } - while (true); - match(input, 73, FOLLOW_73_in_sql_insert69); - antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_INSERT); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_insert" - // $ANTLR start "sql_delete" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:28:1: sql_delete : DELETE FROM - // table where ; - public final void sql_delete() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:29:2: ( DELETE FROM table - // where ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:30:2: DELETE FROM table - // where - { - match(input, DELETE, FOLLOW_DELETE_in_sql_delete86); - match(input, FROM, FOLLOW_FROM_in_sql_delete88); - pushFollow(FOLLOW_table_in_sql_delete90); - table(); - state._fsp--; - pushFollow(FOLLOW_where_in_sql_delete92); - where(); - state._fsp--; - antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_DELETE); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_delete" - // $ANTLR start "sql_update" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:36:1: sql_update : UPDATE table - // SET kv ( ',' kv )* where ; - public final void sql_update() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:37:2: ( UPDATE table SET - // kv ( ',' kv )* where ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:2: UPDATE table SET kv - // ( ',' kv )* where - { - match(input, UPDATE, FOLLOW_UPDATE_in_sql_update109); - pushFollow(FOLLOW_table_in_sql_update111); - table(); - state._fsp--; - match(input, SET, FOLLOW_SET_in_sql_update113); - pushFollow(FOLLOW_kv_in_sql_update115); - kv(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:22: ( ',' kv )* - loop4: do { - int alt4 = 2; - int LA4_0 = input.LA(1); - if ((LA4_0 == 64)) { - alt4 = 1; - } - switch (alt4) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:23: ',' kv - { - match(input, 64, FOLLOW_64_in_sql_update118); - pushFollow(FOLLOW_kv_in_sql_update120); - kv(); - state._fsp--; - } - break; - default: - break loop4; - } - } - while (true); - pushFollow(FOLLOW_where_in_sql_update124); - where(); - state._fsp--; - antlrParserDelegate.setSqlOp(AntlrParserDelegate.SQLOP_UPDATE); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_update" - // $ANTLR start "sql_select" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:1: sql_select : SELECT ( func2 - // | select_columns FROM ( ( sql_select_tables where ( orderby | groupby | - // having )* ) | ( '\\(' sql_select '\\)' ) ) ) ; - public final void sql_select() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:45:2: ( SELECT ( func2 | - // select_columns FROM ( ( sql_select_tables where ( orderby | - // groupby | having )* ) | ( '\\(' sql_select '\\)' ) ) ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:46:2: SELECT ( func2 | - // select_columns FROM ( ( sql_select_tables where ( orderby | - // groupby | having )* ) | ( '\\(' sql_select '\\)' ) ) ) - { - match(input, SELECT, FOLLOW_SELECT_in_sql_select141); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:47:2: ( func2 | - // select_columns FROM ( ( sql_select_tables where ( orderby | - // groupby | having )* ) | ( '\\(' sql_select '\\)' ) ) ) - int alt7 = 2; - int LA7_0 = input.LA(1); - if ((LA7_0 == BASIC_NAME)) { - int LA7_1 = input.LA(2); - if ((LA7_1 == 72)) { - switch (input.LA(3)) { - case BASIC_NAME: { - int LA7_4 = input.LA(4); - if ((LA7_4 == 73)) { - int LA7_6 = input.LA(5); - if ((LA7_6 == AS || LA7_6 == BASIC_NAME - || LA7_6 == FROM || LA7_6 == 64)) { - alt7 = 2; - } - else if ((LA7_6 == EOF || LA7_6 == 73)) { - alt7 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 7, 6, input); - throw nvae; - } - } - else if (((LA7_4 >= 64 && LA7_4 <= 65))) { - alt7 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 7, 4, input); - throw nvae; - } - } - break; - case 63: { - alt7 = 2; - } - break; - case TEXT_STRING: - case 73: { - alt7 = 1; - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 7, 3, input); - throw nvae; - } - } - else if ((LA7_1 == AS || LA7_1 == BASIC_NAME - || LA7_1 == FROM || (LA7_1 >= 64 && LA7_1 <= 65))) { - alt7 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 7, 1, input); - throw nvae; - } - } - else if ((LA7_0 == 63)) { - alt7 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException("", 7, - 0, input); - throw nvae; - } - switch (alt7) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:48:3: func2 - { - pushFollow(FOLLOW_func2_in_sql_select149); - func2(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:3: - // select_columns FROM ( ( sql_select_tables where ( orderby - // | groupby | having )* ) | ( '\\(' sql_select '\\)' ) ) - { - pushFollow(FOLLOW_select_columns_in_sql_select157); - select_columns(); - state._fsp--; - match(input, FROM, FOLLOW_FROM_in_sql_select159); - if (antlrParserDelegate != null) - antlrParserDelegate.setHasSelectFrom(true); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:54:3: ( ( - // sql_select_tables where ( orderby | groupby | having - // )* ) | ( '\\(' sql_select '\\)' ) ) - int alt6 = 2; - int LA6_0 = input.LA(1); - if ((LA6_0 == BASIC_NAME)) { - alt6 = 1; - } - else if ((LA6_0 == 72)) { - alt6 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 6, 0, input); - throw nvae; - } - switch (alt6) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:3: ( - // sql_select_tables where ( orderby | groupby | - // having )* ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:3: - // ( sql_select_tables where ( orderby | groupby - // | having )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:4: - // sql_select_tables where ( orderby | groupby | - // having )* - { - pushFollow(FOLLOW_sql_select_tables_in_sql_select173); - sql_select_tables(); - state._fsp--; - pushFollow(FOLLOW_where_in_sql_select175); - where(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:28: - // ( orderby | groupby | having )* - loop5: do { - int alt5 = 4; - switch (input.LA(1)) { - case ORDER: { - alt5 = 1; - } - break; - case GROUP: { - alt5 = 2; - } - break; - case HAVING: { - alt5 = 3; - } - break; - } - switch (alt5) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:29: - // orderby - { - pushFollow(FOLLOW_orderby_in_sql_select178); - orderby(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:37: - // groupby - { - pushFollow(FOLLOW_groupby_in_sql_select180); - groupby(); - state._fsp--; - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:55:45: - // having - { - pushFollow(FOLLOW_having_in_sql_select182); - having(); - state._fsp--; - } - break; - default: - break loop5; - } - } - while (true); - } - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:3: ( - // '\\(' sql_select '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:3: - // ( '\\(' sql_select '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:4: - // '\\(' sql_select '\\)' - { - match(input, 72, FOLLOW_72_in_sql_select194); - pushFollow(FOLLOW_sql_select_in_sql_select196); - sql_select(); - state._fsp--; - match(input, 73, FOLLOW_73_in_sql_select198); - } - } - break; - } - } - break; - } - if (antlrParserDelegate != null) - antlrParserDelegate - .setSqlOp(AntlrParserDelegate.SQLOP_SELECT); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_select" - // $ANTLR start "sql_select_tables" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:65:1: sql_select_tables : tables - // ( ( FULL | CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' - // column_name )? )* ; - public final void sql_select_tables() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:66:2: ( tables ( ( FULL | - // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' - // column_name )? )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:67:2: tables ( ( FULL | - // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' - // column_name )? )* - { - pushFollow(FOLLOW_tables_in_sql_select_tables222); - tables(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:68:2: ( ( FULL | - // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name - // '=' column_name )? )* - loop9: do { - int alt9 = 2; - int LA9_0 = input.LA(1); - if ((LA9_0 == CROSS || LA9_0 == FULL || LA9_0 == INNER - || LA9_0 == LEFT || LA9_0 == RIGHT)) { - alt9 = 1; - } - switch (alt9) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:68:3: ( FULL - // | CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON - // column_name '=' column_name )? - { - if (input.LA(1) == CROSS || input.LA(1) == FULL - || input.LA(1) == INNER - || input.LA(1) == LEFT - || input.LA(1) == RIGHT) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - match(input, JOIN, - FOLLOW_JOIN_in_sql_select_tables239); - pushFollow(FOLLOW_table_in_sql_select_tables241); - table(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:68:44: ( - // ON column_name '=' column_name )? - int alt8 = 2; - int LA8_0 = input.LA(1); - if ((LA8_0 == ON)) { - alt8 = 1; - } - switch (alt8) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:68:45: - // ON column_name '=' column_name - { - match(input, ON, - FOLLOW_ON_in_sql_select_tables244); - pushFollow(FOLLOW_column_name_in_sql_select_tables246); - column_name(); - state._fsp--; - match(input, 69, - FOLLOW_69_in_sql_select_tables248); - pushFollow(FOLLOW_column_name_in_sql_select_tables250); - column_name(); - state._fsp--; - } - break; - } - } - break; - default: - break loop9; - } - } - while (true); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_select_tables" - // $ANTLR start "where" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:71:1: where : ( WHERE - // sql_select_where_kv_all )? ; - public final void where() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:2: ( ( WHERE - // sql_select_where_kv_all )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:73:2: ( WHERE - // sql_select_where_kv_all )? - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:73:2: ( WHERE - // sql_select_where_kv_all )? - int alt10 = 2; - int LA10_0 = input.LA(1); - if ((LA10_0 == WHERE)) { - alt10 = 1; - } - switch (alt10) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:73:3: WHERE - // sql_select_where_kv_all - { - match(input, WHERE, FOLLOW_WHERE_in_where268); - pushFollow(FOLLOW_sql_select_where_kv_all_in_where270); - sql_select_where_kv_all(); - state._fsp--; - } - break; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "where" - // $ANTLR start "sql_select_where_kv" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:76:1: sql_select_where_kv : kv ( - // and_or ( kv | ( '\\(' kv ( and_or sql_select_where_kv ) '\\)' ) | ( - // column_name op '\\(' sql_select '\\)' ) | ( '\\(' column_name op '\\(' - // sql_select '\\)' '\\)' ) ) )* ; - public final void sql_select_where_kv() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:2: ( kv ( and_or ( kv - // | ( '\\(' kv ( and_or sql_select_where_kv ) '\\)' ) | ( - // column_name op '\\(' sql_select '\\)' ) | ( '\\(' column_name op - // '\\(' sql_select '\\)' '\\)' ) ) )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:78:2: kv ( and_or ( kv | - // ( '\\(' kv ( and_or sql_select_where_kv ) '\\)' ) | ( column_name - // op '\\(' sql_select '\\)' ) | ( '\\(' column_name op '\\(' - // sql_select '\\)' '\\)' ) ) )* - { - pushFollow(FOLLOW_kv_in_sql_select_where_kv285); - kv(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:79:2: ( and_or ( kv | - // ( '\\(' kv ( and_or sql_select_where_kv ) '\\)' ) | ( - // column_name op '\\(' sql_select '\\)' ) | ( '\\(' column_name - // op '\\(' sql_select '\\)' '\\)' ) ) )* - loop12: do { - int alt12 = 2; - int LA12_0 = input.LA(1); - if ((LA12_0 == AND || LA12_0 == OR)) { - alt12 = 1; - } - switch (alt12) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:80:2: and_or - // ( kv | ( '\\(' kv ( and_or sql_select_where_kv ) - // '\\)' ) | ( column_name op '\\(' sql_select '\\)' ) | - // ( '\\(' column_name op '\\(' sql_select '\\)' '\\)' ) - // ) - { - pushFollow(FOLLOW_and_or_in_sql_select_where_kv291); - and_or(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:81:3: ( - // kv | ( '\\(' kv ( and_or sql_select_where_kv ) - // '\\)' ) | ( column_name op '\\(' sql_select '\\)' - // ) | ( '\\(' column_name op '\\(' sql_select '\\)' - // '\\)' ) ) - int alt11 = 4; - int LA11_0 = input.LA(1); - if ((LA11_0 == BASIC_NAME)) { - switch (input.LA(2)) { - case 65: { - int LA11_3 = input.LA(3); - if ((LA11_3 == BASIC_NAME)) { - int LA11_7 = input.LA(4); - if ((LA11_7 == EXISTS - || LA11_7 == IN - || LA11_7 == 62 || (LA11_7 >= 66 && LA11_7 <= 71))) { - int LA11_4 = input.LA(5); - if ((LA11_4 == BASIC_NAME - || LA11_4 == PRE_SET || LA11_4 == TEXT_STRING)) { - alt11 = 1; - } - else if ((LA11_4 == 72)) { - int LA11_8 = input.LA(6); - if ((LA11_8 == PRE_SET || LA11_8 == TEXT_STRING)) { - alt11 = 1; - } - else if ((LA11_8 == SELECT)) { - alt11 = 3; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 8, - input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 4, input); - throw nvae; - } - } - else if ((LA11_7 == BETWEEN)) { - alt11 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 7, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 3, input); - throw nvae; - } - } - break; - case EXISTS: - case IN: - case 62: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: { - int LA11_4 = input.LA(3); - if ((LA11_4 == BASIC_NAME - || LA11_4 == PRE_SET || LA11_4 == TEXT_STRING)) { - alt11 = 1; - } - else if ((LA11_4 == 72)) { - int LA11_8 = input.LA(4); - if ((LA11_8 == PRE_SET || LA11_8 == TEXT_STRING)) { - alt11 = 1; - } - else if ((LA11_8 == SELECT)) { - alt11 = 3; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 8, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 4, input); - throw nvae; - } - } - break; - case BETWEEN: { - alt11 = 1; - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 11, 1, input); - throw nvae; - } - } - else if ((LA11_0 == 72)) { - int LA11_2 = input.LA(2); - if ((LA11_2 == BASIC_NAME)) { - switch (input.LA(3)) { - case 65: { - int LA11_9 = input.LA(4); - if ((LA11_9 == BASIC_NAME)) { - int LA11_13 = input.LA(5); - if ((LA11_13 == EXISTS - || LA11_13 == IN - || LA11_13 == 62 || (LA11_13 >= 66 && LA11_13 <= 71))) { - int LA11_10 = input.LA(6); - if ((LA11_10 == BASIC_NAME - || LA11_10 == PRE_SET || LA11_10 == TEXT_STRING)) { - alt11 = 2; - } - else if ((LA11_10 == 72)) { - int LA11_14 = input - .LA(7); - if ((LA11_14 == PRE_SET || LA11_14 == TEXT_STRING)) { - alt11 = 2; - } - else if ((LA11_14 == SELECT)) { - alt11 = 4; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 14, - input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 10, - input); - throw nvae; - } - } - else if ((LA11_13 == BETWEEN)) { - alt11 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 13, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 9, input); - throw nvae; - } - } - break; - case EXISTS: - case IN: - case 62: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: { - int LA11_10 = input.LA(4); - if ((LA11_10 == BASIC_NAME - || LA11_10 == PRE_SET || LA11_10 == TEXT_STRING)) { - alt11 = 2; - } - else if ((LA11_10 == 72)) { - int LA11_14 = input.LA(5); - if ((LA11_14 == PRE_SET || LA11_14 == TEXT_STRING)) { - alt11 = 2; - } - else if ((LA11_14 == SELECT)) { - alt11 = 4; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 14, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 10, input); - throw nvae; - } - } - break; - case BETWEEN: { - alt11 = 2; - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 11, 6, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 2, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 11, 0, input); - throw nvae; - } - switch (alt11) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:82:3: - // kv - { - pushFollow(FOLLOW_kv_in_sql_select_where_kv300); - kv(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:84:3: - // ( '\\(' kv ( and_or sql_select_where_kv ) - // '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:84:3: - // ( '\\(' kv ( and_or sql_select_where_kv ) - // '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:84:4: - // '\\(' kv ( and_or sql_select_where_kv ) - // '\\)' - { - match(input, 72, - FOLLOW_72_in_sql_select_where_kv309); - pushFollow(FOLLOW_kv_in_sql_select_where_kv311); - kv(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:84:12: - // ( and_or sql_select_where_kv ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:84:13: - // and_or sql_select_where_kv - { - pushFollow(FOLLOW_and_or_in_sql_select_where_kv314); - and_or(); - state._fsp--; - pushFollow(FOLLOW_sql_select_where_kv_in_sql_select_where_kv316); - sql_select_where_kv(); - state._fsp--; - } - match(input, 73, - FOLLOW_73_in_sql_select_where_kv319); - } - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:86:3: - // ( column_name op '\\(' sql_select '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:86:3: - // ( column_name op '\\(' sql_select '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:86:4: - // column_name op '\\(' sql_select '\\)' - { - pushFollow(FOLLOW_column_name_in_sql_select_where_kv330); - column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_sql_select_where_kv332); - op(); - state._fsp--; - match(input, 72, - FOLLOW_72_in_sql_select_where_kv334); - pushFollow(FOLLOW_sql_select_in_sql_select_where_kv336); - sql_select(); - state._fsp--; - match(input, 73, - FOLLOW_73_in_sql_select_where_kv338); - } - } - break; - case 4: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:88:3: - // ( '\\(' column_name op '\\(' sql_select '\\)' - // '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:88:3: - // ( '\\(' column_name op '\\(' sql_select - // '\\)' '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:88:4: - // '\\(' column_name op '\\(' sql_select - // '\\)' '\\)' - { - match(input, 72, - FOLLOW_72_in_sql_select_where_kv349); - pushFollow(FOLLOW_column_name_in_sql_select_where_kv351); - column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_sql_select_where_kv353); - op(); - state._fsp--; - match(input, 72, - FOLLOW_72_in_sql_select_where_kv355); - pushFollow(FOLLOW_sql_select_in_sql_select_where_kv357); - sql_select(); - state._fsp--; - match(input, 73, - FOLLOW_73_in_sql_select_where_kv359); - match(input, 73, - FOLLOW_73_in_sql_select_where_kv361); - } - } - break; - } - } - break; - default: - break loop12; - } - } - while (true); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_select_where_kv" - // $ANTLR start "sql_select_where_kv_all" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:93:1: sql_select_where_kv_all : ( - // sql_select_where_kv | ( '\\(' sql_select_where_kv '\\)' ) ); - public final void sql_select_where_kv_all() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:94:2: ( - // sql_select_where_kv | ( '\\(' sql_select_where_kv '\\)' ) ) - int alt13 = 2; - int LA13_0 = input.LA(1); - if ((LA13_0 == BASIC_NAME)) { - alt13 = 1; - } - else if ((LA13_0 == 72)) { - alt13 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException("", 13, 0, - input); - throw nvae; - } - switch (alt13) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:2: - // sql_select_where_kv - { - pushFollow(FOLLOW_sql_select_where_kv_in_sql_select_where_kv_all383); - sql_select_where_kv(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:97:2: ( '\\(' - // sql_select_where_kv '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:97:2: ( '\\(' - // sql_select_where_kv '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:97:3: '\\(' - // sql_select_where_kv '\\)' - { - match(input, 72, - FOLLOW_72_in_sql_select_where_kv_all390); - pushFollow(FOLLOW_sql_select_where_kv_in_sql_select_where_kv_all392); - sql_select_where_kv(); - state._fsp--; - match(input, 73, - FOLLOW_73_in_sql_select_where_kv_all394); - } - } - break; - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "sql_select_where_kv_all" - // $ANTLR start "func" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:100:1: func : BASIC_NAME '\\(' ( - // BASIC_NAME | '*' ) '\\)' ; - public final void func() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:101:2: ( BASIC_NAME '\\(' - // ( BASIC_NAME | '*' ) '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:2: BASIC_NAME '\\(' ( - // BASIC_NAME | '*' ) '\\)' - { - match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_func407); - match(input, 72, FOLLOW_72_in_func409); - if (input.LA(1) == BASIC_NAME || input.LA(1) == 63) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - match(input, 73, FOLLOW_73_in_func417); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "func" - // $ANTLR start "func_and_alias" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:105:1: func_and_alias : func ( ( - // AS )? BASIC_NAME )? ; - public final void func_and_alias() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:106:2: ( func ( ( AS )? - // BASIC_NAME )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:2: func ( ( AS )? - // BASIC_NAME )? - { - pushFollow(FOLLOW_func_in_func_and_alias431); - func(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:7: ( ( AS )? - // BASIC_NAME )? - int alt15 = 2; - int LA15_0 = input.LA(1); - if ((LA15_0 == AS || LA15_0 == BASIC_NAME)) { - alt15 = 1; - } - switch (alt15) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:8: ( AS )? - // BASIC_NAME - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:8: ( AS - // )? - int alt14 = 2; - int LA14_0 = input.LA(1); - if ((LA14_0 == AS)) { - alt14 = 1; - } - switch (alt14) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:8: AS - { - match(input, AS, FOLLOW_AS_in_func_and_alias434); - } - break; - } - match(input, BASIC_NAME, - FOLLOW_BASIC_NAME_in_func_and_alias437); - } - break; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "func_and_alias" - // $ANTLR start "select_column_and_alias" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:110:1: select_column_and_alias : - // column_name ( ( AS )? BASIC_NAME )? ; - public final void select_column_and_alias() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:111:2: ( column_name ( ( - // AS )? BASIC_NAME )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:112:2: column_name ( ( AS - // )? BASIC_NAME )? - { - pushFollow(FOLLOW_column_name_in_select_column_and_alias451); - column_name(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:112:14: ( ( AS )? - // BASIC_NAME )? - int alt17 = 2; - int LA17_0 = input.LA(1); - if ((LA17_0 == AS || LA17_0 == BASIC_NAME)) { - alt17 = 1; - } - switch (alt17) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:112:15: ( AS )? - // BASIC_NAME - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:112:15: ( AS - // )? - int alt16 = 2; - int LA16_0 = input.LA(1); - if ((LA16_0 == AS)) { - alt16 = 1; - } - switch (alt16) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:112:15: - // AS - { - match(input, AS, - FOLLOW_AS_in_select_column_and_alias454); - } - break; - } - match(input, BASIC_NAME, - FOLLOW_BASIC_NAME_in_select_column_and_alias457); - } - break; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "select_column_and_alias" - // $ANTLR start "select_column" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:115:1: select_column : ( - // select_column_and_alias | func_and_alias | '*' ); - public final void select_column() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:2: ( - // select_column_and_alias | func_and_alias | '*' ) - int alt18 = 3; - int LA18_0 = input.LA(1); - if ((LA18_0 == BASIC_NAME)) { - int LA18_1 = input.LA(2); - if ((LA18_1 == 72)) { - alt18 = 2; - } - else if ((LA18_1 == AS || LA18_1 == BASIC_NAME - || LA18_1 == FROM || (LA18_1 >= 64 && LA18_1 <= 65))) { - alt18 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException("", - 18, 1, input); - throw nvae; - } - } - else if ((LA18_0 == 63)) { - alt18 = 3; - } - else { - NoViableAltException nvae = new NoViableAltException("", 18, 0, - input); - throw nvae; - } - switch (alt18) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:117:2: - // select_column_and_alias - { - pushFollow(FOLLOW_select_column_and_alias_in_select_column471); - select_column_and_alias(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:117:26: - // func_and_alias - { - pushFollow(FOLLOW_func_and_alias_in_select_column473); - func_and_alias(); - state._fsp--; - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:117:41: '*' - { - match(input, 63, FOLLOW_63_in_select_column475); - } - break; - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "select_column" - // $ANTLR start "select_columns" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:120:1: select_columns : - // select_column ( ',' select_column )* ; - public final void select_columns() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:121:2: ( select_column ( - // ',' select_column )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:122:2: select_column ( - // ',' select_column )* - { - pushFollow(FOLLOW_select_column_in_select_columns488); - select_column(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:122:16: ( ',' - // select_column )* - loop19: do { - int alt19 = 2; - int LA19_0 = input.LA(1); - if ((LA19_0 == 64)) { - alt19 = 1; - } - switch (alt19) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:122:17: ',' - // select_column - { - match(input, 64, FOLLOW_64_in_select_columns491); - pushFollow(FOLLOW_select_column_in_select_columns493); - select_column(); - state._fsp--; - } - break; - default: - break loop19; - } - } - while (true); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "select_columns" - // $ANTLR start "and_or" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:127:1: and_or : ( AND | OR ); - public final void and_or() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:127:8: ( AND | OR ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == AND || input.LA(1) == OR) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "and_or" - // $ANTLR start "table" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:131:1: table : table_name ( ( AS - // )? alias )? ; - public final void table() throws RecognitionException { - AntlrV3SQLParser.table_name_return table_name1 = null; - AntlrV3SQLParser.alias_return alias2 = null; - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:131:7: ( table_name ( ( - // AS )? alias )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:2: table_name ( ( AS - // )? alias )? - { - pushFollow(FOLLOW_table_name_in_table527); - table_name1 = table_name(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:13: ( ( AS )? - // alias )? - int alt21 = 2; - int LA21_0 = input.LA(1); - if ((LA21_0 == AS || LA21_0 == BASIC_NAME)) { - alt21 = 1; - } - switch (alt21) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:14: ( AS )? - // alias - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:14: ( AS - // )? - int alt20 = 2; - int LA20_0 = input.LA(1); - if ((LA20_0 == AS)) { - alt20 = 1; - } - switch (alt20) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:15: - // AS - { - match(input, AS, FOLLOW_AS_in_table531); - } - break; - } - pushFollow(FOLLOW_alias_in_table535); - alias2 = alias(); - state._fsp--; - } - break; - } - if (this.antlrParserDelegate != null) { - this.antlrParserDelegate - .onFindTable( - (table_name1 != null ? input - .toString(table_name1.start, - table_name1.stop) : null), - (alias2 != null ? input.toString( - alias2.start, alias2.stop) : null)); - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "table" - // $ANTLR start "tables" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:144:1: tables : ( table ( ',' - // table )* ) ; - public final void tables() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:144:8: ( ( table ( ',' - // table )* ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:145:2: ( table ( ',' - // table )* ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:145:2: ( table ( ',' - // table )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:145:3: table ( ',' - // table )* - { - pushFollow(FOLLOW_table_in_tables551); - table(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:145:9: ( ',' - // table )* - loop22: do { - int alt22 = 2; - int LA22_0 = input.LA(1); - if ((LA22_0 == 64)) { - alt22 = 1; - } - switch (alt22) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:145:10: - // ',' table - { - match(input, 64, FOLLOW_64_in_tables554); - pushFollow(FOLLOW_table_in_tables556); - table(); - state._fsp--; - } - break; - default: - break loop22; - } - } - while (true); - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "tables" - public static class table_name_return extends ParserRuleReturnScope { - }; - - // $ANTLR start "table_name" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:148:1: table_name : BASIC_NAME ( - // ( '.' ) BASIC_NAME )? ; - public final AntlrV3SQLParser.table_name_return table_name() - throws RecognitionException { - AntlrV3SQLParser.table_name_return retval = new AntlrV3SQLParser.table_name_return(); - retval.start = input.LT(1); - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:149:2: ( BASIC_NAME ( ( - // '.' ) BASIC_NAME )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:150:2: BASIC_NAME ( ( '.' - // ) BASIC_NAME )? - { - match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_table_name572); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:150:13: ( ( '.' ) - // BASIC_NAME )? - int alt23 = 2; - int LA23_0 = input.LA(1); - if ((LA23_0 == 65)) { - alt23 = 1; - } - switch (alt23) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:150:14: ( '.' ) - // BASIC_NAME - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:150:14: ( '.' - // ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:150:15: '.' - { - match(input, 65, FOLLOW_65_in_table_name576); - } - match(input, BASIC_NAME, - FOLLOW_BASIC_NAME_in_table_name579); - } - break; - } - } - retval.stop = input.LT(-1); - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return retval; - } - - // $ANTLR end "table_name" - public static class alias_return extends ParserRuleReturnScope { - }; - - // $ANTLR start "alias" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:153:1: alias : BASIC_NAME ; - public final AntlrV3SQLParser.alias_return alias() - throws RecognitionException { - AntlrV3SQLParser.alias_return retval = new AntlrV3SQLParser.alias_return(); - retval.start = input.LT(1); - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:153:7: ( BASIC_NAME ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:154:2: BASIC_NAME - { - match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_alias592); - } - retval.stop = input.LT(-1); - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return retval; - } - - // $ANTLR end "alias" - public static class column_name_return extends ParserRuleReturnScope { - }; - - // $ANTLR start "column_name" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:157:1: column_name : BASIC_NAME ( - // ( '.' ) BASIC_NAME )? ; - public final AntlrV3SQLParser.column_name_return column_name() - throws RecognitionException { - AntlrV3SQLParser.column_name_return retval = new AntlrV3SQLParser.column_name_return(); - retval.start = input.LT(1); - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:2: ( BASIC_NAME ( ( - // '.' ) BASIC_NAME )? ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:159:2: BASIC_NAME ( ( '.' - // ) BASIC_NAME )? - { - match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_column_name604); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:159:13: ( ( '.' ) - // BASIC_NAME )? - int alt24 = 2; - int LA24_0 = input.LA(1); - if ((LA24_0 == 65)) { - alt24 = 1; - } - switch (alt24) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:159:14: ( '.' ) - // BASIC_NAME - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:159:14: ( '.' - // ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:159:15: '.' - { - match(input, 65, FOLLOW_65_in_column_name608); - } - match(input, BASIC_NAME, - FOLLOW_BASIC_NAME_in_column_name611); - } - break; - } - } - retval.stop = input.LT(-1); - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return retval; - } - - // $ANTLR end "column_name" - // $ANTLR start "insertColumn" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:162:1: insertColumn : column_name - // ; - public final void insertColumn() throws RecognitionException { - AntlrV3SQLParser.column_name_return column_name3 = null; - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:163:2: ( column_name ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:164:2: column_name - { - pushFollow(FOLLOW_column_name_in_insertColumn625); - column_name3 = column_name(); - state._fsp--; - if (this.antlrParserDelegate != null) { - this.antlrParserDelegate.onFindColExper( - (column_name3 != null ? input.toString( - column_name3.start, column_name3.stop) - : null), "="); - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "insertColumn" - // $ANTLR start "kv" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:176:1: kv : ( ( column_name op ( - // PRE_SET | '\\(' PRE_SET '\\)' ) ) | ( column_name op ( TEXT_STRING | - // '\\(' TEXT_STRING '\\)' ) ) | column_name op column_name | column_name op - // func2 | ( column_name opbetween opand ) ); - public final void kv() throws RecognitionException { - AntlrV3SQLParser.column_name_return column_name4 = null; - AntlrV3SQLParser.op_return op5 = null; - AntlrV3SQLParser.column_name_return column_name6 = null; - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:176:4: ( ( column_name op - // ( PRE_SET | '\\(' PRE_SET '\\)' ) ) | ( column_name op ( - // TEXT_STRING | '\\(' TEXT_STRING '\\)' ) ) | column_name op - // column_name | column_name op func2 | ( column_name opbetween - // opand ) ) - int alt27 = 5; - int LA27_0 = input.LA(1); - if ((LA27_0 == BASIC_NAME)) { - switch (input.LA(2)) { - case 65: { - int LA27_2 = input.LA(3); - if ((LA27_2 == BASIC_NAME)) { - int LA27_5 = input.LA(4); - if ((LA27_5 == EXISTS || LA27_5 == IN - || LA27_5 == 62 || (LA27_5 >= 66 && LA27_5 <= 71))) { - switch (input.LA(5)) { - case PRE_SET: { - alt27 = 1; - } - break; - case 72: { - int LA27_7 = input.LA(6); - if ((LA27_7 == PRE_SET)) { - alt27 = 1; - } - else if ((LA27_7 == TEXT_STRING)) { - alt27 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 7, input); - throw nvae; - } - } - break; - case TEXT_STRING: { - alt27 = 2; - } - break; - case BASIC_NAME: { - int LA27_9 = input.LA(6); - if ((LA27_9 == 72)) { - alt27 = 4; - } - else if ((LA27_9 == EOF - || LA27_9 == AND - || LA27_9 == GROUP - || LA27_9 == HAVING - || (LA27_9 >= OR && LA27_9 <= ORDER) - || LA27_9 == WHERE - || (LA27_9 >= 64 && LA27_9 <= 65) || LA27_9 == 73)) { - alt27 = 3; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 9, input); - throw nvae; - } - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 27, 3, input); - throw nvae; - } - } - else if ((LA27_5 == BETWEEN)) { - alt27 = 5; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 5, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 2, input); - throw nvae; - } - } - break; - case EXISTS: - case IN: - case 62: - case 66: - case 67: - case 68: - case 69: - case 70: - case 71: { - switch (input.LA(3)) { - case PRE_SET: { - alt27 = 1; - } - break; - case 72: { - int LA27_7 = input.LA(4); - if ((LA27_7 == PRE_SET)) { - alt27 = 1; - } - else if ((LA27_7 == TEXT_STRING)) { - alt27 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 7, input); - throw nvae; - } - } - break; - case TEXT_STRING: { - alt27 = 2; - } - break; - case BASIC_NAME: { - int LA27_9 = input.LA(4); - if ((LA27_9 == 72)) { - alt27 = 4; - } - else if ((LA27_9 == EOF || LA27_9 == AND - || LA27_9 == GROUP || LA27_9 == HAVING - || (LA27_9 >= OR && LA27_9 <= ORDER) - || LA27_9 == WHERE - || (LA27_9 >= 64 && LA27_9 <= 65) || LA27_9 == 73)) { - alt27 = 3; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 27, 9, input); - throw nvae; - } - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 27, 3, input); - throw nvae; - } - } - break; - case BETWEEN: { - alt27 = 5; - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 27, 1, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException("", 27, 0, - input); - throw nvae; - } - switch (alt27) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:2: ( column_name - // op ( PRE_SET | '\\(' PRE_SET '\\)' ) ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:2: ( - // column_name op ( PRE_SET | '\\(' PRE_SET '\\)' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:3: - // column_name op ( PRE_SET | '\\(' PRE_SET '\\)' ) - { - pushFollow(FOLLOW_column_name_in_kv640); - column_name4 = column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_kv642); - op5 = op(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:18: ( - // PRE_SET | '\\(' PRE_SET '\\)' ) - int alt25 = 2; - int LA25_0 = input.LA(1); - if ((LA25_0 == PRE_SET)) { - alt25 = 1; - } - else if ((LA25_0 == 72)) { - alt25 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 25, 0, input); - throw nvae; - } - switch (alt25) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:19: - // PRE_SET - { - match(input, PRE_SET, FOLLOW_PRE_SET_in_kv645); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:27: - // '\\(' PRE_SET '\\)' - { - match(input, 72, FOLLOW_72_in_kv647); - match(input, PRE_SET, FOLLOW_PRE_SET_in_kv649); - match(input, 73, FOLLOW_73_in_kv651); - } - break; - } - } - if (this.antlrParserDelegate != null) { - this.antlrParserDelegate.onFindColExper( - (column_name4 != null ? input.toString( - column_name4.start, column_name4.stop) - : null), - (op5 != null ? input.toString(op5.start, - op5.stop) : null)); - } - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:2: ( column_name - // op ( TEXT_STRING | '\\(' TEXT_STRING '\\)' ) ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:2: ( - // column_name op ( TEXT_STRING | '\\(' TEXT_STRING '\\)' ) - // ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:3: - // column_name op ( TEXT_STRING | '\\(' TEXT_STRING '\\)' ) - { - pushFollow(FOLLOW_column_name_in_kv663); - column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_kv665); - op(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:18: ( - // TEXT_STRING | '\\(' TEXT_STRING '\\)' ) - int alt26 = 2; - int LA26_0 = input.LA(1); - if ((LA26_0 == TEXT_STRING)) { - alt26 = 1; - } - else if ((LA26_0 == 72)) { - alt26 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 26, 0, input); - throw nvae; - } - switch (alt26) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:19: - // TEXT_STRING - { - match(input, TEXT_STRING, - FOLLOW_TEXT_STRING_in_kv668); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:187:31: - // '\\(' TEXT_STRING '\\)' - { - match(input, 72, FOLLOW_72_in_kv670); - match(input, TEXT_STRING, - FOLLOW_TEXT_STRING_in_kv672); - match(input, 73, FOLLOW_73_in_kv674); - } - break; - } - } - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:189:2: column_name op - // column_name - { - pushFollow(FOLLOW_column_name_in_kv682); - column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_kv684); - op(); - state._fsp--; - pushFollow(FOLLOW_column_name_in_kv686); - column_name(); - state._fsp--; - } - break; - case 4: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:191:2: column_name op - // func2 - { - pushFollow(FOLLOW_column_name_in_kv692); - column_name(); - state._fsp--; - pushFollow(FOLLOW_op_in_kv694); - op(); - state._fsp--; - pushFollow(FOLLOW_func2_in_kv696); - func2(); - state._fsp--; - } - break; - case 5: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:193:2: ( column_name - // opbetween opand ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:193:2: ( - // column_name opbetween opand ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:194:2: - // column_name opbetween opand - { - pushFollow(FOLLOW_column_name_in_kv705); - column_name6 = column_name(); - state._fsp--; - pushFollow(FOLLOW_opbetween_in_kv707); - opbetween(); - state._fsp--; - pushFollow(FOLLOW_opand_in_kv709); - opand(); - state._fsp--; - String s = (column_name6 != null ? input.toString( - column_name6.start, column_name6.stop) : null); - if (antlrParserDelegate != null) { - antlrParserDelegate.onFindColExper(s, ">="); - antlrParserDelegate.onFindColExper(s, "<="); - } - } - } - break; - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "kv" - // $ANTLR start "func2" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:203:1: func2 : BASIC_NAME '\\(' ( - // ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING ) )* )? - // '\\)' ; - public final void func2() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:203:7: ( BASIC_NAME '\\(' - // ( ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING - // ) )* )? '\\)' ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:204:2: BASIC_NAME '\\(' ( - // ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING ) - // )* )? '\\)' - { - match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_func2726); - match(input, 72, FOLLOW_72_in_func2730); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:206:2: ( ( - // column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING - // ) )* )? - int alt31 = 2; - int LA31_0 = input.LA(1); - if ((LA31_0 == BASIC_NAME || LA31_0 == TEXT_STRING)) { - alt31 = 1; - } - switch (alt31) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:2: ( - // column_name | TEXT_STRING ) ( ',' ( column_name | - // TEXT_STRING ) )* - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:2: ( - // column_name | TEXT_STRING ) - int alt28 = 2; - int LA28_0 = input.LA(1); - if ((LA28_0 == BASIC_NAME)) { - alt28 = 1; - } - else if ((LA28_0 == TEXT_STRING)) { - alt28 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 28, 0, input); - throw nvae; - } - switch (alt28) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:3: - // column_name - { - pushFollow(FOLLOW_column_name_in_func2738); - column_name(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:15: - // TEXT_STRING - { - match(input, TEXT_STRING, - FOLLOW_TEXT_STRING_in_func2740); - } - break; - } - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:28: ( ',' - // ( column_name | TEXT_STRING ) )* - loop30: do { - int alt30 = 2; - int LA30_0 = input.LA(1); - if ((LA30_0 == 64)) { - alt30 = 1; - } - switch (alt30) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:29: - // ',' ( column_name | TEXT_STRING ) - { - match(input, 64, FOLLOW_64_in_func2744); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:33: - // ( column_name | TEXT_STRING ) - int alt29 = 2; - int LA29_0 = input.LA(1); - if ((LA29_0 == BASIC_NAME)) { - alt29 = 1; - } - else if ((LA29_0 == TEXT_STRING)) { - alt29 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 29, 0, input); - throw nvae; - } - switch (alt29) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:34: - // column_name - { - pushFollow(FOLLOW_column_name_in_func2747); - column_name(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:207:46: - // TEXT_STRING - { - match(input, TEXT_STRING, - FOLLOW_TEXT_STRING_in_func2749); - } - break; - } - } - break; - default: - break loop30; - } - } - while (true); - } - break; - } - match(input, 73, FOLLOW_73_in_func2759); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "func2" - public static class op_return extends ParserRuleReturnScope { - }; - - // $ANTLR start "op" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:212:1: op : ( '=' | '>' | '>=' | - // '<' | '<=' | '!=' | '<>' | IN | EXISTS ) ; - public final AntlrV3SQLParser.op_return op() throws RecognitionException { - AntlrV3SQLParser.op_return retval = new AntlrV3SQLParser.op_return(); - retval.start = input.LT(1); - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:213:2: ( ( '=' | '>' | - // '>=' | '<' | '<=' | '!=' | '<>' | IN | EXISTS ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == EXISTS || input.LA(1) == IN - || input.LA(1) == 62 - || (input.LA(1) >= 66 && input.LA(1) <= 71)) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - } - retval.stop = input.LT(-1); - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return retval; - } - - // $ANTLR end "op" - // $ANTLR start "opbetween" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:217:1: opbetween : BETWEEN ; - public final void opbetween() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:218:2: ( BETWEEN ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:218:3: BETWEEN - { - match(input, BETWEEN, FOLLOW_BETWEEN_in_opbetween800); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "opbetween" - // $ANTLR start "opand" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:220:1: opand : ( PRE_SET | '\\(' - // PRE_SET '\\)' ) AND ( PRE_SET | '\\(' PRE_SET '\\)' ) ; - public final void opand() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:220:7: ( ( PRE_SET | - // '\\(' PRE_SET '\\)' ) AND ( PRE_SET | '\\(' PRE_SET '\\)' ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:2: ( PRE_SET | '\\(' - // PRE_SET '\\)' ) AND ( PRE_SET | '\\(' PRE_SET '\\)' ) - { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:2: ( PRE_SET | - // '\\(' PRE_SET '\\)' ) - int alt32 = 2; - int LA32_0 = input.LA(1); - if ((LA32_0 == PRE_SET)) { - alt32 = 1; - } - else if ((LA32_0 == 72)) { - alt32 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException("", - 32, 0, input); - throw nvae; - } - switch (alt32) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:3: PRE_SET - { - match(input, PRE_SET, FOLLOW_PRE_SET_in_opand810); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:11: '\\(' - // PRE_SET '\\)' - { - match(input, 72, FOLLOW_72_in_opand812); - match(input, PRE_SET, FOLLOW_PRE_SET_in_opand814); - match(input, 73, FOLLOW_73_in_opand816); - } - break; - } - match(input, AND, FOLLOW_AND_in_opand819); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:34: ( PRE_SET | - // '\\(' PRE_SET '\\)' ) - int alt33 = 2; - int LA33_0 = input.LA(1); - if ((LA33_0 == PRE_SET)) { - alt33 = 1; - } - else if ((LA33_0 == 72)) { - alt33 = 2; - } - else { - NoViableAltException nvae = new NoViableAltException("", - 33, 0, input); - throw nvae; - } - switch (alt33) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:35: PRE_SET - { - match(input, PRE_SET, FOLLOW_PRE_SET_in_opand822); - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:221:43: '\\(' - // PRE_SET '\\)' - { - match(input, 72, FOLLOW_72_in_opand824); - match(input, PRE_SET, FOLLOW_PRE_SET_in_opand826); - match(input, 73, FOLLOW_73_in_opand828); - } - break; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "opand" - // $ANTLR start "orderby" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:224:1: orderby : ORDER BY - // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* ; - public final void orderby() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:224:9: ( ORDER BY - // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* - // ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:2: ORDER BY - // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* - { - match(input, ORDER, FOLLOW_ORDER_in_orderby840); - match(input, BY, FOLLOW_BY_in_orderby842); - pushFollow(FOLLOW_column_name_in_orderby844); - column_name(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:23: ( DESC | ASC - // )? - int alt34 = 2; - int LA34_0 = input.LA(1); - if ((LA34_0 == ASC || LA34_0 == DESC)) { - alt34 = 1; - } - switch (alt34) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == ASC || input.LA(1) == DESC) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - } - break; - } - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:35: ( ',' - // column_name ( DESC | ASC )? )* - loop36: do { - int alt36 = 2; - int LA36_0 = input.LA(1); - if ((LA36_0 == 64)) { - alt36 = 1; - } - switch (alt36) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:36: ',' - // column_name ( DESC | ASC )? - { - match(input, 64, FOLLOW_64_in_orderby854); - pushFollow(FOLLOW_column_name_in_orderby856); - column_name(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:225:52: ( - // DESC | ASC )? - int alt35 = 2; - int LA35_0 = input.LA(1); - if ((LA35_0 == ASC || LA35_0 == DESC)) { - alt35 = 1; - } - switch (alt35) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: - { - if (input.LA(1) == ASC - || input.LA(1) == DESC) { - input.consume(); - state.errorRecovery = false; - } - else { - MismatchedSetException mse = new MismatchedSetException( - null, input); - throw mse; - } - } - break; - } - } - break; - default: - break loop36; - } - } - while (true); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "orderby" - // $ANTLR start "groupby" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:228:1: groupby : GROUP BY - // column_name ( ',' column_name )* ; - public final void groupby() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:228:9: ( GROUP BY - // column_name ( ',' column_name )* ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:229:2: GROUP BY - // column_name ( ',' column_name )* - { - match(input, GROUP, FOLLOW_GROUP_in_groupby877); - match(input, BY, FOLLOW_BY_in_groupby879); - pushFollow(FOLLOW_column_name_in_groupby881); - column_name(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:229:23: ( ',' - // column_name )* - loop37: do { - int alt37 = 2; - int LA37_0 = input.LA(1); - if ((LA37_0 == 64)) { - alt37 = 1; - } - switch (alt37) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:229:24: ',' - // column_name - { - match(input, 64, FOLLOW_64_in_groupby884); - pushFollow(FOLLOW_column_name_in_groupby886); - column_name(); - state._fsp--; - } - break; - default: - break loop37; - } - } - while (true); - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "groupby" - // $ANTLR start "having" - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:232:1: having : HAVING ( - // column_name | func ) op ( column_name | func | TEXT_STRING | PRE_SET ) ; - public final void having() throws RecognitionException { - try { - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:232:8: ( HAVING ( - // column_name | func ) op ( column_name | func | TEXT_STRING | - // PRE_SET ) ) - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:2: HAVING ( - // column_name | func ) op ( column_name | func | TEXT_STRING | - // PRE_SET ) - { - match(input, HAVING, FOLLOW_HAVING_in_having899); - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:9: ( column_name - // | func ) - int alt38 = 2; - int LA38_0 = input.LA(1); - if ((LA38_0 == BASIC_NAME)) { - int LA38_1 = input.LA(2); - if ((LA38_1 == 72)) { - alt38 = 2; - } - else if ((LA38_1 == EXISTS || LA38_1 == IN || LA38_1 == 62 || (LA38_1 >= 65 && LA38_1 <= 71))) { - alt38 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 38, 1, input); - throw nvae; - } - } - else { - NoViableAltException nvae = new NoViableAltException("", - 38, 0, input); - throw nvae; - } - switch (alt38) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:10: - // column_name - { - pushFollow(FOLLOW_column_name_in_having902); - column_name(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:22: func - { - pushFollow(FOLLOW_func_in_having904); - func(); - state._fsp--; - } - break; - } - pushFollow(FOLLOW_op_in_having907); - op(); - state._fsp--; - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:31: ( column_name - // | func | TEXT_STRING | PRE_SET ) - int alt39 = 4; - switch (input.LA(1)) { - case BASIC_NAME: { - int LA39_1 = input.LA(2); - if ((LA39_1 == 72)) { - alt39 = 2; - } - else if ((LA39_1 == EOF || LA39_1 == GROUP - || LA39_1 == HAVING || LA39_1 == ORDER - || LA39_1 == 65 || LA39_1 == 73)) { - alt39 = 1; - } - else { - NoViableAltException nvae = new NoViableAltException( - "", 39, 1, input); - throw nvae; - } - } - break; - case TEXT_STRING: { - alt39 = 3; - } - break; - case PRE_SET: { - alt39 = 4; - } - break; - default: - NoViableAltException nvae = new NoViableAltException( - "", 39, 0, input); - throw nvae; - } - switch (alt39) { - case 1: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:32: - // column_name - { - pushFollow(FOLLOW_column_name_in_having910); - column_name(); - state._fsp--; - } - break; - case 2: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:44: func - { - pushFollow(FOLLOW_func_in_having912); - func(); - state._fsp--; - } - break; - case 3: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:49: - // TEXT_STRING - { - match(input, TEXT_STRING, - FOLLOW_TEXT_STRING_in_having914); - } - break; - case 4: - // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:233:61: PRE_SET - { - match(input, PRE_SET, FOLLOW_PRE_SET_in_having916); - } - break; - } - } - } - catch (RecognitionException re) { - reportError(re); - recover(input, re); - } - finally { - // do for sure before leaving - } - return; - } - - // $ANTLR end "having" - // Delegated rules - public static final BitSet FOLLOW_sql_insert_in_start18 = new BitSet( - new long[] { 0x0000000000000002L }); - - public static final BitSet FOLLOW_sql_delete_in_start20 = new BitSet( - new long[] { 0x0000000000000002L }); - - public static final BitSet FOLLOW_sql_update_in_start22 = new BitSet( - new long[] { 0x0000000000000002L }); - - public static final BitSet FOLLOW_sql_select_in_start24 = new BitSet( - new long[] { 0x0000000000000002L }); - - public static final BitSet FOLLOW_INSERT_in_sql_insert35 = new BitSet( - new long[] { 0x0000000040000000L }); - - public static final BitSet FOLLOW_INTO_in_sql_insert37 = new BitSet( - new long[] { 0x0000000000000200L }); - - public static final BitSet FOLLOW_table_in_sql_insert39 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); - - public static final BitSet FOLLOW_72_in_sql_insert41 = new BitSet( - new long[] { 0x0000000000000200L }); - - public static final BitSet FOLLOW_insertColumn_in_sql_insert43 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); - - public static final BitSet FOLLOW_64_in_sql_insert46 = new BitSet( - new long[] { 0x0000000000000200L }); - - public static final BitSet FOLLOW_insertColumn_in_sql_insert48 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); - - public static final BitSet FOLLOW_73_in_sql_insert52 = new BitSet( - new long[] { 0x0080000000000000L }); - - public static final BitSet FOLLOW_VALUES_in_sql_insert54 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); - - public static final BitSet FOLLOW_72_in_sql_insert56 = new BitSet( - new long[] { 0x0000080000000000L, 0x0000000000000201L }); - - public static final BitSet FOLLOW_PRE_SET_in_sql_insert59 = new BitSet( - new long[] { 0x0000080000000000L, 0x0000000000000201L }); - - public static final BitSet FOLLOW_64_in_sql_insert62 = new BitSet( - new long[] { 0x0000080000000000L }); + public AntlrV3SQLParser(TokenStream input, RecognizerSharedState state) { + super(input, state); + } - public static final BitSet FOLLOW_PRE_SET_in_sql_insert64 = new BitSet( - new long[] { 0x0000080000000000L, 0x0000000000000201L }); + public String[] getTokenNames() { + return AntlrV3SQLParser.tokenNames; + } - public static final BitSet FOLLOW_73_in_sql_insert69 = new BitSet( - new long[] { 0x0000000000000002L }); + public String getGrammarFileName() { + return "/Users/akwei/antlrpro/sql2/AntlrV3SQL.g"; + } + + private AntlrParserDelegate antlrParserDelegate; + + public void setAntlrParserDelegate(AntlrParserDelegate antlrParserDelegate) { + this.antlrParserDelegate = antlrParserDelegate; + } + + @Override + public void reportError(RecognitionException e) { + } + + // $ANTLR start "start" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:21:1: start : ( sql_insert | + // sql_delete | sql_update | sql_select ); + public final void start() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:21:7: ( sql_insert | + // sql_delete | sql_update | sql_select ) + int alt1 = 4; + switch (input.LA(1)) { + case INSERT: { + alt1 = 1; + } + break; + case DELETE: { + alt1 = 2; + } + break; + case UPDATE: { + alt1 = 3; + } + break; + case SELECT: { + alt1 = 4; + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 1, 0, input); + throw nvae; + } + switch (alt1) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:2: sql_insert + { + pushFollow(FOLLOW_sql_insert_in_start23); + sql_insert(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:13: sql_delete + { + pushFollow(FOLLOW_sql_delete_in_start25); + sql_delete(); + state._fsp--; + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:24: sql_update + { + pushFollow(FOLLOW_sql_update_in_start27); + sql_update(); + state._fsp--; + } + break; + case 4: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:22:35: sql_select + { + pushFollow(FOLLOW_sql_select_in_start29); + sql_select(); + state._fsp--; + } + break; + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "start" + // $ANTLR start "sql_insert" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:24:1: sql_insert : INSERT INTO + // table '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( + // PRE_SET | ( ',' PRE_SET ) )* '\\)' ; + public final void sql_insert() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:25:2: ( INSERT INTO table + // '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( + // PRE_SET | ( ',' PRE_SET ) )* '\\)' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:2: INSERT INTO table + // '\\(' insertColumn ( ',' insertColumn )* '\\)' VALUES '\\(' ( + // PRE_SET | ( ',' PRE_SET ) )* '\\)' + { + match(input, INSERT, FOLLOW_INSERT_in_sql_insert40); + match(input, INTO, FOLLOW_INTO_in_sql_insert42); + pushFollow(FOLLOW_table_in_sql_insert44); + table(); + state._fsp--; + match(input, 74, FOLLOW_74_in_sql_insert46); + pushFollow(FOLLOW_insertColumn_in_sql_insert48); + insertColumn(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:38: ( ',' + // insertColumn )* + loop2: do { + int alt2 = 2; + int LA2_0 = input.LA(1); + if ((LA2_0 == 66)) { + alt2 = 1; + } + switch (alt2) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:39: ',' + // insertColumn + { + match(input, 66, FOLLOW_66_in_sql_insert51); + pushFollow(FOLLOW_insertColumn_in_sql_insert53); + insertColumn(); + state._fsp--; + } + break; + default: + break loop2; + } + } + while (true); + match(input, 75, FOLLOW_75_in_sql_insert57); + match(input, VALUES, FOLLOW_VALUES_in_sql_insert59); + match(input, 74, FOLLOW_74_in_sql_insert61); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:75: ( PRE_SET | ( + // ',' PRE_SET ) )* + loop3: do { + int alt3 = 3; + int LA3_0 = input.LA(1); + if ((LA3_0 == PRE_SET)) { + alt3 = 1; + } + else if ((LA3_0 == 66)) { + alt3 = 2; + } + switch (alt3) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:76: PRE_SET + { + match(input, PRE_SET, FOLLOW_PRE_SET_in_sql_insert64); + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:84: ( ',' + // PRE_SET ) + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:84: ( ',' + // PRE_SET ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:26:85: ',' + // PRE_SET + { + match(input, 66, FOLLOW_66_in_sql_insert67); + match(input, PRE_SET, + FOLLOW_PRE_SET_in_sql_insert69); + } + } + break; + default: + break loop3; + } + } + while (true); + match(input, 75, FOLLOW_75_in_sql_insert74); + this.antlrParserDelegate + .setSqlOp(AntlrParserDelegate.SQLOP_INSERT); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "sql_insert" + // $ANTLR start "sql_delete" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:30:1: sql_delete : DELETE FROM + // table ( WHERE kv ( and_or kv )* )? ; + public final void sql_delete() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:31:2: ( DELETE FROM table + // ( WHERE kv ( and_or kv )* )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:32:2: DELETE FROM table ( + // WHERE kv ( and_or kv )* )? + { + match(input, DELETE, FOLLOW_DELETE_in_sql_delete91); + match(input, FROM, FOLLOW_FROM_in_sql_delete93); + pushFollow(FOLLOW_table_in_sql_delete95); + table(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:32:20: ( WHERE kv ( + // and_or kv )* )? + int alt5 = 2; + int LA5_0 = input.LA(1); + if ((LA5_0 == WHERE)) { + alt5 = 1; + } + switch (alt5) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:32:21: WHERE kv ( + // and_or kv )* + { + match(input, WHERE, FOLLOW_WHERE_in_sql_delete98); + pushFollow(FOLLOW_kv_in_sql_delete100); + kv(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:32:30: ( and_or + // kv )* + loop4: do { + int alt4 = 2; + int LA4_0 = input.LA(1); + if ((LA4_0 == AND || LA4_0 == OR)) { + alt4 = 1; + } + switch (alt4) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:32:31: and_or + // kv + { + pushFollow(FOLLOW_and_or_in_sql_delete103); + and_or(); + state._fsp--; + pushFollow(FOLLOW_kv_in_sql_delete105); + kv(); + state._fsp--; + } + break; + default: + break loop4; + } + } + while (true); + } + break; + } + this.antlrParserDelegate + .setSqlOp(AntlrParserDelegate.SQLOP_DELETE); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "sql_delete" + // $ANTLR start "sql_update" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:36:1: sql_update : UPDATE table + // SET kv ( ',' kv )* ( WHERE kv ( and_or kv )* )? ; + public final void sql_update() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:37:2: ( UPDATE table SET + // kv ( ',' kv )* ( WHERE kv ( and_or kv )* )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:2: UPDATE table SET kv + // ( ',' kv )* ( WHERE kv ( and_or kv )* )? + { + match(input, UPDATE, FOLLOW_UPDATE_in_sql_update126); + pushFollow(FOLLOW_table_in_sql_update128); + table(); + state._fsp--; + match(input, SET, FOLLOW_SET_in_sql_update130); + pushFollow(FOLLOW_kv_in_sql_update132); + kv(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:22: ( ',' kv )* + loop6: do { + int alt6 = 2; + int LA6_0 = input.LA(1); + if ((LA6_0 == 66)) { + alt6 = 1; + } + switch (alt6) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:23: ',' kv + { + match(input, 66, FOLLOW_66_in_sql_update135); + pushFollow(FOLLOW_kv_in_sql_update137); + kv(); + state._fsp--; + } + break; + default: + break loop6; + } + } + while (true); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:32: ( WHERE kv ( + // and_or kv )* )? + int alt8 = 2; + int LA8_0 = input.LA(1); + if ((LA8_0 == WHERE)) { + alt8 = 1; + } + switch (alt8) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:33: WHERE kv ( + // and_or kv )* + { + match(input, WHERE, FOLLOW_WHERE_in_sql_update142); + pushFollow(FOLLOW_kv_in_sql_update144); + kv(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:42: ( and_or + // kv )* + loop7: do { + int alt7 = 2; + int LA7_0 = input.LA(1); + if ((LA7_0 == AND || LA7_0 == OR)) { + alt7 = 1; + } + switch (alt7) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:38:43: and_or + // kv + { + pushFollow(FOLLOW_and_or_in_sql_update147); + and_or(); + state._fsp--; + pushFollow(FOLLOW_kv_in_sql_update149); + kv(); + state._fsp--; + } + break; + default: + break loop7; + } + } + while (true); + } + break; + } + this.antlrParserDelegate + .setSqlOp(AntlrParserDelegate.SQLOP_UPDATE); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "sql_update" + // $ANTLR start "sql_select" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:42:1: sql_select : SELECT + // select_columns ( ',' db2_paging )? FROM ( sqlAfterFrom | inner_select ) ( + // WHERE kv_sql )? ( orderby | groupby | having )* ; + public final void sql_select() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:43:2: ( SELECT + // select_columns ( ',' db2_paging )? FROM ( sqlAfterFrom | + // inner_select ) ( WHERE kv_sql )? ( orderby | groupby | having )* + // ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:2: SELECT + // select_columns ( ',' db2_paging )? FROM ( sqlAfterFrom | + // inner_select ) ( WHERE kv_sql )? ( orderby | groupby | having )* + { + match(input, SELECT, FOLLOW_SELECT_in_sql_select171); + pushFollow(FOLLOW_select_columns_in_sql_select173); + select_columns(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:24: ( ',' + // db2_paging )? + int alt9 = 2; + int LA9_0 = input.LA(1); + if ((LA9_0 == 66)) { + alt9 = 1; + } + switch (alt9) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:25: ',' db2_paging + { + match(input, 66, FOLLOW_66_in_sql_select176); + pushFollow(FOLLOW_db2_paging_in_sql_select177); + db2_paging(); + state._fsp--; + } + break; + } + match(input, FROM, FOLLOW_FROM_in_sql_select181); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:46: ( sqlAfterFrom + // | inner_select ) + int alt10 = 2; + int LA10_0 = input.LA(1); + if ((LA10_0 == BASIC_NAME)) { + alt10 = 1; + } + else if ((LA10_0 == 74)) { + alt10 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 10, 0, input); + throw nvae; + } + switch (alt10) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:47: sqlAfterFrom + { + pushFollow(FOLLOW_sqlAfterFrom_in_sql_select184); + sqlAfterFrom(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:60: inner_select + { + pushFollow(FOLLOW_inner_select_in_sql_select186); + inner_select(); + state._fsp--; + } + break; + } + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:74: ( WHERE kv_sql + // )? + int alt11 = 2; + int LA11_0 = input.LA(1); + if ((LA11_0 == WHERE)) { + alt11 = 1; + } + switch (alt11) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:75: WHERE kv_sql + { + match(input, WHERE, FOLLOW_WHERE_in_sql_select190); + pushFollow(FOLLOW_kv_sql_in_sql_select192); + kv_sql(); + state._fsp--; + } + break; + } + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:90: ( orderby | + // groupby | having )* + loop12: do { + int alt12 = 4; + switch (input.LA(1)) { + case ORDER: { + alt12 = 1; + } + break; + case GROUP: { + alt12 = 2; + } + break; + case HAVING: { + alt12 = 3; + } + break; + } + switch (alt12) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:91: orderby + { + pushFollow(FOLLOW_orderby_in_sql_select197); + orderby(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:99: groupby + { + pushFollow(FOLLOW_groupby_in_sql_select199); + groupby(); + state._fsp--; + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:44:107: having + { + pushFollow(FOLLOW_having_in_sql_select201); + having(); + state._fsp--; + } + break; + default: + break loop12; + } + } + while (true); + this.antlrParserDelegate + .setSqlOp(AntlrParserDelegate.SQLOP_SELECT); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "sql_select" + // $ANTLR start "sqlAfterFrom" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:48:1: sqlAfterFrom : tables ( ( + // FULL | CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' + // column_name )? )* ; + public final void sqlAfterFrom() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:49:2: ( tables ( ( FULL | + // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' + // column_name )? )* ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:2: tables ( ( FULL | + // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name '=' + // column_name )? )* + { + pushFollow(FOLLOW_tables_in_sqlAfterFrom218); + tables(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:9: ( ( FULL | + // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON column_name + // '=' column_name )? )* + loop14: do { + int alt14 = 2; + int LA14_0 = input.LA(1); + if ((LA14_0 == CROSS || LA14_0 == FULL || LA14_0 == INNER + || LA14_0 == LEFT || LA14_0 == RIGHT)) { + alt14 = 1; + } + switch (alt14) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:10: ( FULL | + // CROSS | INNER | LEFT | RIGHT ) JOIN table ( ON + // column_name '=' column_name )? + { + if (input.LA(1) == CROSS || input.LA(1) == FULL + || input.LA(1) == INNER || input.LA(1) == LEFT + || input.LA(1) == RIGHT) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + match(input, JOIN, FOLLOW_JOIN_in_sqlAfterFrom233); + pushFollow(FOLLOW_table_in_sqlAfterFrom235); + table(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:51: ( ON + // column_name '=' column_name )? + int alt13 = 2; + int LA13_0 = input.LA(1); + if ((LA13_0 == ON)) { + alt13 = 1; + } + switch (alt13) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:50:52: ON + // column_name '=' column_name + { + match(input, ON, FOLLOW_ON_in_sqlAfterFrom238); + pushFollow(FOLLOW_column_name_in_sqlAfterFrom240); + column_name(); + state._fsp--; + match(input, 71, FOLLOW_71_in_sqlAfterFrom242); + pushFollow(FOLLOW_column_name_in_sqlAfterFrom244); + column_name(); + state._fsp--; + } + break; + } + } + break; + default: + break loop14; + } + } + while (true); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "sqlAfterFrom" + // $ANTLR start "kv_sql_wrapper" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:52:1: kv_sql_wrapper : ( kv_sql | + // '\\(' kv_sql '\\)' ); + public final void kv_sql_wrapper() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:53:2: ( kv_sql | '\\(' + // kv_sql '\\)' ) + int alt15 = 2; + int LA15_0 = input.LA(1); + if ((LA15_0 == BASIC_NAME)) { + alt15 = 1; + } + else if ((LA15_0 == 74)) { + alt15 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 15, 0, input); + throw nvae; + } + switch (alt15) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:54:2: kv_sql + { + pushFollow(FOLLOW_kv_sql_in_kv_sql_wrapper258); + kv_sql(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:54:11: '\\(' kv_sql '\\)' + { + match(input, 74, FOLLOW_74_in_kv_sql_wrapper262); + pushFollow(FOLLOW_kv_sql_in_kv_sql_wrapper264); + kv_sql(); + state._fsp--; + match(input, 75, FOLLOW_75_in_kv_sql_wrapper266); + } + break; + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "kv_sql_wrapper" + // $ANTLR start "kv_sql" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:56:1: kv_sql : kv ( and_or ( kv | + // '\\(' kv ( and_or kv )* '\\)' ) )* ; + public final void kv_sql() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:56:8: ( kv ( and_or ( kv + // | '\\(' kv ( and_or kv )* '\\)' ) )* ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:2: kv ( and_or ( kv | + // '\\(' kv ( and_or kv )* '\\)' ) )* + { + pushFollow(FOLLOW_kv_in_kv_sql277); + kv(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:5: ( and_or ( kv | + // '\\(' kv ( and_or kv )* '\\)' ) )* + loop18: do { + int alt18 = 2; + int LA18_0 = input.LA(1); + if ((LA18_0 == AND || LA18_0 == OR)) { + alt18 = 1; + } + switch (alt18) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:7: and_or ( kv + // | '\\(' kv ( and_or kv )* '\\)' ) + { + pushFollow(FOLLOW_and_or_in_kv_sql281); + and_or(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:14: ( kv | + // '\\(' kv ( and_or kv )* '\\)' ) + int alt17 = 2; + int LA17_0 = input.LA(1); + if ((LA17_0 == BASIC_NAME)) { + alt17 = 1; + } + else if ((LA17_0 == 74)) { + alt17 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 17, 0, input); + throw nvae; + } + switch (alt17) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:15: kv + { + pushFollow(FOLLOW_kv_in_kv_sql284); + kv(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:20: '\\(' + // kv ( and_or kv )* '\\)' + { + match(input, 74, FOLLOW_74_in_kv_sql288); + pushFollow(FOLLOW_kv_in_kv_sql290); + kv(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:28: ( + // and_or kv )* + loop16: do { + int alt16 = 2; + int LA16_0 = input.LA(1); + if ((LA16_0 == AND || LA16_0 == OR)) { + alt16 = 1; + } + switch (alt16) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:57:29: + // and_or kv + { + pushFollow(FOLLOW_and_or_in_kv_sql293); + and_or(); + state._fsp--; + pushFollow(FOLLOW_kv_in_kv_sql295); + kv(); + state._fsp--; + } + break; + default: + break loop16; + } + } + while (true); + match(input, 75, FOLLOW_75_in_kv_sql299); + } + break; + } + } + break; + default: + break loop18; + } + } + while (true); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "kv_sql" + // $ANTLR start "inner_select" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:60:1: inner_select : '\\(' + // sql_select '\\)' ( AS )? ( BASIC_NAME )? ; + public final void inner_select() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:61:2: ( '\\(' sql_select + // '\\)' ( AS )? ( BASIC_NAME )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:62:2: '\\(' sql_select + // '\\)' ( AS )? ( BASIC_NAME )? + { + match(input, 74, FOLLOW_74_in_inner_select316); + pushFollow(FOLLOW_sql_select_in_inner_select318); + sql_select(); + state._fsp--; + match(input, 75, FOLLOW_75_in_inner_select320); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:62:23: ( AS )? + int alt19 = 2; + int LA19_0 = input.LA(1); + if ((LA19_0 == AS)) { + alt19 = 1; + } + switch (alt19) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:62:23: AS + { + match(input, AS, FOLLOW_AS_in_inner_select322); + } + break; + } + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:62:27: ( BASIC_NAME + // )? + int alt20 = 2; + int LA20_0 = input.LA(1); + if ((LA20_0 == BASIC_NAME)) { + alt20 = 1; + } + switch (alt20) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:62:27: BASIC_NAME + { + match(input, BASIC_NAME, + FOLLOW_BASIC_NAME_in_inner_select325); + } + break; + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "inner_select" + // $ANTLR start "func" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:65:1: func : BASIC_NAME '\\(' ( + // BASIC_NAME | '*' )? '\\)' ; + public final void func() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:66:2: ( BASIC_NAME '\\(' + // ( BASIC_NAME | '*' )? '\\)' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:67:2: BASIC_NAME '\\(' ( + // BASIC_NAME | '*' )? '\\)' + { + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_func338); + match(input, 74, FOLLOW_74_in_func340); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:67:18: ( BASIC_NAME | + // '*' )? + int alt21 = 2; + int LA21_0 = input.LA(1); + if ((LA21_0 == BASIC_NAME || LA21_0 == 65)) { + alt21 = 1; + } + switch (alt21) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == BASIC_NAME || input.LA(1) == 65) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + } + break; + } + match(input, 75, FOLLOW_75_in_func349); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "func" + // $ANTLR start "func_and_alias" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:70:1: func_and_alias : func ( ( + // AS )? BASIC_NAME )? ; + public final void func_and_alias() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:71:2: ( func ( ( AS )? + // BASIC_NAME )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:2: func ( ( AS )? + // BASIC_NAME )? + { + pushFollow(FOLLOW_func_in_func_and_alias363); + func(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:7: ( ( AS )? + // BASIC_NAME )? + int alt23 = 2; + int LA23_0 = input.LA(1); + if ((LA23_0 == AS || LA23_0 == BASIC_NAME)) { + alt23 = 1; + } + switch (alt23) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:8: ( AS )? + // BASIC_NAME + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:8: ( AS )? + int alt22 = 2; + int LA22_0 = input.LA(1); + if ((LA22_0 == AS)) { + alt22 = 1; + } + switch (alt22) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:72:8: AS + { + match(input, AS, FOLLOW_AS_in_func_and_alias366); + } + break; + } + match(input, BASIC_NAME, + FOLLOW_BASIC_NAME_in_func_and_alias369); + } + break; + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "func_and_alias" + // $ANTLR start "select_column_and_alias" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:75:1: select_column_and_alias : + // column_name ( ( AS )? BASIC_NAME )? ; + public final void select_column_and_alias() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:76:2: ( column_name ( ( + // AS )? BASIC_NAME )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:2: column_name ( ( AS + // )? BASIC_NAME )? + { + pushFollow(FOLLOW_column_name_in_select_column_and_alias383); + column_name(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:14: ( ( AS )? + // BASIC_NAME )? + int alt25 = 2; + int LA25_0 = input.LA(1); + if ((LA25_0 == AS || LA25_0 == BASIC_NAME)) { + alt25 = 1; + } + switch (alt25) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:15: ( AS )? + // BASIC_NAME + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:15: ( AS )? + int alt24 = 2; + int LA24_0 = input.LA(1); + if ((LA24_0 == AS)) { + alt24 = 1; + } + switch (alt24) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:77:15: AS + { + match(input, AS, + FOLLOW_AS_in_select_column_and_alias386); + } + break; + } + match(input, BASIC_NAME, + FOLLOW_BASIC_NAME_in_select_column_and_alias389); + } + break; + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "select_column_and_alias" + // $ANTLR start "select_column" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:80:1: select_column : ( + // select_column_and_alias | func_and_alias | '*' ); + public final void select_column() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:81:2: ( + // select_column_and_alias | func_and_alias | '*' ) + int alt26 = 3; + int LA26_0 = input.LA(1); + if ((LA26_0 == BASIC_NAME)) { + int LA26_1 = input.LA(2); + if ((LA26_1 == 74)) { + alt26 = 2; + } + else if ((LA26_1 == AS || LA26_1 == BASIC_NAME + || LA26_1 == FROM || (LA26_1 >= 66 && LA26_1 <= 67))) { + alt26 = 1; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 26, 1, input); + throw nvae; + } + } + else if ((LA26_0 == 65)) { + alt26 = 3; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 26, 0, input); + throw nvae; + } + switch (alt26) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:82:2: + // select_column_and_alias + { + pushFollow(FOLLOW_select_column_and_alias_in_select_column403); + select_column_and_alias(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:82:26: func_and_alias + { + pushFollow(FOLLOW_func_and_alias_in_select_column405); + func_and_alias(); + state._fsp--; + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:82:41: '*' + { + match(input, 65, FOLLOW_65_in_select_column407); + } + break; + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "select_column" + // $ANTLR start "select_columns" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:85:1: select_columns : + // select_column ( ',' select_column )* ; + public final void select_columns() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:86:2: ( select_column ( + // ',' select_column )* ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:87:2: select_column ( ',' + // select_column )* + { + pushFollow(FOLLOW_select_column_in_select_columns420); + select_column(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:87:16: ( ',' + // select_column )* + loop27: do { + int alt27 = 2; + int LA27_0 = input.LA(1); + if ((LA27_0 == 66)) { + int LA27_1 = input.LA(2); + if ((LA27_1 == BASIC_NAME || LA27_1 == 65)) { + alt27 = 1; + } + } + switch (alt27) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:87:17: ',' + // select_column + { + match(input, 66, FOLLOW_66_in_select_columns423); + pushFollow(FOLLOW_select_column_in_select_columns425); + select_column(); + state._fsp--; + } + break; + default: + break loop27; + } + } + while (true); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "select_columns" + // $ANTLR start "and_or" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:90:1: and_or : ( AND | OR ); + public final void and_or() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:90:8: ( AND | OR ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == AND || input.LA(1) == OR) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "and_or" + // $ANTLR start "table" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:94:1: table : table_name ( ( AS + // )? alias )? ; + public final void table() throws RecognitionException { + AntlrV3SQLParser.table_name_return table_name1 = null; + AntlrV3SQLParser.alias_return alias2 = null; + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:94:7: ( table_name ( ( AS + // )? alias )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:2: table_name ( ( AS + // )? alias )? + { + pushFollow(FOLLOW_table_name_in_table455); + table_name1 = table_name(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:13: ( ( AS )? + // alias )? + int alt29 = 2; + int LA29_0 = input.LA(1); + if ((LA29_0 == AS || LA29_0 == BASIC_NAME)) { + alt29 = 1; + } + switch (alt29) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:14: ( AS )? alias + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:14: ( AS )? + int alt28 = 2; + int LA28_0 = input.LA(1); + if ((LA28_0 == AS)) { + alt28 = 1; + } + switch (alt28) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:95:15: AS + { + match(input, AS, FOLLOW_AS_in_table459); + } + break; + } + pushFollow(FOLLOW_alias_in_table463); + alias2 = alias(); + state._fsp--; + } + break; + } + if (this.antlrParserDelegate != null) { + this.antlrParserDelegate + .onFindTable( + (table_name1 != null ? input + .toString(table_name1.start, + table_name1.stop) : null), + (alias2 != null ? input.toString( + alias2.start, alias2.stop) : null)); + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "table" + // $ANTLR start "tables" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:101:1: tables : ( table ( ',' + // table )* ) ; + public final void tables() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:101:8: ( ( table ( ',' + // table )* ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:2: ( table ( ',' + // table )* ) + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:2: ( table ( ',' + // table )* ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:3: table ( ',' + // table )* + { + pushFollow(FOLLOW_table_in_tables479); + table(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:9: ( ',' + // table )* + loop30: do { + int alt30 = 2; + int LA30_0 = input.LA(1); + if ((LA30_0 == 66)) { + alt30 = 1; + } + switch (alt30) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:102:10: ',' + // table + { + match(input, 66, FOLLOW_66_in_tables482); + pushFollow(FOLLOW_table_in_tables484); + table(); + state._fsp--; + } + break; + default: + break loop30; + } + } + while (true); + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "tables" + public static class table_name_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "table_name" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:105:1: table_name : BASIC_NAME ( + // ( '.' ) BASIC_NAME )? ; + public final AntlrV3SQLParser.table_name_return table_name() + throws RecognitionException { + AntlrV3SQLParser.table_name_return retval = new AntlrV3SQLParser.table_name_return(); + retval.start = input.LT(1); + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:106:2: ( BASIC_NAME ( ( + // '.' ) BASIC_NAME )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:2: BASIC_NAME ( ( '.' + // ) BASIC_NAME )? + { + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_table_name500); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:13: ( ( '.' ) + // BASIC_NAME )? + int alt31 = 2; + int LA31_0 = input.LA(1); + if ((LA31_0 == 67)) { + alt31 = 1; + } + switch (alt31) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:14: ( '.' ) + // BASIC_NAME + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:14: ( '.' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:107:15: '.' + { + match(input, 67, FOLLOW_67_in_table_name504); + } + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_table_name507); + } + break; + } + } + retval.stop = input.LT(-1); + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "table_name" + public static class alias_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "alias" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:110:1: alias : BASIC_NAME ; + public final AntlrV3SQLParser.alias_return alias() + throws RecognitionException { + AntlrV3SQLParser.alias_return retval = new AntlrV3SQLParser.alias_return(); + retval.start = input.LT(1); + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:110:7: ( BASIC_NAME ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:111:2: BASIC_NAME + { + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_alias520); + } + retval.stop = input.LT(-1); + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "alias" + public static class column_name_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "column_name" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:114:1: column_name : BASIC_NAME ( + // ( '.' ) BASIC_NAME )? ; + public final AntlrV3SQLParser.column_name_return column_name() + throws RecognitionException { + AntlrV3SQLParser.column_name_return retval = new AntlrV3SQLParser.column_name_return(); + retval.start = input.LT(1); + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:115:2: ( BASIC_NAME ( ( + // '.' ) BASIC_NAME )? ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:2: BASIC_NAME ( ( '.' + // ) BASIC_NAME )? + { + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_column_name532); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:13: ( ( '.' ) + // BASIC_NAME )? + int alt32 = 2; + int LA32_0 = input.LA(1); + if ((LA32_0 == 67)) { + alt32 = 1; + } + switch (alt32) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:14: ( '.' ) + // BASIC_NAME + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:14: ( '.' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:116:15: '.' + { + match(input, 67, FOLLOW_67_in_column_name536); + } + match(input, BASIC_NAME, + FOLLOW_BASIC_NAME_in_column_name539); + } + break; + } + } + retval.stop = input.LT(-1); + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "column_name" + // $ANTLR start "insertColumn" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:119:1: insertColumn : column_name + // ; + public final void insertColumn() throws RecognitionException { + AntlrV3SQLParser.column_name_return column_name3 = null; + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:120:2: ( column_name ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:121:2: column_name + { + pushFollow(FOLLOW_column_name_in_insertColumn553); + column_name3 = column_name(); + state._fsp--; + if (this.antlrParserDelegate != null) { + this.antlrParserDelegate.onFindColExper( + (column_name3 != null ? input.toString( + column_name3.start, column_name3.stop) + : null), "="); + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "insertColumn" + // $ANTLR start "kv" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:131:1: kv : ( ( column_name op ( + // PRE_SET | '\\(' PRE_SET '\\)' ) ) | column_name op TEXT_STRING | ( + // column_name BETWEEN PRE_SET AND PRE_SET ) | column_name op column_name | + // column_name op func2 | column_name op '\\(' sql_select '\\)' ); + public final void kv() throws RecognitionException { + AntlrV3SQLParser.column_name_return column_name4 = null; + AntlrV3SQLParser.op_return op5 = null; + AntlrV3SQLParser.column_name_return column_name6 = null; + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:131:4: ( ( column_name op + // ( PRE_SET | '\\(' PRE_SET '\\)' ) ) | column_name op TEXT_STRING + // | ( column_name BETWEEN PRE_SET AND PRE_SET ) | column_name op + // column_name | column_name op func2 | column_name op '\\(' + // sql_select '\\)' ) + int alt34 = 6; + int LA34_0 = input.LA(1); + if ((LA34_0 == BASIC_NAME)) { + switch (input.LA(2)) { + case 67: { + int LA34_2 = input.LA(3); + if ((LA34_2 == BASIC_NAME)) { + int LA34_5 = input.LA(4); + if ((LA34_5 == EXISTS || LA34_5 == IN || LA34_5 == 64 || (LA34_5 >= 68 && LA34_5 <= 73))) { + switch (input.LA(5)) { + case PRE_SET: { + alt34 = 1; + } + break; + case 74: { + int LA34_7 = input.LA(6); + if ((LA34_7 == PRE_SET)) { + alt34 = 1; + } + else if ((LA34_7 == SELECT)) { + alt34 = 6; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 7, + input); + throw nvae; + } + } + break; + case TEXT_STRING: { + alt34 = 2; + } + break; + case BASIC_NAME: { + int LA34_9 = input.LA(6); + if ((LA34_9 == 74)) { + alt34 = 5; + } + else if ((LA34_9 == EOF || LA34_9 == AND + || LA34_9 == GROUP || LA34_9 == HAVING + || (LA34_9 >= OR && LA34_9 <= ORDER) + || LA34_9 == WHERE + || (LA34_9 >= 66 && LA34_9 <= 67) || LA34_9 == 75)) { + alt34 = 4; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 9, + input); + throw nvae; + } + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 34, 3, + input); + throw nvae; + } + } + else if ((LA34_5 == BETWEEN)) { + alt34 = 3; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 5, input); + throw nvae; + } + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 2, input); + throw nvae; + } + } + break; + case EXISTS: + case IN: + case 64: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: { + switch (input.LA(3)) { + case PRE_SET: { + alt34 = 1; + } + break; + case 74: { + int LA34_7 = input.LA(4); + if ((LA34_7 == PRE_SET)) { + alt34 = 1; + } + else if ((LA34_7 == SELECT)) { + alt34 = 6; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 7, input); + throw nvae; + } + } + break; + case TEXT_STRING: { + alt34 = 2; + } + break; + case BASIC_NAME: { + int LA34_9 = input.LA(4); + if ((LA34_9 == 74)) { + alt34 = 5; + } + else if ((LA34_9 == EOF || LA34_9 == AND + || LA34_9 == GROUP || LA34_9 == HAVING + || (LA34_9 >= OR && LA34_9 <= ORDER) + || LA34_9 == WHERE + || (LA34_9 >= 66 && LA34_9 <= 67) || LA34_9 == 75)) { + alt34 = 4; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 9, input); + throw nvae; + } + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 34, 3, input); + throw nvae; + } + } + break; + case BETWEEN: { + alt34 = 3; + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 34, 1, input); + throw nvae; + } + } + else { + NoViableAltException nvae = + new NoViableAltException("", 34, 0, input); + throw nvae; + } + switch (alt34) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:2: ( column_name op ( + // PRE_SET | '\\(' PRE_SET '\\)' ) ) + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:2: ( column_name + // op ( PRE_SET | '\\(' PRE_SET '\\)' ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:3: column_name op + // ( PRE_SET | '\\(' PRE_SET '\\)' ) + { + pushFollow(FOLLOW_column_name_in_kv570); + column_name4 = column_name(); + state._fsp--; + pushFollow(FOLLOW_op_in_kv572); + op5 = op(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:18: ( PRE_SET + // | '\\(' PRE_SET '\\)' ) + int alt33 = 2; + int LA33_0 = input.LA(1); + if ((LA33_0 == PRE_SET)) { + alt33 = 1; + } + else if ((LA33_0 == 74)) { + alt33 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 33, 0, input); + throw nvae; + } + switch (alt33) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:19: PRE_SET + { + match(input, PRE_SET, FOLLOW_PRE_SET_in_kv575); + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:132:27: '\\(' + // PRE_SET '\\)' + { + match(input, 74, FOLLOW_74_in_kv577); + match(input, PRE_SET, FOLLOW_PRE_SET_in_kv579); + match(input, 75, FOLLOW_75_in_kv581); + } + break; + } + } + if (this.antlrParserDelegate != null) { + this.antlrParserDelegate.onFindColExper( + (column_name4 != null ? input.toString( + column_name4.start, column_name4.stop) + : null), + (op5 != null ? input.toString(op5.start, op5.stop) + : null)); + } + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:139:2: column_name op + // TEXT_STRING + { + pushFollow(FOLLOW_column_name_in_kv592); + column_name(); + state._fsp--; + pushFollow(FOLLOW_op_in_kv594); + op(); + state._fsp--; + match(input, TEXT_STRING, FOLLOW_TEXT_STRING_in_kv596); + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:141:2: ( column_name + // BETWEEN PRE_SET AND PRE_SET ) + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:141:2: ( column_name + // BETWEEN PRE_SET AND PRE_SET ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:141:3: column_name + // BETWEEN PRE_SET AND PRE_SET + { + pushFollow(FOLLOW_column_name_in_kv603); + column_name6 = column_name(); + state._fsp--; + match(input, BETWEEN, FOLLOW_BETWEEN_in_kv605); + match(input, PRE_SET, FOLLOW_PRE_SET_in_kv607); + match(input, AND, FOLLOW_AND_in_kv609); + match(input, PRE_SET, FOLLOW_PRE_SET_in_kv611); + } + this.antlrParserDelegate.onFindColExper( + (column_name6 != null ? input.toString( + column_name6.start, column_name6.stop) : null), + ">="); + this.antlrParserDelegate.onFindColExper( + (column_name6 != null ? input.toString( + column_name6.start, column_name6.stop) : null), + "=<"); + } + break; + case 4: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:147:2: column_name op + // column_name + { + pushFollow(FOLLOW_column_name_in_kv622); + column_name(); + state._fsp--; + pushFollow(FOLLOW_op_in_kv624); + op(); + state._fsp--; + pushFollow(FOLLOW_column_name_in_kv626); + column_name(); + state._fsp--; + } + break; + case 5: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:149:2: column_name op + // func2 + { + pushFollow(FOLLOW_column_name_in_kv632); + column_name(); + state._fsp--; + pushFollow(FOLLOW_op_in_kv634); + op(); + state._fsp--; + pushFollow(FOLLOW_func2_in_kv636); + func2(); + state._fsp--; + } + break; + case 6: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:151:2: column_name op + // '\\(' sql_select '\\)' + { + pushFollow(FOLLOW_column_name_in_kv642); + column_name(); + state._fsp--; + pushFollow(FOLLOW_op_in_kv644); + op(); + state._fsp--; + match(input, 74, FOLLOW_74_in_kv646); + pushFollow(FOLLOW_sql_select_in_kv648); + sql_select(); + state._fsp--; + match(input, 75, FOLLOW_75_in_kv650); + } + break; + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "kv" + // $ANTLR start "func2" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:154:1: func2 : BASIC_NAME '\\(' ( + // ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING ) )* )? + // '\\)' ; + public final void func2() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:154:7: ( BASIC_NAME '\\(' + // ( ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING + // ) )* )? '\\)' ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:155:2: BASIC_NAME '\\(' ( + // ( column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING ) + // )* )? '\\)' + { + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_func2661); + match(input, 74, FOLLOW_74_in_func2665); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:157:2: ( ( + // column_name | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING + // ) )* )? + int alt38 = 2; + int LA38_0 = input.LA(1); + if ((LA38_0 == BASIC_NAME || LA38_0 == TEXT_STRING)) { + alt38 = 1; + } + switch (alt38) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:2: ( column_name + // | TEXT_STRING ) ( ',' ( column_name | TEXT_STRING ) )* + { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:2: ( + // column_name | TEXT_STRING ) + int alt35 = 2; + int LA35_0 = input.LA(1); + if ((LA35_0 == BASIC_NAME)) { + alt35 = 1; + } + else if ((LA35_0 == TEXT_STRING)) { + alt35 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 35, 0, input); + throw nvae; + } + switch (alt35) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:3: + // column_name + { + pushFollow(FOLLOW_column_name_in_func2673); + column_name(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:15: + // TEXT_STRING + { + match(input, TEXT_STRING, + FOLLOW_TEXT_STRING_in_func2675); + } + break; + } + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:28: ( ',' ( + // column_name | TEXT_STRING ) )* + loop37: do { + int alt37 = 2; + int LA37_0 = input.LA(1); + if ((LA37_0 == 66)) { + alt37 = 1; + } + switch (alt37) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:29: ',' ( + // column_name | TEXT_STRING ) + { + match(input, 66, FOLLOW_66_in_func2679); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:33: ( + // column_name | TEXT_STRING ) + int alt36 = 2; + int LA36_0 = input.LA(1); + if ((LA36_0 == BASIC_NAME)) { + alt36 = 1; + } + else if ((LA36_0 == TEXT_STRING)) { + alt36 = 2; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 36, 0, + input); + throw nvae; + } + switch (alt36) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:34: + // column_name + { + pushFollow(FOLLOW_column_name_in_func2682); + column_name(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:158:46: + // TEXT_STRING + { + match(input, TEXT_STRING, + FOLLOW_TEXT_STRING_in_func2684); + } + break; + } + } + break; + default: + break loop37; + } + } + while (true); + } + break; + } + match(input, 75, FOLLOW_75_in_func2694); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "func2" + public static class op_return extends ParserRuleReturnScope { + }; + + // $ANTLR start "op" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:163:1: op : ( '=' | '>' | '>=' | + // '<' | '<=' | '!=' | '<>' | IN | EXISTS ) ; + public final AntlrV3SQLParser.op_return op() throws RecognitionException { + AntlrV3SQLParser.op_return retval = new AntlrV3SQLParser.op_return(); + retval.start = input.LT(1); + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:164:2: ( ( '=' | '>' | + // '>=' | '<' | '<=' | '!=' | '<>' | IN | EXISTS ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == EXISTS || input.LA(1) == IN + || input.LA(1) == 64 + || (input.LA(1) >= 68 && input.LA(1) <= 73)) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + } + retval.stop = input.LT(-1); + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return retval; + } + + // $ANTLR end "op" + // $ANTLR start "orderby" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:168:1: orderby : ORDER BY + // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* ; + public final void orderby() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:168:9: ( ORDER BY + // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* + // ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:169:2: ORDER BY + // column_name ( DESC | ASC )? ( ',' column_name ( DESC | ASC )? )* + { + match(input, ORDER, FOLLOW_ORDER_in_orderby736); + match(input, BY, FOLLOW_BY_in_orderby738); + pushFollow(FOLLOW_column_name_in_orderby740); + column_name(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:169:23: ( DESC | ASC + // )? + int alt39 = 2; + int LA39_0 = input.LA(1); + if ((LA39_0 == ASC || LA39_0 == DESC)) { + alt39 = 1; + } + switch (alt39) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == ASC || input.LA(1) == DESC) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + } + break; + } + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:169:35: ( ',' + // column_name ( DESC | ASC )? )* + loop41: do { + int alt41 = 2; + int LA41_0 = input.LA(1); + if ((LA41_0 == 66)) { + alt41 = 1; + } + switch (alt41) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:169:36: ',' + // column_name ( DESC | ASC )? + { + match(input, 66, FOLLOW_66_in_orderby750); + pushFollow(FOLLOW_column_name_in_orderby752); + column_name(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:169:52: ( + // DESC | ASC )? + int alt40 = 2; + int LA40_0 = input.LA(1); + if ((LA40_0 == ASC || LA40_0 == DESC)) { + alt40 = 1; + } + switch (alt40) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g: + { + if (input.LA(1) == ASC || input.LA(1) == DESC) { + input.consume(); + state.errorRecovery = false; + } + else { + MismatchedSetException mse = new MismatchedSetException( + null, input); + throw mse; + } + } + break; + } + } + break; + default: + break loop41; + } + } + while (true); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "orderby" + // $ANTLR start "groupby" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:172:1: groupby : GROUP BY + // column_name ( ',' column_name )* ; + public final void groupby() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:172:9: ( GROUP BY + // column_name ( ',' column_name )* ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:173:2: GROUP BY + // column_name ( ',' column_name )* + { + match(input, GROUP, FOLLOW_GROUP_in_groupby773); + match(input, BY, FOLLOW_BY_in_groupby775); + pushFollow(FOLLOW_column_name_in_groupby777); + column_name(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:173:23: ( ',' + // column_name )* + loop42: do { + int alt42 = 2; + int LA42_0 = input.LA(1); + if ((LA42_0 == 66)) { + alt42 = 1; + } + switch (alt42) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:173:24: ',' + // column_name + { + match(input, 66, FOLLOW_66_in_groupby780); + pushFollow(FOLLOW_column_name_in_groupby782); + column_name(); + state._fsp--; + } + break; + default: + break loop42; + } + } + while (true); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "groupby" + // $ANTLR start "having" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:176:1: having : HAVING ( + // column_name | func ) op ( column_name | func | TEXT_STRING | PRE_SET ) ; + public final void having() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:176:8: ( HAVING ( + // column_name | func ) op ( column_name | func | TEXT_STRING | + // PRE_SET ) ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:2: HAVING ( + // column_name | func ) op ( column_name | func | TEXT_STRING | + // PRE_SET ) + { + match(input, HAVING, FOLLOW_HAVING_in_having795); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:9: ( column_name + // | func ) + int alt43 = 2; + int LA43_0 = input.LA(1); + if ((LA43_0 == BASIC_NAME)) { + int LA43_1 = input.LA(2); + if ((LA43_1 == 74)) { + alt43 = 2; + } + else if ((LA43_1 == EXISTS || LA43_1 == IN || LA43_1 == 64 || (LA43_1 >= 67 && LA43_1 <= 73))) { + alt43 = 1; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 43, 1, input); + throw nvae; + } + } + else { + NoViableAltException nvae = + new NoViableAltException("", 43, 0, input); + throw nvae; + } + switch (alt43) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:10: column_name + { + pushFollow(FOLLOW_column_name_in_having798); + column_name(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:22: func + { + pushFollow(FOLLOW_func_in_having800); + func(); + state._fsp--; + } + break; + } + pushFollow(FOLLOW_op_in_having803); + op(); + state._fsp--; + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:31: ( column_name + // | func | TEXT_STRING | PRE_SET ) + int alt44 = 4; + switch (input.LA(1)) { + case BASIC_NAME: { + int LA44_1 = input.LA(2); + if ((LA44_1 == 74)) { + alt44 = 2; + } + else if ((LA44_1 == EOF || LA44_1 == GROUP + || LA44_1 == HAVING || LA44_1 == ORDER + || LA44_1 == 67 || LA44_1 == 75)) { + alt44 = 1; + } + else { + NoViableAltException nvae = + new NoViableAltException("", 44, 1, input); + throw nvae; + } + } + break; + case TEXT_STRING: { + alt44 = 3; + } + break; + case PRE_SET: { + alt44 = 4; + } + break; + default: + NoViableAltException nvae = + new NoViableAltException("", 44, 0, input); + throw nvae; + } + switch (alt44) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:32: column_name + { + pushFollow(FOLLOW_column_name_in_having806); + column_name(); + state._fsp--; + } + break; + case 2: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:44: func + { + pushFollow(FOLLOW_func_in_having808); + func(); + state._fsp--; + } + break; + case 3: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:49: TEXT_STRING + { + match(input, TEXT_STRING, FOLLOW_TEXT_STRING_in_having810); + } + break; + case 4: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:177:61: PRE_SET + { + match(input, PRE_SET, FOLLOW_PRE_SET_in_having812); + } + break; + } + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "having" + // $ANTLR start "db2_paging" + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:180:1: db2_paging : ROWNUMBER + // '\\(' '\\)' OVER '\\(' orderby '\\)' ( AS )? BASIC_NAME ; + public final void db2_paging() throws RecognitionException { + try { + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:181:2: ( ROWNUMBER '\\(' + // '\\)' OVER '\\(' orderby '\\)' ( AS )? BASIC_NAME ) + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:182:2: ROWNUMBER '\\(' + // '\\)' OVER '\\(' orderby '\\)' ( AS )? BASIC_NAME + { + match(input, ROWNUMBER, FOLLOW_ROWNUMBER_in_db2_paging826); + match(input, 74, FOLLOW_74_in_db2_paging827); + match(input, 75, FOLLOW_75_in_db2_paging828); + match(input, OVER, FOLLOW_OVER_in_db2_paging830); + match(input, 74, FOLLOW_74_in_db2_paging831); + pushFollow(FOLLOW_orderby_in_db2_paging832); + orderby(); + state._fsp--; + match(input, 75, FOLLOW_75_in_db2_paging834); + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:182:41: ( AS )? + int alt45 = 2; + int LA45_0 = input.LA(1); + if ((LA45_0 == AS)) { + alt45 = 1; + } + switch (alt45) { + case 1: + // /Users/akwei/antlrpro/sql2/AntlrV3SQL.g:182:42: AS + { + match(input, AS, FOLLOW_AS_in_db2_paging837); + } + break; + } + match(input, BASIC_NAME, FOLLOW_BASIC_NAME_in_db2_paging841); + } + } + catch (RecognitionException re) { + reportError(re); + recover(input, re); + } + finally { + // do for sure before leaving + } + return; + } + + // $ANTLR end "db2_paging" + // Delegated rules + public static final BitSet FOLLOW_sql_insert_in_start23 = new BitSet( + new long[] { 0x0000000000000002L }); + + public static final BitSet FOLLOW_sql_delete_in_start25 = new BitSet( + new long[] { 0x0000000000000002L }); + + public static final BitSet FOLLOW_sql_update_in_start27 = new BitSet( + new long[] { 0x0000000000000002L }); + + public static final BitSet FOLLOW_sql_select_in_start29 = new BitSet( + new long[] { 0x0000000000000002L }); + + public static final BitSet FOLLOW_INSERT_in_sql_insert40 = new BitSet( + new long[] { 0x0000000040000000L }); + + public static final BitSet FOLLOW_INTO_in_sql_insert42 = new BitSet( + new long[] { 0x0000000000000200L }); + + public static final BitSet FOLLOW_table_in_sql_insert44 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); + + public static final BitSet FOLLOW_74_in_sql_insert46 = new BitSet( + new long[] { 0x0000000000000200L }); + + public static final BitSet FOLLOW_insertColumn_in_sql_insert48 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); + + public static final BitSet FOLLOW_66_in_sql_insert51 = new BitSet( + new long[] { 0x0000000000000200L }); + + public static final BitSet FOLLOW_insertColumn_in_sql_insert53 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); + + public static final BitSet FOLLOW_75_in_sql_insert57 = new BitSet( + new long[] { 0x0200000000000000L }); + + public static final BitSet FOLLOW_VALUES_in_sql_insert59 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); + + public static final BitSet FOLLOW_74_in_sql_insert61 = new BitSet( + new long[] { 0x0000100000000000L, 0x0000000000000804L }); + + public static final BitSet FOLLOW_PRE_SET_in_sql_insert64 = new BitSet( + new long[] { 0x0000100000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_DELETE_in_sql_delete86 = new BitSet( - new long[] { 0x0000000000100000L }); + public static final BitSet FOLLOW_66_in_sql_insert67 = new BitSet( + new long[] { 0x0000100000000000L }); - public static final BitSet FOLLOW_FROM_in_sql_delete88 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_PRE_SET_in_sql_insert69 = new BitSet( + new long[] { 0x0000100000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_table_in_sql_delete90 = new BitSet( - new long[] { 0x0200000000000000L }); + public static final BitSet FOLLOW_75_in_sql_insert74 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_where_in_sql_delete92 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_DELETE_in_sql_delete91 = new BitSet( + new long[] { 0x0000000000100000L }); - public static final BitSet FOLLOW_UPDATE_in_sql_update109 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_FROM_in_sql_delete93 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_table_in_sql_update111 = new BitSet( - new long[] { 0x0002000000000000L }); + public static final BitSet FOLLOW_table_in_sql_delete95 = new BitSet( + new long[] { 0x0800000000000002L }); - public static final BitSet FOLLOW_SET_in_sql_update113 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_WHERE_in_sql_delete98 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_kv_in_sql_update115 = new BitSet( - new long[] { 0x0200000000000000L, 0x0000000000000001L }); + public static final BitSet FOLLOW_kv_in_sql_delete100 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_64_in_sql_update118 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_and_or_in_sql_delete103 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_kv_in_sql_update120 = new BitSet( - new long[] { 0x0200000000000000L, 0x0000000000000001L }); + public static final BitSet FOLLOW_kv_in_sql_delete105 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_where_in_sql_update124 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_UPDATE_in_sql_update126 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_SELECT_in_sql_select141 = new BitSet( - new long[] { 0x8000000000000200L }); + public static final BitSet FOLLOW_table_in_sql_update128 = new BitSet( + new long[] { 0x0008000000000000L }); - public static final BitSet FOLLOW_func2_in_sql_select149 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_SET_in_sql_update130 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_select_columns_in_sql_select157 = new BitSet( - new long[] { 0x0000000000100000L }); + public static final BitSet FOLLOW_kv_in_sql_update132 = new BitSet( + new long[] { 0x0800000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_FROM_in_sql_select159 = new BitSet( - new long[] { 0x0000000000000200L, 0x0000000000000100L }); + public static final BitSet FOLLOW_66_in_sql_update135 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_sql_select_tables_in_sql_select173 = new BitSet( - new long[] { 0x0200020002800000L }); + public static final BitSet FOLLOW_kv_in_sql_update137 = new BitSet( + new long[] { 0x0800000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_where_in_sql_select175 = new BitSet( - new long[] { 0x0000020002800002L }); + public static final BitSet FOLLOW_WHERE_in_sql_update142 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_orderby_in_sql_select178 = new BitSet( - new long[] { 0x0000020002800002L }); + public static final BitSet FOLLOW_kv_in_sql_update144 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_groupby_in_sql_select180 = new BitSet( - new long[] { 0x0000020002800002L }); + public static final BitSet FOLLOW_and_or_in_sql_update147 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_having_in_sql_select182 = new BitSet( - new long[] { 0x0000020002800002L }); + public static final BitSet FOLLOW_kv_in_sql_update149 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_72_in_sql_select194 = new BitSet( - new long[] { 0x0001000000000000L }); + public static final BitSet FOLLOW_SELECT_in_sql_select171 = new BitSet( + new long[] { 0x0000000000000200L, 0x0000000000000002L }); - public static final BitSet FOLLOW_sql_select_in_sql_select196 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_select_columns_in_sql_select173 = new BitSet( + new long[] { 0x0000000000100000L, 0x0000000000000004L }); - public static final BitSet FOLLOW_73_in_sql_select198 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_66_in_sql_select176 = new BitSet( + new long[] { 0x0001000000000000L }); - public static final BitSet FOLLOW_tables_in_sql_select_tables222 = new BitSet( - new long[] { 0x0000400810202002L }); + public static final BitSet FOLLOW_db2_paging_in_sql_select177 = new BitSet( + new long[] { 0x0000000000100000L }); - public static final BitSet FOLLOW_set_in_sql_select_tables227 = new BitSet( - new long[] { 0x0000000100000000L }); + public static final BitSet FOLLOW_FROM_in_sql_select181 = new BitSet( + new long[] { 0x0000000000000200L, 0x0000000000000400L }); - public static final BitSet FOLLOW_JOIN_in_sql_select_tables239 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_sqlAfterFrom_in_sql_select184 = new BitSet( + new long[] { 0x0800020002800002L }); - public static final BitSet FOLLOW_table_in_sql_select_tables241 = new BitSet( - new long[] { 0x0000408810202002L }); + public static final BitSet FOLLOW_inner_select_in_sql_select186 = new BitSet( + new long[] { 0x0800020002800002L }); - public static final BitSet FOLLOW_ON_in_sql_select_tables244 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_WHERE_in_sql_select190 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_column_name_in_sql_select_tables246 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000020L }); + public static final BitSet FOLLOW_kv_sql_in_sql_select192 = new BitSet( + new long[] { 0x0000020002800002L }); - public static final BitSet FOLLOW_69_in_sql_select_tables248 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_orderby_in_sql_select197 = new BitSet( + new long[] { 0x0000020002800002L }); - public static final BitSet FOLLOW_column_name_in_sql_select_tables250 = new BitSet( - new long[] { 0x0000400810202002L }); + public static final BitSet FOLLOW_groupby_in_sql_select199 = new BitSet( + new long[] { 0x0000020002800002L }); - public static final BitSet FOLLOW_WHERE_in_where268 = new BitSet( - new long[] { 0x0000000000000200L, 0x0000000000000100L }); + public static final BitSet FOLLOW_having_in_sql_select201 = new BitSet( + new long[] { 0x0000020002800002L }); - public static final BitSet FOLLOW_sql_select_where_kv_all_in_where270 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_tables_in_sqlAfterFrom218 = new BitSet( + new long[] { 0x0000800810202002L }); - public static final BitSet FOLLOW_kv_in_sql_select_where_kv285 = new BitSet( - new long[] { 0x0000010000000022L }); + public static final BitSet FOLLOW_set_in_sqlAfterFrom221 = new BitSet( + new long[] { 0x0000000100000000L }); - public static final BitSet FOLLOW_and_or_in_sql_select_where_kv291 = new BitSet( - new long[] { 0x0000000000000200L, 0x0000000000000100L }); + public static final BitSet FOLLOW_JOIN_in_sqlAfterFrom233 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_kv_in_sql_select_where_kv300 = new BitSet( - new long[] { 0x0000010000000022L }); + public static final BitSet FOLLOW_table_in_sqlAfterFrom235 = new BitSet( + new long[] { 0x0000808810202002L }); - public static final BitSet FOLLOW_72_in_sql_select_where_kv309 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_ON_in_sqlAfterFrom238 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_kv_in_sql_select_where_kv311 = new BitSet( - new long[] { 0x0000010000000020L }); + public static final BitSet FOLLOW_column_name_in_sqlAfterFrom240 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000080L }); - public static final BitSet FOLLOW_and_or_in_sql_select_where_kv314 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_71_in_sqlAfterFrom242 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_sql_select_where_kv_in_sql_select_where_kv316 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_column_name_in_sqlAfterFrom244 = new BitSet( + new long[] { 0x0000800810202002L }); - public static final BitSet FOLLOW_73_in_sql_select_where_kv319 = new BitSet( - new long[] { 0x0000010000000022L }); + public static final BitSet FOLLOW_kv_sql_in_kv_sql_wrapper258 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_column_name_in_sql_select_where_kv330 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_74_in_kv_sql_wrapper262 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_op_in_sql_select_where_kv332 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_kv_sql_in_kv_sql_wrapper264 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_72_in_sql_select_where_kv334 = new BitSet( - new long[] { 0x0001000000000000L }); + public static final BitSet FOLLOW_75_in_kv_sql_wrapper266 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_sql_select_in_sql_select_where_kv336 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_kv_in_kv_sql277 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_73_in_sql_select_where_kv338 = new BitSet( - new long[] { 0x0000010000000022L }); + public static final BitSet FOLLOW_and_or_in_kv_sql281 = new BitSet( + new long[] { 0x0000000000000200L, 0x0000000000000400L }); - public static final BitSet FOLLOW_72_in_sql_select_where_kv349 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_kv_in_kv_sql284 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_column_name_in_sql_select_where_kv351 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_74_in_kv_sql288 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_op_in_sql_select_where_kv353 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_kv_in_kv_sql290 = new BitSet(new long[] { + 0x0000010000000020L, 0x0000000000000800L }); - public static final BitSet FOLLOW_72_in_sql_select_where_kv355 = new BitSet( - new long[] { 0x0001000000000000L }); + public static final BitSet FOLLOW_and_or_in_kv_sql293 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_sql_select_in_sql_select_where_kv357 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_kv_in_kv_sql295 = new BitSet(new long[] { + 0x0000010000000020L, 0x0000000000000800L }); - public static final BitSet FOLLOW_73_in_sql_select_where_kv359 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_75_in_kv_sql299 = new BitSet( + new long[] { 0x0000010000000022L }); - public static final BitSet FOLLOW_73_in_sql_select_where_kv361 = new BitSet( - new long[] { 0x0000010000000022L }); + public static final BitSet FOLLOW_74_in_inner_select316 = new BitSet( + new long[] { 0x0004000000000000L }); - public static final BitSet FOLLOW_sql_select_where_kv_in_sql_select_where_kv_all383 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_sql_select_in_inner_select318 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_72_in_sql_select_where_kv_all390 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_75_in_inner_select320 = new BitSet( + new long[] { 0x0000000000000242L }); - public static final BitSet FOLLOW_sql_select_where_kv_in_sql_select_where_kv_all392 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_AS_in_inner_select322 = new BitSet( + new long[] { 0x0000000000000202L }); - public static final BitSet FOLLOW_73_in_sql_select_where_kv_all394 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_BASIC_NAME_in_inner_select325 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_func407 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_BASIC_NAME_in_func338 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_72_in_func409 = new BitSet( - new long[] { 0x8000000000000200L }); + public static final BitSet FOLLOW_74_in_func340 = new BitSet(new long[] { + 0x0000000000000200L, 0x0000000000000802L }); - public static final BitSet FOLLOW_set_in_func411 = new BitSet(new long[] { - 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_75_in_func349 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_73_in_func417 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_func_in_func_and_alias363 = new BitSet( + new long[] { 0x0000000000000242L }); - public static final BitSet FOLLOW_func_in_func_and_alias431 = new BitSet( - new long[] { 0x0000000000000242L }); + public static final BitSet FOLLOW_AS_in_func_and_alias366 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_AS_in_func_and_alias434 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_BASIC_NAME_in_func_and_alias369 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_func_and_alias437 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_select_column_and_alias383 = new BitSet( + new long[] { 0x0000000000000242L }); - public static final BitSet FOLLOW_column_name_in_select_column_and_alias451 = new BitSet( - new long[] { 0x0000000000000242L }); + public static final BitSet FOLLOW_AS_in_select_column_and_alias386 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_AS_in_select_column_and_alias454 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_BASIC_NAME_in_select_column_and_alias389 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_select_column_and_alias457 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_select_column_and_alias_in_select_column403 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_select_column_and_alias_in_select_column471 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_func_and_alias_in_select_column405 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_func_and_alias_in_select_column473 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_65_in_select_column407 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_63_in_select_column475 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_select_column_in_select_columns420 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_select_column_in_select_columns488 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_66_in_select_columns423 = new BitSet( + new long[] { 0x0000000000000200L, 0x0000000000000002L }); - public static final BitSet FOLLOW_64_in_select_columns491 = new BitSet( - new long[] { 0x8000000000000200L }); + public static final BitSet FOLLOW_select_column_in_select_columns425 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_select_column_in_select_columns493 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_table_name_in_table455 = new BitSet( + new long[] { 0x0000000000000242L }); - public static final BitSet FOLLOW_table_name_in_table527 = new BitSet( - new long[] { 0x0000000000000242L }); + public static final BitSet FOLLOW_AS_in_table459 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_AS_in_table531 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_alias_in_table463 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_alias_in_table535 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_table_in_tables479 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_table_in_tables551 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_66_in_tables482 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_64_in_tables554 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_table_in_tables484 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_table_in_tables556 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_BASIC_NAME_in_table_name500 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000008L }); - public static final BitSet FOLLOW_BASIC_NAME_in_table_name572 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000002L }); + public static final BitSet FOLLOW_67_in_table_name504 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_65_in_table_name576 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_BASIC_NAME_in_table_name507 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_table_name579 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_BASIC_NAME_in_alias520 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_alias592 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_BASIC_NAME_in_column_name532 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000008L }); - public static final BitSet FOLLOW_BASIC_NAME_in_column_name604 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000002L }); + public static final BitSet FOLLOW_67_in_column_name536 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_65_in_column_name608 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_BASIC_NAME_in_column_name539 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_BASIC_NAME_in_column_name611 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_insertColumn553 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_column_name_in_insertColumn625 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_kv570 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_column_name_in_kv640 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_op_in_kv572 = new BitSet(new long[] { + 0x0000100000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_op_in_kv642 = new BitSet(new long[] { - 0x0000080000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_PRE_SET_in_kv575 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_PRE_SET_in_kv645 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_74_in_kv577 = new BitSet( + new long[] { 0x0000100000000000L }); - public static final BitSet FOLLOW_72_in_kv647 = new BitSet( - new long[] { 0x0000080000000000L }); + public static final BitSet FOLLOW_PRE_SET_in_kv579 = new BitSet(new long[] { + 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_PRE_SET_in_kv649 = new BitSet(new long[] { - 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_75_in_kv581 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_73_in_kv651 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_kv592 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_column_name_in_kv663 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_op_in_kv594 = new BitSet( + new long[] { 0x0020000000000000L }); - public static final BitSet FOLLOW_op_in_kv665 = new BitSet(new long[] { - 0x0008000000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_TEXT_STRING_in_kv596 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_TEXT_STRING_in_kv668 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_kv603 = new BitSet( + new long[] { 0x0000000000000400L }); - public static final BitSet FOLLOW_72_in_kv670 = new BitSet( - new long[] { 0x0008000000000000L }); + public static final BitSet FOLLOW_BETWEEN_in_kv605 = new BitSet( + new long[] { 0x0000100000000000L }); - public static final BitSet FOLLOW_TEXT_STRING_in_kv672 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_PRE_SET_in_kv607 = new BitSet( + new long[] { 0x0000000000000020L }); - public static final BitSet FOLLOW_73_in_kv674 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_AND_in_kv609 = new BitSet( + new long[] { 0x0000100000000000L }); - public static final BitSet FOLLOW_column_name_in_kv682 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_PRE_SET_in_kv611 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_op_in_kv684 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_column_name_in_kv622 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_column_name_in_kv686 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_op_in_kv624 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_column_name_in_kv692 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_column_name_in_kv626 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_op_in_kv694 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_column_name_in_kv632 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_func2_in_kv696 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_op_in_kv634 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_column_name_in_kv705 = new BitSet( - new long[] { 0x0000000000000400L }); + public static final BitSet FOLLOW_func2_in_kv636 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_opbetween_in_kv707 = new BitSet( - new long[] { 0x0000080000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_column_name_in_kv642 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_opand_in_kv709 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_op_in_kv644 = new BitSet(new long[] { + 0x0000000000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_BASIC_NAME_in_func2726 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_74_in_kv646 = new BitSet( + new long[] { 0x0004000000000000L }); - public static final BitSet FOLLOW_72_in_func2730 = new BitSet(new long[] { - 0x0008000000000200L, 0x0000000000000200L }); + public static final BitSet FOLLOW_sql_select_in_kv648 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_column_name_in_func2738 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); + public static final BitSet FOLLOW_75_in_kv650 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_TEXT_STRING_in_func2740 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); + public static final BitSet FOLLOW_BASIC_NAME_in_func2661 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_64_in_func2744 = new BitSet( - new long[] { 0x0008000000000200L }); + public static final BitSet FOLLOW_74_in_func2665 = new BitSet(new long[] { + 0x0020000000000200L, 0x0000000000000800L }); - public static final BitSet FOLLOW_column_name_in_func2747 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); + public static final BitSet FOLLOW_column_name_in_func2673 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_TEXT_STRING_in_func2749 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000201L }); + public static final BitSet FOLLOW_TEXT_STRING_in_func2675 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_73_in_func2759 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_66_in_func2679 = new BitSet( + new long[] { 0x0020000000000200L }); - public static final BitSet FOLLOW_BETWEEN_in_opbetween800 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_column_name_in_func2682 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_PRE_SET_in_opand810 = new BitSet( - new long[] { 0x0000000000000020L }); + public static final BitSet FOLLOW_TEXT_STRING_in_func2684 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000804L }); - public static final BitSet FOLLOW_72_in_opand812 = new BitSet( - new long[] { 0x0000080000000000L }); + public static final BitSet FOLLOW_75_in_func2694 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_PRE_SET_in_opand814 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_ORDER_in_orderby736 = new BitSet( + new long[] { 0x0000000000000800L }); - public static final BitSet FOLLOW_73_in_opand816 = new BitSet( - new long[] { 0x0000000000000020L }); + public static final BitSet FOLLOW_BY_in_orderby738 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_AND_in_opand819 = new BitSet(new long[] { - 0x0000080000000000L, 0x0000000000000100L }); + public static final BitSet FOLLOW_column_name_in_orderby740 = new BitSet( + new long[] { 0x0000000000010082L, 0x0000000000000004L }); - public static final BitSet FOLLOW_PRE_SET_in_opand822 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_66_in_orderby750 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_72_in_opand824 = new BitSet( - new long[] { 0x0000080000000000L }); + public static final BitSet FOLLOW_column_name_in_orderby752 = new BitSet( + new long[] { 0x0000000000010082L, 0x0000000000000004L }); - public static final BitSet FOLLOW_PRE_SET_in_opand826 = new BitSet( - new long[] { 0x0000000000000000L, 0x0000000000000200L }); + public static final BitSet FOLLOW_GROUP_in_groupby773 = new BitSet( + new long[] { 0x0000000000000800L }); - public static final BitSet FOLLOW_73_in_opand828 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_BY_in_groupby775 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_ORDER_in_orderby840 = new BitSet( - new long[] { 0x0000000000000800L }); + public static final BitSet FOLLOW_column_name_in_groupby777 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_BY_in_orderby842 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_66_in_groupby780 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_column_name_in_orderby844 = new BitSet( - new long[] { 0x0000000000010082L, 0x0000000000000001L }); + public static final BitSet FOLLOW_column_name_in_groupby782 = new BitSet( + new long[] { 0x0000000000000002L, 0x0000000000000004L }); - public static final BitSet FOLLOW_64_in_orderby854 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_HAVING_in_having795 = new BitSet( + new long[] { 0x0000000000000200L }); - public static final BitSet FOLLOW_column_name_in_orderby856 = new BitSet( - new long[] { 0x0000000000010082L, 0x0000000000000001L }); + public static final BitSet FOLLOW_column_name_in_having798 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_GROUP_in_groupby877 = new BitSet( - new long[] { 0x0000000000000800L }); + public static final BitSet FOLLOW_func_in_having800 = new BitSet( + new long[] { 0x0000000008040000L, 0x00000000000003F1L }); - public static final BitSet FOLLOW_BY_in_groupby879 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_op_in_having803 = new BitSet( + new long[] { 0x0020100000000200L }); - public static final BitSet FOLLOW_column_name_in_groupby881 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_column_name_in_having806 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_64_in_groupby884 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_func_in_having808 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_column_name_in_groupby886 = new BitSet( - new long[] { 0x0000000000000002L, 0x0000000000000001L }); + public static final BitSet FOLLOW_TEXT_STRING_in_having810 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_HAVING_in_having899 = new BitSet( - new long[] { 0x0000000000000200L }); + public static final BitSet FOLLOW_PRE_SET_in_having812 = new BitSet( + new long[] { 0x0000000000000002L }); - public static final BitSet FOLLOW_column_name_in_having902 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_ROWNUMBER_in_db2_paging826 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_func_in_having904 = new BitSet( - new long[] { 0x4000000008040000L, 0x00000000000000FCL }); + public static final BitSet FOLLOW_74_in_db2_paging827 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_op_in_having907 = new BitSet( - new long[] { 0x0008080000000200L }); + public static final BitSet FOLLOW_75_in_db2_paging828 = new BitSet( + new long[] { 0x0000040000000000L }); - public static final BitSet FOLLOW_column_name_in_having910 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_OVER_in_db2_paging830 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000400L }); - public static final BitSet FOLLOW_func_in_having912 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_74_in_db2_paging831 = new BitSet( + new long[] { 0x0000020000000000L }); - public static final BitSet FOLLOW_TEXT_STRING_in_having914 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_orderby_in_db2_paging832 = new BitSet( + new long[] { 0x0000000000000000L, 0x0000000000000800L }); - public static final BitSet FOLLOW_PRE_SET_in_having916 = new BitSet( - new long[] { 0x0000000000000002L }); + public static final BitSet FOLLOW_75_in_db2_paging834 = new BitSet( + new long[] { 0x0000000000000240L }); + + public static final BitSet FOLLOW_AS_in_db2_paging837 = new BitSet( + new long[] { 0x0000000000000200L }); + + public static final BitSet FOLLOW_BASIC_NAME_in_db2_paging841 = new BitSet( + new long[] { 0x0000000000000002L }); } \ No newline at end of file diff --git a/src/main/java/halo/dal/analysis/antlr/v3/CopyOfAntlrV3SQLAnalyzer.java b/src/main/java/halo/dal/analysis/antlr/v3/CopyOfAntlrV3SQLAnalyzer.java deleted file mode 100644 index 13cc490..0000000 --- a/src/main/java/halo/dal/analysis/antlr/v3/CopyOfAntlrV3SQLAnalyzer.java +++ /dev/null @@ -1,131 +0,0 @@ -package halo.dal.analysis.antlr.v3; - -import halo.dal.analysis.ColumnExper; -import halo.dal.analysis.ParsedTableInfo; -import halo.dal.analysis.SQLAnalyzer; -import halo.dal.analysis.SQLExpression; -import halo.dal.analysis.SQLInfo; -import halo.dal.analysis.SQLKeyErrException; -import halo.dal.analysis.SQLStruct; -import halo.dal.analysis.antlr.AntlrParserDelegate; -import halo.dal.analysis.antlr.ColExpr; -import halo.dal.analysis.antlr.DefAntlrParserDelegate; -import halo.dal.analysis.antlr.SQLInfoImpl; -import halo.dal.analysis.antlr.Table; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.antlr.runtime.ANTLRStringStream; -import org.antlr.runtime.CommonTokenStream; -import org.antlr.runtime.RecognitionException; -import org.apache.commons.lang3.StringUtils; - -public class CopyOfAntlrV3SQLAnalyzer implements SQLAnalyzer { - - protected final static String SQL_BLANK = " "; - - protected final static String SQL_KEY_SELECT = "select "; - - protected final static String SQL_KEY_SELECT_ = "SELECT "; - - public SQLInfo analyse(String sql, SQLStruct sqlStruct, Object[] values, - Map context) { - SQLInfoImpl info = new SQLInfoImpl(); - SQLExpression sqlExpression; - int i = 0; - for (ColumnExper o : sqlStruct.getColumnExpers()) { - sqlExpression = new SQLExpression(); - sqlExpression.setColumn(o.getColumn()); - sqlExpression.setSqlExpressionSymbol(o.getSqlExpressionSymbol()); - sqlExpression.setValue(values[i]); - info.addSQLExpression(o.getLogicTableName(), sqlExpression); - i++; - } - return info; - } - - public SQLStruct parse(String sql, Map context) { - if (sql.indexOf(" between ") != -1 || sql.indexOf(" BETWEEN ") != -1) { - throw new SQLKeyErrException("not supported sql key: between "); - } - String _sql = sql.replaceAll("\\. {1,}", "\\.").trim(); - // 对于只运行数据库函数时,不需要解析 - SQLStruct sqlStruct = new SQLStruct(); - if (_sql.startsWith(SQL_KEY_SELECT) || _sql.startsWith(SQL_KEY_SELECT_)) { - if (_sql.indexOf(" from ") == -1 && _sql.indexOf(" FROM ") == -1) { - sqlStruct.setCanParse(false); - return sqlStruct; - } - } - sqlStruct.setCanParse(true); - AntlrV3SQLLexer lexer = new AntlrV3SQLLexer(new ANTLRStringStream(_sql)); - CommonTokenStream tokens = new CommonTokenStream(lexer); - AntlrV3SQLParser parser = new AntlrV3SQLParser(tokens); - AntlrParserDelegate delegate = new DefAntlrParserDelegate(); - parser.setAntlrParserDelegate(delegate); - try { - parser.start(); - } - catch (RecognitionException e) { - throw new RuntimeException(e); - } - Table table; - for (int i = 0; i < delegate.getTables().size(); i++) { - table = delegate.getTables().get(i); - sqlStruct.addTable(table.getName(), table.getAlias()); - } - ColumnExper columnExper; - for (ColExpr colExpr : delegate.getColExprs()) { - columnExper = new ColumnExper(); - columnExper.setColumn(colExpr.getColumn()); - columnExper.setSqlExpressionSymbol(colExpr.getOp()); - sqlStruct.addColumnExper(columnExper); - } - return sqlStruct; - } - - public String outPutSQL(String sql, SQLStruct sqlStruct, SQLInfo sqlInfo, - ParsedTableInfo parsedTableInfo) { - List list = new ArrayList(); - List newList = new ArrayList(); - String realTableName; - for (String tableName : sqlStruct.getTableNames()) { - realTableName = parsedTableInfo.getRealTable(tableName); - if (realTableName != null) { - String alias = sqlStruct.getAliasByTableName(tableName); - boolean isSame = alias != null && alias.endsWith(tableName); - if (!isSame) { - list.add(SQL_BLANK + tableName + "."); - newList.add(SQL_BLANK + realTableName + "."); - } - list.add(SQL_BLANK + tableName + SQL_BLANK); - newList.add(SQL_BLANK + realTableName + SQL_BLANK); - list.add(SQL_BLANK + tableName + "("); - newList.add(" " + realTableName + "("); - list.add("," + tableName + SQL_BLANK); - newList.add("," + realTableName + SQL_BLANK); - } - } - String _sql = StringUtils.replaceEach(sql, - list.toArray(new String[list.size()]), - newList.toArray(new String[newList.size()])); - // 解决sql结束字符串为表名,无法解析的问题例如 delete form user - String str; - for (String tableName : sqlStruct.getTableNames()) { - realTableName = parsedTableInfo.getRealTable(tableName); - if (realTableName != null) { - str = SQL_BLANK + tableName; - int idx = _sql.lastIndexOf(str); - if (idx == -1) { - continue; - } - if (_sql.substring(idx).equals(str)) { - _sql = _sql.substring(0, idx) + SQL_BLANK + realTableName; - } - } - } - return _sql; - } -} diff --git a/src/main/java/halo/dal/analysis/antlr/v3/sql.txt b/src/main/java/halo/dal/analysis/antlr/v3/sql.txt index a4b4e24..0bddd71 100644 --- a/src/main/java/halo/dal/analysis/antlr/v3/sql.txt +++ b/src/main/java/halo/dal/analysis/antlr/v3/sql.txt @@ -18,7 +18,7 @@ FROM SELECT n.ID AS nodeId, n.name AS nodeName , f.name AS taskflowName, f.version AS taskflowVersion FROM HT_TASK_FLOW_NODE_WA_2 n, HT_TASK_FLOW_WA_2 f - WHERE n.owner = ? AND name >= ? and name <= ? and + WHERE n.owner = ? AND name between ? and ? and ( n.STATUS IN (?) AND n.GMT_MODIFIED < ? AND n.IS_AUTO = 'Y' AND n.task_flow_id = f.id ) @@ -43,5 +43,6 @@ substring(a.b,'c',b,b.c,'') substring('') select * from( -select id, name, rownumber() over(order by id asc) as rowid from db2.table_name -) temp where temp.rowid >= startNumber and temp.rowid <= endNumber \ No newline at end of file + select id, name, rownumber() over(order by id asc) as rowid from db2.table_name +) temp where temp.rowid >= startNumber and temp.rowid <= endNumber; + diff --git a/src/main/java/halo/dal/sql/DALConnection.java b/src/main/java/halo/dal/sql/DALConnection.java index a9a7602..f99d288 100644 --- a/src/main/java/halo/dal/sql/DALConnection.java +++ b/src/main/java/halo/dal/sql/DALConnection.java @@ -30,350 +30,349 @@ */ public class DALConnection implements Connection { - /** - * 保存了真正的Connection - */ - private final Map conMap = new HashMap(); - - private boolean autoCommit = true; - - private int transactionIsolation = 0; - - private int holdability = 0; - - private boolean readOnly = false; - - private String catalog = null; - - private Map> typeMap = null; - - /** - * 自定义的数据源 - */ - private DALDataSource dalDataSource; - - public DALConnection(DALDataSource dalDataSource) throws SQLException { - this.dalDataSource = dalDataSource; - this.setAutoCommit(true); - } - - public void clearWarnings() throws SQLException { - this.getCurrentConnection().clearWarnings(); - } - - public void close() throws SQLException { - Collection c = this.conMap.values(); - for (Connection con : c) { - con.close(); - } - // DALDataSourceStatus.removeCurrentDsKey(); - DALCurrentStatus.remove(); - } - - public void commit() throws SQLException { - Collection c = this.conMap.values(); - for (Connection con : c) { - con.commit(); - } - } - - public Statement createStatement() throws SQLException { - return this.getCurrentConnection().createStatement(); - } - - /** - * 获得当前需要使用的Connection - * - * @return - */ - public Connection getCurrentConnection() { - String name = DALCurrentStatus.getDsKey(); - if (name == null) { - throw new DALRunTimeException("can not get dsKey"); - } - Connection con = this.conMap.get(name); - if (con == null) { - try { - con = this.dalDataSource.getCurrentDataSource().getConnection(); - this.initCurrentConnection(con); - this.conMap.put(name, con); - } - catch (SQLException e) { - throw new DALRunTimeException(e); - } - } - return con; - } - - /** - * 获得正在使用的Connection - * - * @return - */ - private Connection getConnectionInUsing() { - String name = DALCurrentStatus.getDsKey(); - if (name == null) { - return null; - } - return this.conMap.get(name); - } - - private void initCurrentConnection(Connection con) throws SQLException { - if (this.transactionIsolation != 0) { - con.setTransactionIsolation(this.transactionIsolation); - } - if (this.getHoldability() != 0) { - con.setHoldability(this.holdability); - } - if (!this.autoCommit) { - con.setAutoCommit(this.autoCommit); - } - con.setReadOnly(this.readOnly); - if (this.catalog != null) { - con.setCatalog(this.catalog); - } - if (typeMap != null) { - con.setTypeMap(typeMap); - } - } - - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - return this.getCurrentConnection().createStatement(resultSetType, - resultSetConcurrency); - } - - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return this.getCurrentConnection().createStatement(resultSetType, - resultSetConcurrency, resultSetHoldability); - } - - public boolean getAutoCommit() throws SQLException { - return this.autoCommit; - } - - public int getHoldability() throws SQLException { - return this.holdability; - } - - public DatabaseMetaData getMetaData() throws SQLException { - return this.getCurrentConnection().getMetaData(); - } - - public int getTransactionIsolation() throws SQLException { - return this.transactionIsolation; - } - - public Map> getTypeMap() throws SQLException { - return this.getCurrentConnection().getTypeMap(); - } - - public SQLWarning getWarnings() throws SQLException { - return this.getCurrentConnection().getWarnings(); - } - - public boolean isClosed() throws SQLException { - Connection con = this.getConnectionInUsing(); - if (con == null) { - return false; - } - return con.isClosed(); - } - - public boolean isReadOnly() throws SQLException { - return this.readOnly; - } - - public String nativeSQL(String sql) throws SQLException { - return this.getCurrentConnection().nativeSQL(sql); - } - - public CallableStatement prepareCall(String sql) throws SQLException { - return this.getCurrentConnection().prepareCall(sql); - } - - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - return this.getCurrentConnection().prepareCall(sql, resultSetType, - resultSetConcurrency); - } - - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return this.getCurrentConnection().prepareCall(sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - } - - public PreparedStatement prepareStatement(String sql) throws SQLException { - DALPreparedStatement ps = this.createDALDalPreparedStatement(sql); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S); - return ps; - } - - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - DALPreparedStatement ps = (DALPreparedStatement) this - .prepareStatement(sql); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I); - ps.setAutoGeneratedKeys(autoGeneratedKeys); - return ps; - } - - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - DALPreparedStatement ps = (DALPreparedStatement) this.prepareStatement( - sql, Statement.RETURN_GENERATED_KEYS); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_$I); - ps.setColumnIndexes(columnIndexes); - return ps; - } - - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - DALPreparedStatement ps = (DALPreparedStatement) this.prepareStatement( - sql, Statement.RETURN_GENERATED_KEYS); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_$S); - ps.setColumnNames(columnNames); - return ps; - } - - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - DALPreparedStatement ps = (DALPreparedStatement) this - .prepareStatement(sql); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I_I); - ps.setResultSetType(resultSetType); - ps.setResultSetConcurrency(resultSetConcurrency); - return ps; - } - - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - DALPreparedStatement ps = (DALPreparedStatement) this - .prepareStatement(sql); - ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I_I_I); - ps.setResultSetType(resultSetType); - ps.setResultSetConcurrency(resultSetConcurrency); - ps.setResultSetHoldability(resultSetHoldability); - return ps; - } - - public void rollback() throws SQLException { - Collection c = conMap.values(); - for (Connection con : c) { - con.rollback(); - } - } - - public void setAutoCommit(boolean autoCommit) throws SQLException { - this.autoCommit = autoCommit; - } - - public void setCatalog(String catalog) throws SQLException { - this.catalog = catalog; - } - - public String getCatalog() throws SQLException { - return this.getCurrentConnection().getCatalog(); - } - - public void setHoldability(int holdability) throws SQLException { - this.holdability = holdability; - } - - public void setReadOnly(boolean readOnly) throws SQLException { - this.readOnly = readOnly; - } - - public void setTransactionIsolation(int level) throws SQLException { - this.transactionIsolation = level; - } - - public void setTypeMap(Map> map) throws SQLException { - this.typeMap = map; - } - - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - throw new SQLException("dal do not support savepoint"); - } - - public void rollback(Savepoint savepoint) throws SQLException { - throw new SQLException("dal do not support savepoint"); - } - - public Savepoint setSavepoint() throws SQLException { - throw new SQLException("dal do not support savepoint"); - } - - public Savepoint setSavepoint(String name) throws SQLException { - throw new SQLException("dal do not support savepoint"); - } - - public Array createArrayOf(String typeName, Object[] elements) - throws SQLException { - return this.getCurrentConnection().createArrayOf(typeName, elements); - } - - public Blob createBlob() throws SQLException { - return this.getCurrentConnection().createBlob(); - } - - public Clob createClob() throws SQLException { - return this.getCurrentConnection().createClob(); - } - - public NClob createNClob() throws SQLException { - return this.getCurrentConnection().createNClob(); - } - - public SQLXML createSQLXML() throws SQLException { - return this.getCurrentConnection().createSQLXML(); - } - - public Struct createStruct(String typeName, Object[] attributes) - throws SQLException { - return this.getCurrentConnection().createStruct(typeName, attributes); - } - - public Properties getClientInfo() throws SQLException { - return this.getCurrentConnection().getClientInfo(); - } - - public String getClientInfo(String name) throws SQLException { - Connection con = this.getCurrentConnection(); - return con.getClientInfo(name); - } - - public boolean isValid(int timeout) throws SQLException { - return this.getCurrentConnection().isValid(timeout); - } - - public void setClientInfo(Properties properties) - throws SQLClientInfoException { - this.getCurrentConnection().setClientInfo(properties); - } - - public void setClientInfo(String name, String value) - throws SQLClientInfoException { - this.getCurrentConnection().setClientInfo(name, value); - } - - public boolean isWrapperFor(Class iface) throws SQLException { - return this.getCurrentConnection().isWrapperFor(iface); - } - - public T unwrap(Class iface) throws SQLException { - return this.getCurrentConnection().unwrap(iface); - } - - private DALPreparedStatement createDALDalPreparedStatement(String sql) { - DALPreparedStatement ps = new DALPreparedStatement(); - ps.setDalConnection(this); - ps.setSql(sql); - return ps; - } + /** + * 保存了真正的Connection + */ + private final Map conMap = new HashMap(); + + private boolean autoCommit = true; + + private int transactionIsolation = 0; + + private int holdability = 0; + + private boolean readOnly = false; + + private String catalog = null; + + private Map> typeMap = null; + + /** + * 自定义的数据源 + */ + private DALDataSource dalDataSource; + + public DALConnection(DALDataSource dalDataSource) throws SQLException { + this.dalDataSource = dalDataSource; + this.setAutoCommit(true); + } + + public void clearWarnings() throws SQLException { + this.getCurrentConnection().clearWarnings(); + } + + public void close() throws SQLException { + Collection c = this.conMap.values(); + for (Connection con : c) { + con.close(); + } + DALCurrentStatus.remove(); + } + + public void commit() throws SQLException { + Collection c = this.conMap.values(); + for (Connection con : c) { + con.commit(); + } + } + + public Statement createStatement() throws SQLException { + return this.getCurrentConnection().createStatement(); + } + + /** + * 获得当前需要使用的Connection + * + * @return + */ + public Connection getCurrentConnection() { + String name = DALCurrentStatus.getDsKey(); + if (name == null) { + throw new DALRunTimeException("can not get dsKey"); + } + Connection con = this.conMap.get(name); + if (con == null) { + try { + con = this.dalDataSource.getCurrentDataSource().getConnection(); + this.initCurrentConnection(con); + this.conMap.put(name, con); + } + catch (SQLException e) { + throw new DALRunTimeException(e); + } + } + return con; + } + + /** + * 获得正在使用的Connection + * + * @return + */ + private Connection getConnectionInUsing() { + String name = DALCurrentStatus.getDsKey(); + if (name == null) { + return null; + } + return this.conMap.get(name); + } + + private void initCurrentConnection(Connection con) throws SQLException { + if (this.transactionIsolation != 0) { + con.setTransactionIsolation(this.transactionIsolation); + } + if (this.getHoldability() != 0) { + con.setHoldability(this.holdability); + } + if (!this.autoCommit) { + con.setAutoCommit(this.autoCommit); + } + con.setReadOnly(this.readOnly); + if (this.catalog != null) { + con.setCatalog(this.catalog); + } + if (typeMap != null) { + con.setTypeMap(typeMap); + } + } + + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + return this.getCurrentConnection().createStatement(resultSetType, + resultSetConcurrency); + } + + public Statement createStatement(int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return this.getCurrentConnection().createStatement(resultSetType, + resultSetConcurrency, resultSetHoldability); + } + + public boolean getAutoCommit() throws SQLException { + return this.autoCommit; + } + + public int getHoldability() throws SQLException { + return this.holdability; + } + + public DatabaseMetaData getMetaData() throws SQLException { + return this.getCurrentConnection().getMetaData(); + } + + public int getTransactionIsolation() throws SQLException { + return this.transactionIsolation; + } + + public Map> getTypeMap() throws SQLException { + return this.getCurrentConnection().getTypeMap(); + } + + public SQLWarning getWarnings() throws SQLException { + return this.getCurrentConnection().getWarnings(); + } + + public boolean isClosed() throws SQLException { + Connection con = this.getConnectionInUsing(); + if (con == null) { + return false; + } + return con.isClosed(); + } + + public boolean isReadOnly() throws SQLException { + return this.readOnly; + } + + public String nativeSQL(String sql) throws SQLException { + return this.getCurrentConnection().nativeSQL(sql); + } + + public CallableStatement prepareCall(String sql) throws SQLException { + return this.getCurrentConnection().prepareCall(sql); + } + + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + return this.getCurrentConnection().prepareCall(sql, resultSetType, + resultSetConcurrency); + } + + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + return this.getCurrentConnection().prepareCall(sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + } + + public PreparedStatement prepareStatement(String sql) throws SQLException { + DALPreparedStatement ps = this.createDALDalPreparedStatement(sql); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S); + return ps; + } + + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException { + DALPreparedStatement ps = (DALPreparedStatement) this + .prepareStatement(sql); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I); + ps.setAutoGeneratedKeys(autoGeneratedKeys); + return ps; + } + + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) + throws SQLException { + DALPreparedStatement ps = (DALPreparedStatement) this.prepareStatement( + sql, Statement.RETURN_GENERATED_KEYS); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_$I); + ps.setColumnIndexes(columnIndexes); + return ps; + } + + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException { + DALPreparedStatement ps = (DALPreparedStatement) this.prepareStatement( + sql, Statement.RETURN_GENERATED_KEYS); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_$S); + ps.setColumnNames(columnNames); + return ps; + } + + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + DALPreparedStatement ps = (DALPreparedStatement) this + .prepareStatement(sql); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I_I); + ps.setResultSetType(resultSetType); + ps.setResultSetConcurrency(resultSetConcurrency); + return ps; + } + + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + DALPreparedStatement ps = (DALPreparedStatement) this + .prepareStatement(sql); + ps.setCreateMethodByCon(DALPreparedStatement.CREATE_METHOD_BY_CON_S_I_I_I); + ps.setResultSetType(resultSetType); + ps.setResultSetConcurrency(resultSetConcurrency); + ps.setResultSetHoldability(resultSetHoldability); + return ps; + } + + public void rollback() throws SQLException { + Collection c = conMap.values(); + for (Connection con : c) { + con.rollback(); + } + } + + public void setAutoCommit(boolean autoCommit) throws SQLException { + this.autoCommit = autoCommit; + } + + public void setCatalog(String catalog) throws SQLException { + this.catalog = catalog; + } + + public String getCatalog() throws SQLException { + return this.getCurrentConnection().getCatalog(); + } + + public void setHoldability(int holdability) throws SQLException { + this.holdability = holdability; + } + + public void setReadOnly(boolean readOnly) throws SQLException { + this.readOnly = readOnly; + } + + public void setTransactionIsolation(int level) throws SQLException { + this.transactionIsolation = level; + } + + public void setTypeMap(Map> map) throws SQLException { + this.typeMap = map; + } + + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + throw new SQLException("dal do not support savepoint"); + } + + public void rollback(Savepoint savepoint) throws SQLException { + throw new SQLException("dal do not support savepoint"); + } + + public Savepoint setSavepoint() throws SQLException { + throw new SQLException("dal do not support savepoint"); + } + + public Savepoint setSavepoint(String name) throws SQLException { + throw new SQLException("dal do not support savepoint"); + } + + public Array createArrayOf(String typeName, Object[] elements) + throws SQLException { + return this.getCurrentConnection().createArrayOf(typeName, elements); + } + + public Blob createBlob() throws SQLException { + return this.getCurrentConnection().createBlob(); + } + + public Clob createClob() throws SQLException { + return this.getCurrentConnection().createClob(); + } + + public NClob createNClob() throws SQLException { + return this.getCurrentConnection().createNClob(); + } + + public SQLXML createSQLXML() throws SQLException { + return this.getCurrentConnection().createSQLXML(); + } + + public Struct createStruct(String typeName, Object[] attributes) + throws SQLException { + return this.getCurrentConnection().createStruct(typeName, attributes); + } + + public Properties getClientInfo() throws SQLException { + return this.getCurrentConnection().getClientInfo(); + } + + public String getClientInfo(String name) throws SQLException { + Connection con = this.getCurrentConnection(); + return con.getClientInfo(name); + } + + public boolean isValid(int timeout) throws SQLException { + return this.getCurrentConnection().isValid(timeout); + } + + public void setClientInfo(Properties properties) + throws SQLClientInfoException { + this.getCurrentConnection().setClientInfo(properties); + } + + public void setClientInfo(String name, String value) + throws SQLClientInfoException { + this.getCurrentConnection().setClientInfo(name, value); + } + + public boolean isWrapperFor(Class iface) throws SQLException { + return this.getCurrentConnection().isWrapperFor(iface); + } + + public T unwrap(Class iface) throws SQLException { + return this.getCurrentConnection().unwrap(iface); + } + + private DALPreparedStatement createDALDalPreparedStatement(String sql) { + DALPreparedStatement ps = new DALPreparedStatement(); + ps.setDalConnection(this); + ps.setSql(sql); + return ps; + } } \ No newline at end of file diff --git a/src/main/java/halo/dal/sql/DALPreparedStatement.java b/src/main/java/halo/dal/sql/DALPreparedStatement.java index 996c38c..f35cf03 100644 --- a/src/main/java/halo/dal/sql/DALPreparedStatement.java +++ b/src/main/java/halo/dal/sql/DALPreparedStatement.java @@ -44,797 +44,797 @@ */ public class DALPreparedStatement implements PreparedStatement { - private String sql = null; + private String sql = null; - private DALConnection dalConnection = null; + private DALConnection dalConnection = null; - private PreparedStatement ps = null; + private PreparedStatement ps = null; - private int autoGeneratedKeys = Statement.NO_GENERATED_KEYS; + private int autoGeneratedKeys = Statement.NO_GENERATED_KEYS; - private int[] columnIndexes = null; + private int[] columnIndexes = null; - private String[] columnNames = null; - - private int resultSetType = 0; - - private int resultSetConcurrency = 0; - - private int resultSetHoldability = 0; - - private int maxFieldSize = 0; - - private int maxRows = 0; - - private boolean escapeProcessing = true; - - private int queryTimeout = 0; - - private String cursorName = null; - - private int fetchDirection = 0; - - private int fetchSize = 0; - - private boolean poolable = true; - - private final DALParameters dalParameters = new DALParameters(); - - private int createMethodByCon = 0; - - public static final int CREATE_METHOD_BY_CON_S = 1; - - public static final int CREATE_METHOD_BY_CON_S_I = 2; - - public static final int CREATE_METHOD_BY_CON_S_$I = 3; - - public static final int CREATE_METHOD_BY_CON_S_$S = 4; - - public static final int CREATE_METHOD_BY_CON_S_I_I = 5; - - public static final int CREATE_METHOD_BY_CON_S_I_I_I = 6; - - public void setCreateMethodByCon(int createMethodByCon) { - this.createMethodByCon = createMethodByCon; - } - - private void initRealPreparedStatement() throws SQLException { - Connection con = null; - try { - con = this.dalConnection.getCurrentConnection(); - } - catch (DALRunTimeException e) { - throw new DALRunTimeException(e.getMessage() + " for sql: " - + this.sql); - } - switch (this.createMethodByCon) { - case CREATE_METHOD_BY_CON_S: - ps = con.prepareStatement(sql); - break; - case CREATE_METHOD_BY_CON_S_I: - ps = con.prepareStatement(sql, autoGeneratedKeys); - break; - case CREATE_METHOD_BY_CON_S_$I: - ps = con.prepareStatement(sql, columnIndexes); - break; - case CREATE_METHOD_BY_CON_S_$S: - ps = con.prepareStatement(sql, columnNames); - break; - case CREATE_METHOD_BY_CON_S_I_I: - ps = con.prepareStatement(sql, resultSetType, - resultSetConcurrency); - break; - case CREATE_METHOD_BY_CON_S_I_I_I: - ps = con.prepareStatement(sql, resultSetType, - resultSetConcurrency, resultSetHoldability); - break; - } - if (ps == null) { - throw new DALRunTimeException( - "can not create PreparedStatement for dsKey " - + DALCurrentStatus.getDsKey()); - } - } - - /** - * 初始化真正的PreparedStatement,对当前对象的操作全部都设置到真正的PreparedStatement - * - * @throws SQLException - */ - private void prepare() throws SQLException { - DALFactory dalFactory = DALFactory.getDefault(); - List values = dalParameters.getValues(); - Map context = new HashMap(); - SQLStruct sqlStruct = dalFactory.getSqlAnalyzer().parse(sql, context); - SQLInfo sqlInfo = null; - if (sqlStruct.isCanParse()) { - sqlInfo = dalFactory.getSqlAnalyzer().analyse(sql, sqlStruct, - values.toArray(new Object[values.size()]), context); - } - this.parsePartition(sqlStruct, sqlInfo); - this.initRealPreparedStatement(); - if (this.maxFieldSize != 0) { - ps.setMaxFieldSize(maxFieldSize); - } - if (this.maxRows != 0) { - ps.setMaxRows(maxRows); - } - if (!this.escapeProcessing) { - ps.setEscapeProcessing(escapeProcessing); - } - if (this.queryTimeout != 0) { - ps.setQueryTimeout(queryTimeout); - } - if (this.cursorName != null) { - ps.setCursorName(cursorName); - } - if (this.fetchDirection != 0) { - ps.setFetchDirection(fetchDirection); - } - if (this.fetchSize != 0) { - ps.setFetchSize(fetchSize); - } - if (!this.poolable) { - ps.setPoolable(poolable); - } - this.dalParameters.initRealPreparedStatement(ps); - } - - /** - * 根据解析结果设置数据源与真实表名称 - * - * @param sqlStruct - * @param sqlInfo - * @throws SQLException - */ - private void parsePartition(SQLStruct sqlStruct, SQLInfo sqlInfo) - throws SQLException { - DALCustomInfo dalCustomInfo = DALCurrentStatus.getCustomInfo(); - DALFactory dalFactory = DALFactory.getDefault(); - ParsedTableInfo parsedTableInfo = new ParsedTableInfo(); - boolean noParser = false; - if (dalCustomInfo == null && sqlStruct.isCanParse()) { - ConnectionStatus connectionStatus = new ConnectionStatus(); - connectionStatus.setAutoCommit(this.dalConnection.getAutoCommit()); - connectionStatus.setReadOnly(this.dalConnection.isReadOnly()); - PartitionParser parser; - PartitionTableInfo partitionTableInfo = null; - for (String table : sqlStruct.getTableNames()) { - parser = dalFactory.getPartitionParserFactory() - .getParser(table); - // if (parser == null) { - // throw new PartitionParserNotFoundException( - // "PartitionParser for table [" + table - // + "] was not found"); - // } - if (parser == null) { - noParser = true; - } - else { - partitionTableInfo = parser.parse(table, sqlInfo, - connectionStatus); - if (partitionTableInfo == null) { - throw new DALRunTimeException( - "partitionTableInfo return from " - + parser.getClass().getName() - + " can not be null : " + table); - } - parsedTableInfo.setRealTable(table, - partitionTableInfo.getRealTable()); - } - } - if (partitionTableInfo == null) { - DALCurrentStatus.setDefaultDsKey(); - } - else { - DALCurrentStatus.setDsKey(partitionTableInfo.getDsName()); - } - } - else { - if (dalCustomInfo != null) { - for (String table : sqlStruct.getTableNames()) { - parsedTableInfo.setRealTable(table, - dalCustomInfo.getRealTable(table)); - } - } - } - if (sqlStruct.isCanParse() && !noParser) { - this.sql = dalFactory.getSqlAnalyzer().outPutSQL(sql, sqlStruct, - sqlInfo, parsedTableInfo); - } - } - - private void prepare(String sql) throws SQLException { - this.sql = sql; - this.prepare(); - } - - private void assertPs() throws SQLException { - if (ps == null) { - throw new SQLException("no real PreparedStatement exist"); - } - } - - private void reset() { - this.sql = null; - this.dalConnection = null; - this.ps = null; - this.autoGeneratedKeys = Statement.NO_GENERATED_KEYS; - this.columnIndexes = null; - this.columnNames = null; - this.resultSetType = 0; - this.resultSetConcurrency = 0; - this.resultSetHoldability = 0; - this.maxFieldSize = 0; - this.maxRows = 0; - this.escapeProcessing = true; - this.queryTimeout = 0; - this.cursorName = null; - this.fetchDirection = 0; - this.fetchSize = 0; - this.poolable = true; - this.dalParameters.clear(); - } - - public ResultSet executeQuery(String sql) throws SQLException { - this.prepare(sql); - return ps.executeQuery(sql); - } - - public int executeUpdate(String sql) throws SQLException { - this.prepare(sql); - return ps.executeUpdate(sql); - } - - public void close() throws SQLException { - this.reset(); - if (ps != null) { - ps.close(); - } - } - - public int getMaxFieldSize() throws SQLException { - return this.maxFieldSize; - } - - public void setMaxFieldSize(int max) throws SQLException { - this.maxFieldSize = max; - if (ps != null) { - ps.setMaxFieldSize(max); - } - } - - public int getMaxRows() throws SQLException { - return this.maxRows; - } - - public void setMaxRows(int max) throws SQLException { - this.maxRows = max; - if (ps != null) { - ps.setMaxRows(max); - } - } - - public void setEscapeProcessing(boolean enable) throws SQLException { - this.escapeProcessing = enable; - if (ps != null) { - ps.setEscapeProcessing(enable); - } - } - - public int getQueryTimeout() throws SQLException { - return this.queryTimeout; - } - - public void setQueryTimeout(int seconds) throws SQLException { - this.queryTimeout = seconds; - if (ps != null) { - ps.setQueryTimeout(seconds); - } - } - - public void cancel() throws SQLException { - if (ps != null) { - ps.cancel(); - } - } - - public SQLWarning getWarnings() throws SQLException { - if (ps != null) { - return ps.getWarnings(); - } - return null; - } - - public void clearWarnings() throws SQLException { - if (ps != null) { - ps.clearWarnings(); - } - } - - public void setCursorName(String name) throws SQLException { - this.cursorName = name; - if (ps != null) { - ps.setCursorName(name); - } - } - - public boolean execute(String sql) throws SQLException { - this.prepare(sql); - return ps.execute(sql); - } - - public ResultSet getResultSet() throws SQLException { - this.assertPs(); - return ps.getResultSet(); - } - - public int getUpdateCount() throws SQLException { - this.assertPs(); - return ps.getUpdateCount(); - } - - public boolean getMoreResults() throws SQLException { - this.assertPs(); - return ps.getMoreResults(); - } - - public void setFetchDirection(int direction) throws SQLException { - this.fetchDirection = direction; - if (ps != null) { - ps.setFetchDirection(direction); - } - } - - public int getFetchDirection() throws SQLException { - return this.fetchDirection; - } - - public void setFetchSize(int rows) throws SQLException { - this.fetchSize = rows; - if (ps != null) { - ps.setFetchSize(rows); - } - } - - public int getFetchSize() throws SQLException { - return this.fetchSize; - } - - public int getResultSetConcurrency() throws SQLException { - return this.resultSetConcurrency; - } - - public int getResultSetType() throws SQLException { - return this.resultSetType; - } - - public void addBatch(String sql) throws SQLException { - throw new SQLException("do not support batch"); - } - - public void clearBatch() throws SQLException { - this.prepare(); - ps.clearBatch(); - } - - public int[] executeBatch() throws SQLException { - throw new SQLException("do not support batch"); - } - - public Connection getConnection() throws SQLException { - return this.dalConnection; - } - - public boolean getMoreResults(int current) throws SQLException { - this.assertPs(); - return ps.getMoreResults(current); - } - - public ResultSet getGeneratedKeys() throws SQLException { - this.assertPs(); - return ps.getGeneratedKeys(); - } - - public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { - this.prepare(sql); - return ps.executeUpdate(sql, autoGeneratedKeys); - } - - public int executeUpdate(String sql, int[] columnIndexes) - throws SQLException { - this.prepare(sql); - return ps.executeUpdate(sql, columnIndexes); - } - - public int executeUpdate(String sql, String[] columnNames) - throws SQLException { - this.prepare(sql); - return ps.executeUpdate(sql, columnNames); - } - - public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException { - this.prepare(sql); - return ps.execute(sql, autoGeneratedKeys); - } - - public boolean execute(String sql, int[] columnIndexes) throws SQLException { - this.prepare(sql); - return ps.execute(sql, columnIndexes); - } - - public boolean execute(String sql, String[] columnNames) - throws SQLException { - this.prepare(sql); - return ps.execute(sql, columnNames); - } - - public int getResultSetHoldability() throws SQLException { - return this.resultSetHoldability; - } - - public boolean isClosed() throws SQLException { - if (ps != null) { - return ps.isClosed(); - } - return true; - } - - public void setPoolable(boolean poolable) throws SQLException { - this.poolable = poolable; - if (ps != null) { - ps.setPoolable(poolable); - } - } - - public boolean isPoolable() throws SQLException { - return this.poolable; - } - - public T unwrap(Class iface) throws SQLException { - this.assertPs(); - return ps.unwrap(iface); - } - - public boolean isWrapperFor(Class iface) throws SQLException { - this.assertPs(); - return ps.isWrapperFor(iface); - } - - public ResultSet executeQuery() throws SQLException { - this.prepare(); - return ps.executeQuery(); - } - - public int executeUpdate() throws SQLException { - this.prepare(); - return ps.executeUpdate(); - } - - public void setNull(int parameterIndex, int sqlType) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNULL_I_I, parameterIndex, - new Object[] { sqlType }); - } - - public void setBoolean(int parameterIndex, boolean x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBOOLEAN_I_BOOL, - parameterIndex, new Object[] { x }); - } - - public void setByte(int parameterIndex, byte x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBYTE_I_BYTE, parameterIndex, - new Object[] { x }); - } - - public void setShort(int parameterIndex, short x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETSHORT_I_SHORT, - parameterIndex, new Object[] { x }); - } - - public void setInt(int parameterIndex, int x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETINT_I_I, parameterIndex, - new Object[] { x }); - } - - public void setLong(int parameterIndex, long x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETLONG_I_L, parameterIndex, - new Object[] { x }); - } - - public void setFloat(int parameterIndex, float x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETFLOAT_I_F, parameterIndex, - new Object[] { x }); - } - - public void setDouble(int parameterIndex, double x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETDOUBLE_I_D, parameterIndex, - new Object[] { x }); - } - - public void setBigDecimal(int parameterIndex, BigDecimal x) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBIGDECIMAL_I_BIG, - parameterIndex, new Object[] { x }); - } - - public void setString(int parameterIndex, String x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETSTRING_I_S, parameterIndex, - new Object[] { x }); - } - - public void setBytes(int parameterIndex, byte[] x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBYTES_I_$BYTE, - parameterIndex, new Object[] { x }); - } - - public void setDate(int parameterIndex, Date x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETDATE_I_DATE, parameterIndex, - new Object[] { x }); - } - - public void setTime(int parameterIndex, Time x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETTIME_I_TIME, parameterIndex, - new Object[] { x }); - } - - public void setTimestamp(int parameterIndex, Timestamp x) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETTIMESTAMP_I_TIMESTAMP, - parameterIndex, new Object[] { x }); - } - - public void setAsciiStream(int parameterIndex, InputStream x, int length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN_I, - parameterIndex, new Object[] { x, length }); - } - - public void setUnicodeStream(int parameterIndex, InputStream x, int length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETUNICODESTREAM_I_IN_I, - parameterIndex, new Object[] { x, length }); - } - - public void setBinaryStream(int parameterIndex, InputStream x, int length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN_I, - parameterIndex, new Object[] { x, length }); - } - - public void clearParameters() throws SQLException { - this.dalParameters.clear(); - if (ps != null) { - ps.clearParameters(); - } - } - - public void setObject(int parameterIndex, Object x, int targetSqlType) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETOBJECTI_O_I, parameterIndex, - new Object[] { x, targetSqlType }); - } - - public void setObject(int parameterIndex, Object x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETOBJECT_I_O, parameterIndex, - new Object[] { x }); - } - - public boolean execute() throws SQLException { - this.prepare(); - return ps.execute(); - } - - public void addBatch() throws SQLException { - throw new SQLException("do not support batch"); - } - - public void setCharacterStream(int parameterIndex, Reader reader, int length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER_I, - parameterIndex, new Object[] { reader, length }); - } - - public void setRef(int parameterIndex, Ref x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETREF_I_REF, parameterIndex, - new Object[] { x }); - } - - public void setBlob(int parameterIndex, Blob x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBLOB_I_BLOB, parameterIndex, - new Object[] { x }); - } - - public void setClob(int parameterIndex, Clob x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCLOB_I_CLOB, parameterIndex, - new Object[] { x }); - } - - public void setArray(int parameterIndex, Array x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETARRAY_I_ARRAY, - parameterIndex, new Object[] { x }); - } - - public ResultSetMetaData getMetaData() throws SQLException { - this.assertPs(); - return ps.getMetaData(); - } - - public void setDate(int parameterIndex, Date x, Calendar cal) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETDATE_I_DATE_CAL, - parameterIndex, new Object[] { x, cal }); - } - - public void setTime(int parameterIndex, Time x, Calendar cal) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETTIME_I_TIME_CAL, - parameterIndex, new Object[] { x, cal }); - } - - public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETTIMESTAMP_I_TIMESTAMP_CAL, - parameterIndex, new Object[] { x, cal }); - } - - public void setNull(int parameterIndex, int sqlType, String typeName) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNULL_I_I_S, parameterIndex, - new Object[] { sqlType, typeName }); - } - - public void setURL(int parameterIndex, URL x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETURL_I_URL, parameterIndex, - new Object[] { x }); - } - - public ParameterMetaData getParameterMetaData() throws SQLException { - this.assertPs(); - return ps.getParameterMetaData(); - } - - public void setRowId(int parameterIndex, RowId x) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETROWID_I_ROWID, - parameterIndex, new Object[] { x }); - } - - public void setNString(int parameterIndex, String value) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNSTRING_I_S, parameterIndex, - new Object[] { value }); - } - - public void setNCharacterStream(int parameterIndex, Reader value, - long length) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNCHARACTERSTREAM_I_READER_L, - parameterIndex, new Object[] { value, length }); - } - - public void setNClob(int parameterIndex, NClob value) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNCLOB_I_NCLOB, - parameterIndex, new Object[] { value }); - } - - public void setClob(int parameterIndex, Reader reader, long length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCLOB_I_READER_L, - parameterIndex, new Object[] { reader, length }); - } - - public void setBlob(int parameterIndex, InputStream inputStream, long length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBLOB_I_IN_L, parameterIndex, - new Object[] { inputStream, length }); - } - - public void setNClob(int parameterIndex, Reader reader, long length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNCLOB_I_READER_L, - parameterIndex, new Object[] { reader, length }); - } - - public void setSQLXML(int parameterIndex, SQLXML xmlObject) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETSQLXML_I_SQLXML, - parameterIndex, new Object[] { xmlObject }); - } - - public void setObject(int parameterIndex, Object x, int targetSqlType, - int scaleOrLength) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETOBJECT_I_O_I_I, - parameterIndex, - new Object[] { x, targetSqlType, scaleOrLength }); - } - - public void setAsciiStream(int parameterIndex, InputStream x, long length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN_L, - parameterIndex, new Object[] { x, length }); - } - - public void setBinaryStream(int parameterIndex, InputStream x, long length) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN_L, - parameterIndex, new Object[] { x, length }); - } - - public void setCharacterStream(int parameterIndex, Reader reader, - long length) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER_L, - parameterIndex, new Object[] { reader, length }); - } - - public void setAsciiStream(int parameterIndex, InputStream x) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN, - parameterIndex, new Object[] { x }); - } - - public void setBinaryStream(int parameterIndex, InputStream x) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN, - parameterIndex, new Object[] { x }); - } - - public void setCharacterStream(int parameterIndex, Reader reader) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER, - parameterIndex, new Object[] { reader }); - } - - public void setNCharacterStream(int parameterIndex, Reader value) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNCHARACTERSTREAM_I_READER, - parameterIndex, new Object[] { value }); - } - - public void setClob(int parameterIndex, Reader reader) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETCLOB_I_READER, - parameterIndex, new Object[] { reader }); - } - - public void setBlob(int parameterIndex, InputStream inputStream) - throws SQLException { - this.dalParameters.set(DALParameters.MN_SETBLOB_I_IN, parameterIndex, - new Object[] { inputStream }); - } - - public void setNClob(int parameterIndex, Reader reader) throws SQLException { - this.dalParameters.set(DALParameters.MN_SETNCLOB_I_READER, - parameterIndex, new Object[] { reader }); - } - - public void setResultSetHoldability(int resultSetHoldability) { - this.resultSetHoldability = resultSetHoldability; - } - - public void setResultSetConcurrency(int resultSetConcurrency) { - this.resultSetConcurrency = resultSetConcurrency; - } - - public void setResultSetType(int resultSetType) { - this.resultSetType = resultSetType; - } - - public void setColumnIndexes(int[] columnIndexes) { - this.columnIndexes = columnIndexes; - } - - public void setColumnNames(String[] columnNames) { - this.columnNames = columnNames; - } - - public void setAutoGeneratedKeys(int autoGeneratedKeys) { - this.autoGeneratedKeys = autoGeneratedKeys; - } - - public void setSql(String sql) { - this.sql = sql; - } - - public void setDalConnection(DALConnection dalConnection) { - this.dalConnection = dalConnection; - } + private String[] columnNames = null; + + private int resultSetType = 0; + + private int resultSetConcurrency = 0; + + private int resultSetHoldability = 0; + + private int maxFieldSize = 0; + + private int maxRows = 0; + + private boolean escapeProcessing = true; + + private int queryTimeout = 0; + + private String cursorName = null; + + private int fetchDirection = 0; + + private int fetchSize = 0; + + private boolean poolable = true; + + private final DALParameters dalParameters = new DALParameters(); + + private int createMethodByCon = 0; + + public static final int CREATE_METHOD_BY_CON_S = 1; + + public static final int CREATE_METHOD_BY_CON_S_I = 2; + + public static final int CREATE_METHOD_BY_CON_S_$I = 3; + + public static final int CREATE_METHOD_BY_CON_S_$S = 4; + + public static final int CREATE_METHOD_BY_CON_S_I_I = 5; + + public static final int CREATE_METHOD_BY_CON_S_I_I_I = 6; + + public void setCreateMethodByCon(int createMethodByCon) { + this.createMethodByCon = createMethodByCon; + } + + private void initRealPreparedStatement() throws SQLException { + Connection con = null; + try { + con = this.dalConnection.getCurrentConnection(); + } + catch (DALRunTimeException e) { + throw new DALRunTimeException(e.getMessage() + " for sql: " + + this.sql); + } + switch (this.createMethodByCon) { + case CREATE_METHOD_BY_CON_S: + ps = con.prepareStatement(sql); + break; + case CREATE_METHOD_BY_CON_S_I: + ps = con.prepareStatement(sql, autoGeneratedKeys); + break; + case CREATE_METHOD_BY_CON_S_$I: + ps = con.prepareStatement(sql, columnIndexes); + break; + case CREATE_METHOD_BY_CON_S_$S: + ps = con.prepareStatement(sql, columnNames); + break; + case CREATE_METHOD_BY_CON_S_I_I: + ps = con.prepareStatement(sql, resultSetType, + resultSetConcurrency); + break; + case CREATE_METHOD_BY_CON_S_I_I_I: + ps = con.prepareStatement(sql, resultSetType, + resultSetConcurrency, resultSetHoldability); + break; + } + if (ps == null) { + throw new DALRunTimeException( + "can not create PreparedStatement for dsKey " + + DALCurrentStatus.getDsKey()); + } + } + + /** + * 初始化真正的PreparedStatement,对当前对象的操作全部都设置到真正的PreparedStatement + * + * @throws SQLException + */ + private void prepare() throws SQLException { + DALFactory dalFactory = DALFactory.getDefault(); + List values = dalParameters.getValues(); + Map context = new HashMap(); + SQLStruct sqlStruct = dalFactory.getSqlAnalyzer().parse(sql, context); + SQLInfo sqlInfo = null; + if (sqlStruct.isCanParse()) { + sqlInfo = dalFactory.getSqlAnalyzer().analyse(sql, sqlStruct, + values.toArray(new Object[values.size()]), context); + } + this.parsePartition(sqlStruct, sqlInfo); + this.initRealPreparedStatement(); + if (this.maxFieldSize != 0) { + ps.setMaxFieldSize(maxFieldSize); + } + if (this.maxRows != 0) { + ps.setMaxRows(maxRows); + } + if (!this.escapeProcessing) { + ps.setEscapeProcessing(escapeProcessing); + } + if (this.queryTimeout != 0) { + ps.setQueryTimeout(queryTimeout); + } + if (this.cursorName != null) { + ps.setCursorName(cursorName); + } + if (this.fetchDirection != 0) { + ps.setFetchDirection(fetchDirection); + } + if (this.fetchSize != 0) { + ps.setFetchSize(fetchSize); + } + if (!this.poolable) { + ps.setPoolable(poolable); + } + this.dalParameters.initRealPreparedStatement(ps); + } + + /** + * 根据解析结果设置数据源与真实表名称 + * + * @param sqlStruct + * @param sqlInfo + * @throws SQLException + */ + private void parsePartition(SQLStruct sqlStruct, SQLInfo sqlInfo) + throws SQLException { + DALCustomInfo dalCustomInfo = DALCurrentStatus.getCustomInfo(); + DALFactory dalFactory = DALFactory.getDefault(); + ParsedTableInfo parsedTableInfo = new ParsedTableInfo(); + boolean noParser = false; + if (sqlStruct.isCanParse()) { + if (dalCustomInfo == null) { + ConnectionStatus connectionStatus = new ConnectionStatus(); + connectionStatus.setAutoCommit(this.dalConnection + .getAutoCommit()); + connectionStatus.setReadOnly(this.dalConnection.isReadOnly()); + PartitionParser parser; + PartitionTableInfo partitionTableInfo = null; + for (String table : sqlStruct.getTableNames()) { + parser = dalFactory.getPartitionParserFactory() + .getParser(table); + if (parser == null) { + noParser = true; + } + else { + partitionTableInfo = parser.parse(table, sqlInfo, + connectionStatus); + if (partitionTableInfo == null) { + throw new DALRunTimeException( + "partitionTableInfo return from " + + parser.getClass().getName() + + " can not be null : " + table); + } + parsedTableInfo.setRealTable(table, + partitionTableInfo.getRealTable()); + } + } + if (partitionTableInfo == null) { + DALCurrentStatus.setDefaultDsKey(); + } + else { + DALCurrentStatus.setDsKey(partitionTableInfo.getDsName()); + } + } + else { + for (String table : sqlStruct.getTableNames()) { + parsedTableInfo.setRealTable(table, + dalCustomInfo.getRealTable(table)); + } + } + if (!noParser) { + this.sql = dalFactory.getSqlAnalyzer().outPutSQL(sql, + sqlStruct, + sqlInfo, parsedTableInfo); + } + } + else { + // 当不需要进行解析时,什么也不做,直接使用上一次使用的解析结果 + } + } + + private void prepare(String sql) throws SQLException { + this.sql = sql; + this.prepare(); + } + + private void assertPs() throws SQLException { + if (ps == null) { + throw new SQLException("no real PreparedStatement exist"); + } + } + + private void reset() { + this.sql = null; + this.dalConnection = null; + this.ps = null; + this.autoGeneratedKeys = Statement.NO_GENERATED_KEYS; + this.columnIndexes = null; + this.columnNames = null; + this.resultSetType = 0; + this.resultSetConcurrency = 0; + this.resultSetHoldability = 0; + this.maxFieldSize = 0; + this.maxRows = 0; + this.escapeProcessing = true; + this.queryTimeout = 0; + this.cursorName = null; + this.fetchDirection = 0; + this.fetchSize = 0; + this.poolable = true; + this.dalParameters.clear(); + } + + public ResultSet executeQuery(String sql) throws SQLException { + this.prepare(sql); + return ps.executeQuery(sql); + } + + public int executeUpdate(String sql) throws SQLException { + this.prepare(sql); + return ps.executeUpdate(sql); + } + + public void close() throws SQLException { + this.reset(); + if (ps != null) { + ps.close(); + } + } + + public int getMaxFieldSize() throws SQLException { + return this.maxFieldSize; + } + + public void setMaxFieldSize(int max) throws SQLException { + this.maxFieldSize = max; + if (ps != null) { + ps.setMaxFieldSize(max); + } + } + + public int getMaxRows() throws SQLException { + return this.maxRows; + } + + public void setMaxRows(int max) throws SQLException { + this.maxRows = max; + if (ps != null) { + ps.setMaxRows(max); + } + } + + public void setEscapeProcessing(boolean enable) throws SQLException { + this.escapeProcessing = enable; + if (ps != null) { + ps.setEscapeProcessing(enable); + } + } + + public int getQueryTimeout() throws SQLException { + return this.queryTimeout; + } + + public void setQueryTimeout(int seconds) throws SQLException { + this.queryTimeout = seconds; + if (ps != null) { + ps.setQueryTimeout(seconds); + } + } + + public void cancel() throws SQLException { + if (ps != null) { + ps.cancel(); + } + } + + public SQLWarning getWarnings() throws SQLException { + if (ps != null) { + return ps.getWarnings(); + } + return null; + } + + public void clearWarnings() throws SQLException { + if (ps != null) { + ps.clearWarnings(); + } + } + + public void setCursorName(String name) throws SQLException { + this.cursorName = name; + if (ps != null) { + ps.setCursorName(name); + } + } + + public boolean execute(String sql) throws SQLException { + this.prepare(sql); + return ps.execute(sql); + } + + public ResultSet getResultSet() throws SQLException { + this.assertPs(); + return ps.getResultSet(); + } + + public int getUpdateCount() throws SQLException { + this.assertPs(); + return ps.getUpdateCount(); + } + + public boolean getMoreResults() throws SQLException { + this.assertPs(); + return ps.getMoreResults(); + } + + public void setFetchDirection(int direction) throws SQLException { + this.fetchDirection = direction; + if (ps != null) { + ps.setFetchDirection(direction); + } + } + + public int getFetchDirection() throws SQLException { + return this.fetchDirection; + } + + public void setFetchSize(int rows) throws SQLException { + this.fetchSize = rows; + if (ps != null) { + ps.setFetchSize(rows); + } + } + + public int getFetchSize() throws SQLException { + return this.fetchSize; + } + + public int getResultSetConcurrency() throws SQLException { + return this.resultSetConcurrency; + } + + public int getResultSetType() throws SQLException { + return this.resultSetType; + } + + public void addBatch(String sql) throws SQLException { + throw new SQLException("do not support batch"); + } + + public void clearBatch() throws SQLException { + this.prepare(); + ps.clearBatch(); + } + + public int[] executeBatch() throws SQLException { + throw new SQLException("do not support batch"); + } + + public Connection getConnection() throws SQLException { + return this.dalConnection; + } + + public boolean getMoreResults(int current) throws SQLException { + this.assertPs(); + return ps.getMoreResults(current); + } + + public ResultSet getGeneratedKeys() throws SQLException { + this.assertPs(); + return ps.getGeneratedKeys(); + } + + public int executeUpdate(String sql, int autoGeneratedKeys) + throws SQLException { + this.prepare(sql); + return ps.executeUpdate(sql, autoGeneratedKeys); + } + + public int executeUpdate(String sql, int[] columnIndexes) + throws SQLException { + this.prepare(sql); + return ps.executeUpdate(sql, columnIndexes); + } + + public int executeUpdate(String sql, String[] columnNames) + throws SQLException { + this.prepare(sql); + return ps.executeUpdate(sql, columnNames); + } + + public boolean execute(String sql, int autoGeneratedKeys) + throws SQLException { + this.prepare(sql); + return ps.execute(sql, autoGeneratedKeys); + } + + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + this.prepare(sql); + return ps.execute(sql, columnIndexes); + } + + public boolean execute(String sql, String[] columnNames) + throws SQLException { + this.prepare(sql); + return ps.execute(sql, columnNames); + } + + public int getResultSetHoldability() throws SQLException { + return this.resultSetHoldability; + } + + public boolean isClosed() throws SQLException { + if (ps != null) { + return ps.isClosed(); + } + return true; + } + + public void setPoolable(boolean poolable) throws SQLException { + this.poolable = poolable; + if (ps != null) { + ps.setPoolable(poolable); + } + } + + public boolean isPoolable() throws SQLException { + return this.poolable; + } + + public T unwrap(Class iface) throws SQLException { + this.assertPs(); + return ps.unwrap(iface); + } + + public boolean isWrapperFor(Class iface) throws SQLException { + this.assertPs(); + return ps.isWrapperFor(iface); + } + + public ResultSet executeQuery() throws SQLException { + this.prepare(); + return ps.executeQuery(); + } + + public int executeUpdate() throws SQLException { + this.prepare(); + return ps.executeUpdate(); + } + + public void setNull(int parameterIndex, int sqlType) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNULL_I_I, parameterIndex, + new Object[] { sqlType }); + } + + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBOOLEAN_I_BOOL, + parameterIndex, new Object[] { x }); + } + + public void setByte(int parameterIndex, byte x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBYTE_I_BYTE, parameterIndex, + new Object[] { x }); + } + + public void setShort(int parameterIndex, short x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETSHORT_I_SHORT, + parameterIndex, new Object[] { x }); + } + + public void setInt(int parameterIndex, int x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETINT_I_I, parameterIndex, + new Object[] { x }); + } + + public void setLong(int parameterIndex, long x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETLONG_I_L, parameterIndex, + new Object[] { x }); + } + + public void setFloat(int parameterIndex, float x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETFLOAT_I_F, parameterIndex, + new Object[] { x }); + } + + public void setDouble(int parameterIndex, double x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETDOUBLE_I_D, parameterIndex, + new Object[] { x }); + } + + public void setBigDecimal(int parameterIndex, BigDecimal x) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBIGDECIMAL_I_BIG, + parameterIndex, new Object[] { x }); + } + + public void setString(int parameterIndex, String x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETSTRING_I_S, parameterIndex, + new Object[] { x }); + } + + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBYTES_I_$BYTE, + parameterIndex, new Object[] { x }); + } + + public void setDate(int parameterIndex, Date x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETDATE_I_DATE, parameterIndex, + new Object[] { x }); + } + + public void setTime(int parameterIndex, Time x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETTIME_I_TIME, parameterIndex, + new Object[] { x }); + } + + public void setTimestamp(int parameterIndex, Timestamp x) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETTIMESTAMP_I_TIMESTAMP, + parameterIndex, new Object[] { x }); + } + + public void setAsciiStream(int parameterIndex, InputStream x, int length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN_I, + parameterIndex, new Object[] { x, length }); + } + + public void setUnicodeStream(int parameterIndex, InputStream x, int length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETUNICODESTREAM_I_IN_I, + parameterIndex, new Object[] { x, length }); + } + + public void setBinaryStream(int parameterIndex, InputStream x, int length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN_I, + parameterIndex, new Object[] { x, length }); + } + + public void clearParameters() throws SQLException { + this.dalParameters.clear(); + if (ps != null) { + ps.clearParameters(); + } + } + + public void setObject(int parameterIndex, Object x, int targetSqlType) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETOBJECTI_O_I, parameterIndex, + new Object[] { x, targetSqlType }); + } + + public void setObject(int parameterIndex, Object x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETOBJECT_I_O, parameterIndex, + new Object[] { x }); + } + + public boolean execute() throws SQLException { + this.prepare(); + return ps.execute(); + } + + public void addBatch() throws SQLException { + throw new SQLException("do not support batch"); + } + + public void setCharacterStream(int parameterIndex, Reader reader, int length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER_I, + parameterIndex, new Object[] { reader, length }); + } + + public void setRef(int parameterIndex, Ref x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETREF_I_REF, parameterIndex, + new Object[] { x }); + } + + public void setBlob(int parameterIndex, Blob x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBLOB_I_BLOB, parameterIndex, + new Object[] { x }); + } + + public void setClob(int parameterIndex, Clob x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCLOB_I_CLOB, parameterIndex, + new Object[] { x }); + } + + public void setArray(int parameterIndex, Array x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETARRAY_I_ARRAY, + parameterIndex, new Object[] { x }); + } + + public ResultSetMetaData getMetaData() throws SQLException { + this.assertPs(); + return ps.getMetaData(); + } + + public void setDate(int parameterIndex, Date x, Calendar cal) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETDATE_I_DATE_CAL, + parameterIndex, new Object[] { x, cal }); + } + + public void setTime(int parameterIndex, Time x, Calendar cal) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETTIME_I_TIME_CAL, + parameterIndex, new Object[] { x, cal }); + } + + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETTIMESTAMP_I_TIMESTAMP_CAL, + parameterIndex, new Object[] { x, cal }); + } + + public void setNull(int parameterIndex, int sqlType, String typeName) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNULL_I_I_S, parameterIndex, + new Object[] { sqlType, typeName }); + } + + public void setURL(int parameterIndex, URL x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETURL_I_URL, parameterIndex, + new Object[] { x }); + } + + public ParameterMetaData getParameterMetaData() throws SQLException { + this.assertPs(); + return ps.getParameterMetaData(); + } + + public void setRowId(int parameterIndex, RowId x) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETROWID_I_ROWID, + parameterIndex, new Object[] { x }); + } + + public void setNString(int parameterIndex, String value) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNSTRING_I_S, parameterIndex, + new Object[] { value }); + } + + public void setNCharacterStream(int parameterIndex, Reader value, + long length) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNCHARACTERSTREAM_I_READER_L, + parameterIndex, new Object[] { value, length }); + } + + public void setNClob(int parameterIndex, NClob value) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNCLOB_I_NCLOB, + parameterIndex, new Object[] { value }); + } + + public void setClob(int parameterIndex, Reader reader, long length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCLOB_I_READER_L, + parameterIndex, new Object[] { reader, length }); + } + + public void setBlob(int parameterIndex, InputStream inputStream, long length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBLOB_I_IN_L, parameterIndex, + new Object[] { inputStream, length }); + } + + public void setNClob(int parameterIndex, Reader reader, long length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNCLOB_I_READER_L, + parameterIndex, new Object[] { reader, length }); + } + + public void setSQLXML(int parameterIndex, SQLXML xmlObject) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETSQLXML_I_SQLXML, + parameterIndex, new Object[] { xmlObject }); + } + + public void setObject(int parameterIndex, Object x, int targetSqlType, + int scaleOrLength) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETOBJECT_I_O_I_I, + parameterIndex, + new Object[] { x, targetSqlType, scaleOrLength }); + } + + public void setAsciiStream(int parameterIndex, InputStream x, long length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN_L, + parameterIndex, new Object[] { x, length }); + } + + public void setBinaryStream(int parameterIndex, InputStream x, long length) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN_L, + parameterIndex, new Object[] { x, length }); + } + + public void setCharacterStream(int parameterIndex, Reader reader, + long length) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER_L, + parameterIndex, new Object[] { reader, length }); + } + + public void setAsciiStream(int parameterIndex, InputStream x) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETASCIISTREAM_I_IN, + parameterIndex, new Object[] { x }); + } + + public void setBinaryStream(int parameterIndex, InputStream x) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBINARYSTREAM_I_IN, + parameterIndex, new Object[] { x }); + } + + public void setCharacterStream(int parameterIndex, Reader reader) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCHARACTERSTREAM_I_READER, + parameterIndex, new Object[] { reader }); + } + + public void setNCharacterStream(int parameterIndex, Reader value) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNCHARACTERSTREAM_I_READER, + parameterIndex, new Object[] { value }); + } + + public void setClob(int parameterIndex, Reader reader) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETCLOB_I_READER, + parameterIndex, new Object[] { reader }); + } + + public void setBlob(int parameterIndex, InputStream inputStream) + throws SQLException { + this.dalParameters.set(DALParameters.MN_SETBLOB_I_IN, parameterIndex, + new Object[] { inputStream }); + } + + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + this.dalParameters.set(DALParameters.MN_SETNCLOB_I_READER, + parameterIndex, new Object[] { reader }); + } + + public void setResultSetHoldability(int resultSetHoldability) { + this.resultSetHoldability = resultSetHoldability; + } + + public void setResultSetConcurrency(int resultSetConcurrency) { + this.resultSetConcurrency = resultSetConcurrency; + } + + public void setResultSetType(int resultSetType) { + this.resultSetType = resultSetType; + } + + public void setColumnIndexes(int[] columnIndexes) { + this.columnIndexes = columnIndexes; + } + + public void setColumnNames(String[] columnNames) { + this.columnNames = columnNames; + } + + public void setAutoGeneratedKeys(int autoGeneratedKeys) { + this.autoGeneratedKeys = autoGeneratedKeys; + } + + public void setSql(String sql) { + this.sql = sql; + } + + public void setDalConnection(DALConnection dalConnection) { + this.dalConnection = dalConnection; + } }