1 5 package org.h2.expression; 6 7 import java.sql.SQLException ; 8 9 import org.h2.engine.Session; 10 import org.h2.table.ColumnResolver; 11 import org.h2.table.TableFilter; 12 import org.h2.value.Value; 13 14 15 18 19 public class Alias extends Expression { 20 21 private Expression expr; 22 private String alias; 23 24 public Alias(Expression expression, String alias) { 25 this.expr = expression; 26 this.alias = alias; 27 } 28 29 public Expression getNonAliasExpression() { 30 return expr; 31 } 32 33 public Value getValue(Session session) throws SQLException { 34 return expr.getValue(session); 35 } 36 37 public int getType() { 38 return expr.getType(); 39 } 40 41 public void mapColumns(ColumnResolver resolver, int level) throws SQLException { 42 expr.mapColumns(resolver, level); 43 } 44 45 public Expression optimize(Session session) throws SQLException { 46 expr = expr.optimize(session); 47 return this; 48 } 49 50 public void setEvaluatable(TableFilter tableFilter, boolean b) { 51 expr.setEvaluatable(tableFilter, b); 52 } 53 54 public int getScale() { 55 return expr.getScale(); 56 } 57 58 public long getPrecision() { 59 return expr.getPrecision(); 60 } 61 62 public boolean isAutoIncrement() { 63 return expr.isAutoIncrement(); 64 } 65 66 public String getSQL() { 67 return expr.getSQL() + " AS " + alias; 68 } 69 70 public void updateAggregate(Session session) throws SQLException { 71 expr.updateAggregate(session); 72 } 73 74 public String getAlias() { 75 return alias; 76 } 77 78 public int getNullable() { 79 return expr.getNullable(); 80 } 81 82 public boolean isEverything(ExpressionVisitor visitor) { 83 return expr.isEverything(visitor); 84 } 85 86 public int getCost() { 87 return expr.getCost(); 88 } 89 90 } 91 | Popular Tags |