Lines 60-65
Link Here
|
60 |
|
60 |
|
61 |
private static final Logger LOGGER = Logger.getLogger(JDBCValue.class.getName()); |
61 |
private static final Logger LOGGER = Logger.getLogger(JDBCValue.class.getName()); |
62 |
|
62 |
|
|
|
63 |
private final MetadataElement parent; |
63 |
private final String name; |
64 |
private final String name; |
64 |
private final SQLType type; |
65 |
private final SQLType type; |
65 |
private final int length; |
66 |
private final int length; |
Lines 75-81
Link Here
|
75 |
* @return a newly created JDBCValue instance |
76 |
* @return a newly created JDBCValue instance |
76 |
* @throws java.sql.SQLException |
77 |
* @throws java.sql.SQLException |
77 |
*/ |
78 |
*/ |
78 |
public static JDBCValue createProcedureValue(ResultSet rs) throws SQLException { |
79 |
public static JDBCValue createProcedureValue(ResultSet rs, MetadataElement parent) throws SQLException { |
79 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
80 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
80 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
81 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
81 |
int length = rs.getInt("LENGTH"); |
82 |
int length = rs.getInt("LENGTH"); |
Lines 84-100
Link Here
|
84 |
short radix = rs.getShort("RADIX"); |
85 |
short radix = rs.getShort("RADIX"); |
85 |
Nullable nullable = JDBCUtils.getProcedureNullable(rs.getShort("NULLABLE")); |
86 |
Nullable nullable = JDBCUtils.getProcedureNullable(rs.getShort("NULLABLE")); |
86 |
|
87 |
|
87 |
return new JDBCValue(name, type, length, precision, radix, scale, nullable); |
88 |
return new JDBCValue(parent, name, type, length, precision, radix, scale, nullable); |
88 |
} |
89 |
} |
89 |
|
90 |
|
90 |
/** |
91 |
/** |
|
|
92 |
* Create a value from a row in getFunctionColumns() |
93 |
* |
94 |
* @param rs the result set from getFunctionColumns, assumed to be at a valid row |
95 |
* @return a newly created JDBCValue instance |
96 |
* @throws java.sql.SQLException |
97 |
*/ |
98 |
public static JDBCValue createFunctionValue(ResultSet rs, MetadataElement parent) throws SQLException { |
99 |
// Delegate to the procedure Version - currently the same columns are used |
100 |
return createProcedureValue(rs, parent); |
101 |
} |
102 |
|
103 |
/** |
91 |
* Create a value from a row in DBMD.getColumns() |
104 |
* Create a value from a row in DBMD.getColumns() |
92 |
* |
105 |
* |
93 |
* @param rs the result set from getProcedureColumns, assumed to be at a valid row |
106 |
* @param rs the result set from getProcedureColumns, assumed to be at a valid row |
94 |
* @return a newly created JDBCValue instance |
107 |
* @return a newly created JDBCValue instance |
95 |
* @throws java.sql.SQLException |
108 |
* @throws java.sql.SQLException |
96 |
*/ |
109 |
*/ |
97 |
public static JDBCValue createTableColumnValue(ResultSet rs) throws SQLException { |
110 |
public static JDBCValue createTableColumnValue(ResultSet rs, MetadataElement parent) throws SQLException { |
98 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
111 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
99 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
112 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
100 |
|
113 |
|
Lines 112-118
Link Here
|
112 |
short radix = rs.getShort("NUM_PREC_RADIX"); |
125 |
short radix = rs.getShort("NUM_PREC_RADIX"); |
113 |
Nullable nullable = JDBCUtils.getColumnNullable(rs.getShort("NULLABLE")); |
126 |
Nullable nullable = JDBCUtils.getColumnNullable(rs.getShort("NULLABLE")); |
114 |
|
127 |
|
115 |
return new JDBCValue(name, type, length, precision, radix, scale, nullable); |
128 |
return new JDBCValue(parent, name, type, length, precision, radix, scale, nullable); |
116 |
} |
129 |
} |
117 |
|
130 |
|
118 |
/** |
131 |
/** |
Lines 123-129
Link Here
|
123 |
* @return a newly created JDBCValue instance |
136 |
* @return a newly created JDBCValue instance |
124 |
* @throws java.sql.SQLException |
137 |
* @throws java.sql.SQLException |
125 |
*/ |
138 |
*/ |
126 |
public static JDBCValue createTableColumnValueODBC(ResultSet rs) throws SQLException { |
139 |
public static JDBCValue createTableColumnValueODBC(ResultSet rs, MetadataElement parent) throws SQLException { |
127 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
140 |
String name = MetadataUtilities.trimmed(rs.getString("COLUMN_NAME")); |
128 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
141 |
SQLType type = JDBCUtils.getSQLType(rs.getInt("DATA_TYPE")); |
129 |
int length = 0; |
142 |
int length = 0; |
Lines 137-146
Link Here
|
137 |
short radix = rs.getShort("RADIX"); |
150 |
short radix = rs.getShort("RADIX"); |
138 |
Nullable nullable = JDBCUtils.getColumnNullable(rs.getShort("NULLABLE")); |
151 |
Nullable nullable = JDBCUtils.getColumnNullable(rs.getShort("NULLABLE")); |
139 |
|
152 |
|
140 |
return new JDBCValue(name, type, length, precision, radix, scale, nullable); |
153 |
return new JDBCValue(parent, name, type, length, precision, radix, scale, nullable); |
141 |
} |
154 |
} |
142 |
|
155 |
|
143 |
public JDBCValue(String name, SQLType type, int length, int precision, short radix, short scale, Nullable nullable) { |
156 |
public JDBCValue(MetadataElement parent, String name, SQLType type, int length, int precision, short radix, short scale, Nullable nullable) { |
|
|
157 |
this.parent = parent; |
144 |
this.name = name; |
158 |
this.name = name; |
145 |
this.type = type; |
159 |
this.type = type; |
146 |
this.length = length; |
160 |
this.length = length; |
Lines 193-199
Link Here
|
193 |
|
207 |
|
194 |
@Override |
208 |
@Override |
195 |
public MetadataElement getParent() { |
209 |
public MetadataElement getParent() { |
196 |
throw new UnsupportedOperationException("Not supported yet."); |
210 |
return this.parent; |
197 |
} |
211 |
} |
198 |
|
212 |
|
199 |
} |
213 |
} |