01: /**
02: * com.mckoi.database.sql.FromTableInterface 20 Jul 2001
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * Version 2 as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License Version 2 for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * Version 2 along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Change Log:
21: *
22: *
23: */package com.mckoi.database.interpret;
24:
25: import com.mckoi.database.*;
26:
27: /**
28: * A single table resource item in a query which handles the behaviour
29: * of resolving references to columns as well as providing various base
30: * utility methods for resolving general variable names.
31: * <p>
32: * Each instance of this interface represents a single 'FROM' resource.
33: *
34: * @author Tobias Downer
35: */
36:
37: public interface FromTableInterface {
38:
39: /**
40: * Returns a unique name given to this table source. No other sources
41: * will share this identifier string.
42: */
43: String getUniqueName();
44:
45: /**
46: * Returns true if this source will match the given catalog, schema and
47: * table. If any arguments are null then it is not included in the match.
48: * <p>
49: * Used for 'Part.*' type glob searches.
50: */
51: boolean matchesReference(String catalog, String schema, String table);
52:
53: /**
54: * Returns the number of instances we can resolve the given catalog, schema,
55: * table and column name to a column or columns within this item. Note that
56: * if catalog, schema, table or column is 'null' then it means it doesn't
57: * matter.
58: * <p>
59: * For example, say we need to resolve the column 'id' the arguments are
60: * null, null, null, "id". This may resolve to multiple columns if there is
61: * a mixture of tables with "id" as a column.
62: * <p>
63: * Note that parameters of 'null, null, null, null',
64: * 'null, null, null, not null', 'null, null, not null, not null',
65: * 'null, not null, not null, not null', and
66: * 'not null, not null, not null, not null' are only accepted.
67: */
68: int resolveColumnCount(String catalog, String schema, String table,
69: String column);
70:
71: /**
72: * Returns a Variable that is a fully resolved form of the given column in
73: * this table set. This method does not have to check whether the parameters
74: * reference more than one column. If more than one column is referenced,
75: * the actual column returned is implementation specific.
76: */
77: Variable resolveColumn(String catalog, String schema, String table,
78: String column);
79:
80: /**
81: * Returns an array of Variable objects that references each column
82: * available in this table set item in order from left column to
83: * right column.
84: */
85: Variable[] allColumns();
86:
87: // /**
88: // * Returns a Queriable object that can be evaluated to return a tangible
89: // * Table object to use in a query.
90: // * <p>
91: // * Note that this method would generally only be used at the end of the
92: // * lifespan of this instance.
93: // */
94: // Queriable getQueriable();
95:
96: }
|