01: package jimm.datavision.source.sql;
02:
03: import jimm.datavision.source.Table;
04: import jimm.datavision.source.Column;
05: import java.sql.*;
06:
07: /**
08: * A database column. It knows the table to which it belongs, its name,
09: * and other metadata. The id of a column is a string of the form
10: * "table_name.column_name".
11: *
12: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
13: */
14: public class SQLColumn extends Column {
15:
16: protected SQLTable table;
17:
18: /**
19: * Constructor.
20: *
21: * @param table the table to which this column belongs
22: * @param colName the column name
23: * @param type the data types
24: * @see java.sql.DatabaseMetaData#getColumns
25: */
26: public SQLColumn(SQLTable table, String colName, int type)
27: throws SQLException {
28: super (table.getName() + "." + colName, colName, type);
29: this .table = table;
30: }
31:
32: /**
33: * Returns the table to which this column belongs.
34: *
35: * @return the table
36: */
37: public Table getTable() {
38: return table;
39: }
40:
41: }
|