001: package com.quadcap.sql;
002:
003: /* Copyright 1999 - 2003 Quadcap Software. All rights reserved.
004: *
005: * This software is distributed under the Quadcap Free Software License.
006: * This software may be used or modified for any purpose, personal or
007: * commercial. Open Source redistributions are permitted. Commercial
008: * redistribution of larger works derived from, or works which bundle
009: * this software requires a "Commercial Redistribution License"; see
010: * http://www.quadcap.com/purchase.
011: *
012: * Redistributions qualify as "Open Source" under one of the following terms:
013: *
014: * Redistributions are made at no charge beyond the reasonable cost of
015: * materials and delivery.
016: *
017: * Redistributions are accompanied by a copy of the Source Code or by an
018: * irrevocable offer to provide a copy of the Source Code for up to three
019: * years at the cost of materials and delivery. Such redistributions
020: * must allow further use, modification, and redistribution of the Source
021: * Code under substantially the same terms as this license.
022: *
023: * Redistributions of source code must retain the copyright notices as they
024: * appear in each source code file, these license terms, and the
025: * disclaimer/limitation of liability set forth as paragraph 6 below.
026: *
027: * Redistributions in binary form must reproduce this Copyright Notice,
028: * these license terms, and the disclaimer/limitation of liability set
029: * forth as paragraph 6 below, in the documentation and/or other materials
030: * provided with the distribution.
031: *
032: * The Software is provided on an "AS IS" basis. No warranty is
033: * provided that the Software is free of defects, or fit for a
034: * particular purpose.
035: *
036: * Limitation of Liability. Quadcap Software shall not be liable
037: * for any damages suffered by the Licensee or any third party resulting
038: * from use of the Software.
039: */
040:
041: import com.quadcap.sql.types.Type;
042: import com.quadcap.sql.types.TypeAny;
043:
044: import java.util.Vector;
045:
046: import java.sql.SQLException;
047:
048: /**
049: * Some kind of expression that yields a 'table', which can be joined or
050: * merged or cursored.
051: *
052: * @author Stan Bailes
053: */
054: public abstract class TableExpression extends Expression {
055: boolean anded = false;
056: Expression where = null;
057:
058: /**
059: * Returns zero if this is a scalar expression, one if it's a vector
060: * type and 2 if it's a table/cursor type.
061: */
062: public abstract int rank();
063:
064: /**
065: * Is this table expression updatable?
066: */
067: public abstract boolean isUpdatable();
068:
069: /**
070: * Return a cursor which can be used to access this table expression.
071: */
072: public abstract Cursor getCursor(Session session, Cursor outer)
073: throws SQLException;
074:
075: public Type getType(Session session, Cursor cursor) {
076: return TypeAny.any;
077: }
078:
079: /**
080: * Return a vector consisting of the names of the underlying base tables
081: * that are used to derive this table expression.
082: */
083: public abstract void getBaseTables(Vector v);
084:
085: /**
086: * Set the WHERE clause associated with this table expression.
087: */
088: public void setWhere(Expression where) {
089: this .where = where;
090: }
091:
092: /**
093: * Return the WHERE clause associated with this table expression.
094: */
095: public Expression getWhere() {
096: return where;
097: }
098:
099: //#ifdef DEBUG
100: public abstract String name();
101: //#endif
102: }
|