/** * get description for the table with given name * * @param tableName - name of the table * @return column names as string list * @throws DataBaseTableException - if something wrong */ public List<String> getTableDescription(String tableName) throws DataBaseTableException { TableDescription td = null; for (DataBase db : databases.values()) { td = db.getTableDescription(tableName); if (td != null) { return td.getColumnNames(); } } return null; }
/** * get descriptions of all tables in the database * * @return set of descriptions, where each descriptions - is a list that contains name of the * table at 0 index, and column names. Key name has 1 index in list. */ public Map<String, TableDescription> getTablesInDataBaseDescription() { Map<String, TableDescription> result = new HashMap<String, TableDescription>(); for (DataBase db : databases.values()) { for (TableDescription td : db.getTablesDescriptions()) { String tableName = td.getName(); if (!result.containsKey(tableName)) { result.put(tableName, td); } } } return result; }
/** * create table with given description * * @param tableDescription - given description * @return true - if database modified * @throws DataBaseTableException - if something wrong */ public boolean createTable(TableDescription tableDescription) throws DataBaseTableException { String tableName = tableDescription.getName(); List<String> columnNames = tableDescription.getColumnNames(); return createTable(tableName, columnNames); }