001: /*
002: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
003: * (http://h2database.com/html/license.html).
004: * Initial Developer: H2 Group
005: */
006: package org.h2.expression;
007:
008: import java.sql.SQLException;
009:
010: import org.h2.constant.ErrorCode;
011: import org.h2.engine.Session;
012: import org.h2.message.Message;
013: import org.h2.table.ColumnResolver;
014: import org.h2.table.TableFilter;
015: import org.h2.util.StringUtils;
016: import org.h2.value.Value;
017:
018: /**
019: * A wildcard expression as in SELECT * FROM TEST.
020: * This object is only used temporarily during the parsing phase, and later
021: * replaced by column expressions.
022: */
023: public class Wildcard extends Expression {
024: private String schema;
025: private String table;
026:
027: public Wildcard(String schema, String table) {
028: this .schema = schema;
029: this .table = table;
030: }
031:
032: public boolean isWildcard() {
033: return true;
034: }
035:
036: public Value getValue(Session session) {
037: throw Message.getInternalError();
038: }
039:
040: public int getType() {
041: throw Message.getInternalError();
042: }
043:
044: public void mapColumns(ColumnResolver resolver, int level)
045: throws SQLException {
046: throw Message.getSQLException(ErrorCode.SYNTAX_ERROR_1, table);
047: }
048:
049: public void checkMapped() {
050: throw Message.getInternalError();
051: }
052:
053: public Expression optimize(Session session) throws SQLException {
054: throw Message.getSQLException(ErrorCode.SYNTAX_ERROR_1, table);
055: }
056:
057: public void setEvaluatable(TableFilter tableFilter, boolean b) {
058: throw Message.getInternalError();
059: }
060:
061: public int getScale() {
062: throw Message.getInternalError();
063: }
064:
065: public long getPrecision() {
066: throw Message.getInternalError();
067: }
068:
069: public int getDisplaySize() {
070: throw Message.getInternalError();
071: }
072:
073: public String getSchema() {
074: return schema;
075: }
076:
077: public String getTableAlias() {
078: return table;
079: }
080:
081: public String getSQL() {
082: if (table == null) {
083: return "*";
084: } else {
085: return StringUtils.quoteIdentifier(table) + ".*";
086: }
087: }
088:
089: public void updateAggregate(Session session) {
090: throw Message.getInternalError();
091: }
092:
093: public boolean isEverything(ExpressionVisitor visitor) {
094: throw Message.getInternalError();
095: }
096:
097: public int getCost() {
098: throw Message.getInternalError();
099: }
100:
101: }
|