1 5 package org.h2.server.web; 6 7 import java.sql.DatabaseMetaData ; 8 import java.sql.ResultSet ; 9 import java.sql.SQLException ; 10 import java.util.ArrayList ; 11 12 public class DbTableOrView { 13 DbSchema schema; 14 String name; 15 String quotedName; 16 boolean isView; 17 DbColumn[] columns; 18 19 DbTableOrView(DbSchema schema, ResultSet rs) throws SQLException { 20 this.schema = schema; 21 name = rs.getString("TABLE_NAME"); 22 String type = rs.getString("TABLE_TYPE"); 23 isView = "VIEW".equals(type); 24 quotedName = schema.contents.quoteIdentifier(name); 25 } 26 27 public void readColumns(DatabaseMetaData meta) throws SQLException { 28 ResultSet rs = meta.getColumns(null, schema.name, name, null); 29 ArrayList list = new ArrayList (); 30 while(rs.next()) { 31 DbColumn column = new DbColumn(rs); 32 list.add(column); 33 } 34 rs.close(); 35 columns = new DbColumn[list.size()]; 36 list.toArray(columns); 37 } 38 39 } 40 | Popular Tags |