1 package net.jaekl.squelch.stmt;
3 import java.sql.ResultSet;
4 import java.sql.SQLException;
6 import net.jaekl.squelch.sql.Column;
7 import net.jaekl.squelch.sql.Row;
9 public class TabularColumnInfo extends Tabular {
10 private static final Column[] COLUMNS = {
11 new Column("Column", String.class, 32),
12 new Column("Type", String.class, 16),
13 new Column("Modifiers", String.class, 16)
15 private ResultSet m_rs;
17 public TabularColumnInfo(ResultSet rs) {
22 Column[] getCols() throws SQLException {
27 Row getNext() throws SQLException {
32 Row row = new Row(COLUMNS.length);
34 String columnName = m_rs.getString(4);
36 String typeName = m_rs.getString(6);
37 int columnSize = m_rs.getInt(7);
39 int decimalDigits = m_rs.getInt(8); // digits after the decimal point
40 if (decimalDigits > 0) {
41 typeName += "(" + columnSize + "." + decimalDigits + ")";
44 typeName += "(" + columnSize + ")";
48 String remarks = m_rs.getString(12);
49 String isNullable = m_rs.getString(18);
50 String isAutoIncrement = m_rs.getString(23);
52 if ("YES".equals(isNullable)) {
55 else if ("NO".equals(isNullable)) {
58 if ("YES".equals(isAutoIncrement)) {
59 if (notes.length() > 0) {
62 notes += "AUTOINCREMENT";
64 if ((null != remarks) && (remarks.length() > 0)) {
65 if (notes.length() > 0) {
68 notes += "(" + remarks + ")";
71 row.setValue(1, columnName);
72 row.setValue(2, typeName);
73 row.setValue(3, notes);