com.alibaba.druid.sql.ast.expr.SQLAllColumnExpr Java Examples
The following examples show how to use
com.alibaba.druid.sql.ast.expr.SQLAllColumnExpr.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Util.java From elasticsearch-sql with Apache License 2.0 | 6 votes |
public static Object expr2Object(SQLExpr expr, String charWithQuote) { Object value = null; if (expr instanceof SQLNumericLiteralExpr) { value = ((SQLNumericLiteralExpr) expr).getNumber(); } else if (expr instanceof SQLCharExpr) { value = charWithQuote + ((SQLCharExpr) expr).getText() + charWithQuote; } else if (expr instanceof SQLIdentifierExpr) { value = expr.toString(); } else if (expr instanceof SQLPropertyExpr) { value = expr.toString(); } else if (expr instanceof SQLVariantRefExpr) { value = expr.toString(); } else if (expr instanceof SQLAllColumnExpr) { value = "*"; } else if (expr instanceof SQLValuableExpr) { value = ((SQLValuableExpr) expr).getValue(); } else if (expr instanceof SQLBooleanExpr) { value = ((SQLBooleanExpr) expr).getValue(); } else { //throw new SqlParseException("can not support this type " + expr.getClass()); } return value; }
Example #2
Source File: JoinParser.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
private void parserFields(List<SQLSelectItem> mysqlSelectList){ //显示的字段 String key=""; String value =""; String exprfield = ""; for(SQLSelectItem item : mysqlSelectList) { if (item.getExpr() instanceof SQLAllColumnExpr) { //*解析 setField(item.toString(), item.toString()); } else { if (item.getExpr() instanceof SQLAggregateExpr) { SQLAggregateExpr expr =(SQLAggregateExpr)item.getExpr(); key = getExprFieldName(expr); setField(key, value); }else if(item.getExpr() instanceof SQLMethodInvokeExpr){ key = getMethodInvokeFieldName(item); exprfield=getFieldName(item); // value=item.getAlias(); setField(key, value,exprfield); }else { key=getFieldName(item); value=item.getAlias(); setField(key, value); } } } }