forked from rondunn/JDBCExcel
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ResultSetMetaData.java
53 lines (41 loc) · 1013 Bytes
/
ResultSetMetaData.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package JDBCExcel;
public class ResultSetMetaData extends BaseResultSetMetaData {
ResultSet resultSet;
public ResultSetMetaData (ResultSet rs) {
this.resultSet = rs;
}
@Override
public int getColumnCount () {
return resultSet.columns.size();
}
@Override
public String getColumnLabel (int col) {
return resultSet.columns.get(col-1);
}
@Override
public String getColumnName (int col) {
String name = resultSet.stmt.queryCols.get(col-1);
if (name.startsWith("'") || name.startsWith("\"") || name.startsWith("[")) name = name.substring(1,name.length()-1);
return name;
}
@Override
public int getColumnType (int col) {
return java.sql.Types.VARCHAR;
}
@Override
public String getColumnTypeName (int col) {
return "Text";
}
@Override
public int getPrecision (int col) {
return 256;
}
@Override
public int getScale (int col) {
return 0;
}
@Override
public int isNullable (int col) {
return java.sql.ResultSetMetaData.columnNullable;
}
}