01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/TKFieldTableData.java,v 1.7 2001/12/03 13:25:13 ralf Exp $
03: *
04: */
05: package com.teamkonzept.field;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10:
11: public class TKFieldTableData extends TKDBTableData {
12: public int form_id;
13: public int field_id;
14: public String field_type;
15: public String field_name;
16: public String field_show_name;
17:
18: public TKFieldTableData() {
19: }
20:
21: public TKFieldTableData(int form_id, int field_id,
22: String field_type, String field_name, String field_show_name) {
23: this .form_id = form_id;
24: this .field_id = field_id;
25: this .field_type = field_type;
26: this .field_name = field_name;
27: this .field_show_name = field_show_name;
28: }
29:
30: public TKFieldTableData(ResultSet r) throws SQLException {
31: this .form_id = r.getInt("FORM_ID");
32: this .field_id = r.getInt("FIELD_ID");
33: this .field_type = r.getString("FIELD_TYPE");
34: this .field_name = r.getString("FIELD_NAME");
35: // cave: oracle's jdbc driver returns null if the column contains NULL whereas sybase
36: // and postgresql return an empty string ("").
37: if (this .field_name == null) {
38: this .field_name = "";
39: }
40: this .field_show_name = r.getString("FIELD_SHOW_NAME");
41: }
42:
43: public TKDBTableData newFromResultSet(ResultSet r)
44: throws SQLException {
45: return new TKFieldTableData(r);
46: }
47:
48: public void insertIntoQuery(TKQuery query) throws SQLException {
49: query.setQueryParams("FORM_ID", new Integer(form_id));
50: query.setQueryParams("FIELD_ID", new Integer(field_id));
51: query.setQueryParams("FIELD_TYPE", field_type);
52: query.setQueryParams("FIELD_NAME", field_name);
53: query.setQueryParams("FIELD_SHOW_NAME", field_show_name);
54: }
55:
56: public String toString() {
57: return "( FORM_ID=" + String.valueOf(form_id) + ", FIELD_ID="
58: + String.valueOf(field_id) + ", FIELD_TYPE="
59: + field_type + ", FIELD_NAME=" + field_name
60: + ", FIELD_SHOW_NAME=" + field_show_name + ")";
61: }
62: //{{DECLARE_CONTROLS
63: //}}
64: }
|