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 DbSchema { 13 DbContents contents; 14 String name; 15 String quotedName; 16 17 DbTableOrView[] tables; 18 public boolean isDefault; 19 20 DbSchema(DbContents contents, String name, boolean isDefault) throws SQLException { 21 this.contents = contents; 22 this.name = name; 23 this.quotedName = contents.quoteIdentifier(name); 24 this.isDefault = isDefault; 25 } 26 27 public void readTables(DatabaseMetaData meta, String [] tableTypes) throws SQLException { 28 ResultSet rs = meta.getTables(null, name, null, tableTypes); 29 ArrayList list = new ArrayList (); 30 while(rs.next()) { 31 DbTableOrView table = new DbTableOrView(this, rs); 32 list.add(table); 33 } 34 rs.close(); 35 tables = new DbTableOrView[list.size()]; 36 list.toArray(tables); 37 for(int i=0; i<tables.length; i++) { 39 DbTableOrView tab = tables[i]; 40 tab.readColumns(meta); 41 } 42 } 44 45 } 46 | Popular Tags |