public String[][] describePoint(LinePoint point) { Database db = model.getDb(); if (db == null) { appendToHistory("Cannot describe point because no database is selected.\n"); return null; } String query = "SELECT * FROM " + db.getTableName() + " WHERE "; ArrayList<String> keyNames = point.getKeyNames(); ArrayList<String> keyValues = point.getKeyValues(); String[][] array = null; for (int i = 0; i < keyNames.size(); i++) { if (i != 0) { query += " && "; } try { query += keyNames.get(i) + "=" + Double.valueOf(keyValues.get(i)); } catch (NumberFormatException e) { query += keyNames.get(i) + " like '" + keyValues.get(i) + "'"; } } appendToHistory(query + "\n"); try { ResultSet result = model.queryDb(query); ResultSetMetaData md = result.getMetaData(); int numCols = md.getColumnCount(); array = new String[numCols][2]; while (result.next()) { for (int i = 0; i < numCols; i++) { array[i][0] = md.getColumnName(i + 1); try { array[i][1] = String.valueOf(result.getDouble(i + 1)); } catch (SQLException e) { array[i][1] = result.getString(i + 1); } if (result.wasNull()) { array[i][1] = "null"; } } } } catch (DbConnectionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (QueryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return array; }