List columns = new ArrayList();
columns.add(new Column("ColumnName", "", 0)); //$NON-NLS-1$
- columns.add(new Column("Type", "", 0)); //$NON-NLS-1$
+ columns.add(new Column("Type Name", "", 0)); //$NON-NLS-1$
columns.add(new Column("Size", "", 0)); //$NON-NLS-1$
+ columns.add(new Column("Scale", "", 0)); //$NON-NLS-1$
columns.add(new Column("Nullable", "", 0)); //$NON-NLS-1$
columns.add(new Column("AutoIncrement", "", 0)); //$NON-NLS-1$
+ columns.add(new Column("Type", "", 0)); //$NON-NLS-1$
setColumns((Column[]) columns.toArray(new Column[columns.size()]));
ResultSetMetaData metaData = set.getMetaData();
Vector row = new Vector();
row.addElement(metaData.getColumnName(i));
row.addElement(metaData.getColumnTypeName(i));
- int textSize = metaData.getColumnDisplaySize(i);
- int precision = metaData.getPrecision(i);
- int scale = metaData.getScale(i);
- if (scale == 0 && precision == 0) {
- row.addElement(Integer.toString(precision));
- } else {
- row.addElement(textSize + ", " + precision + ", " + scale); //$NON-NLS-1$ //$NON-NLS-2$
+ long precision = 0;
+ try {
+ precision = metaData.getPrecision(i);
+ } catch (Throwable t) {
+ // Do nothing. An exception can be generated by some very large row sizes, like BLOB in Oracle.
+ // Then getPrecision() will generate an exception. So we ignore it and go on.
+ }
+ if (precision == 0) {
+ precision = metaData.getColumnDisplaySize(i);
}
+ int scale = metaData.getScale(i);
+
+ row.addElement(new Long(precision));
+ row.addElement(new Integer(scale));
+
int nullable = metaData.isNullable(i);
if (nullable == ResultSetMetaData.columnNoNulls) {
row.addElement("Not Null"); //$NON-NLS-1$
: Boolean.FALSE)
.toString());
rowList.add(new Row(row));
+ row.addElement(new Integer(metaData.getColumnType(i)));
}
setRows((Row[]) rowList.toArray(new Row[rowList.size()]));
- set.close();
}
public boolean isMetaData() {