1 5 package org.h2.server.web; 6 7 import java.sql.DatabaseMetaData ; 8 import java.sql.ResultSet ; 9 import java.sql.SQLException ; 10 11 public class DbColumn { 12 String name; 13 String dataType; 14 15 DbColumn(ResultSet rs) throws SQLException { 16 name = rs.getString("COLUMN_NAME"); 17 String type = rs.getString("TYPE_NAME"); 18 int size = rs.getInt("COLUMN_SIZE"); 19 if(size > 0) { 20 type += "("+size; 21 int prec = rs.getInt("DECIMAL_DIGITS"); 22 if(prec > 0) { 23 type += ", " + prec; 24 } 25 type += ")"; 26 } 27 if(rs.getInt("NULLABLE") == DatabaseMetaData.columnNoNulls) { 28 type +=" NOT NULL"; 29 } 30 dataType = type; 31 } 32 } 33 | Popular Tags |