query += "'" + key[i].toString() + "'";
query += "\"" + Utils.backQuoteChars(key[i].toString()) + "\"";
  public Object [] getResultFromTable(String tableName,					 ResultProducer rp,					 Object [] key)    throws Exception {    String query = "SELECT ";    String [] resultNames = rp.getResultNames();    for (int i = 0; i < resultNames.length; i++) {      if (i != 0) {	query += ", ";      }      query += resultNames[i];    }    query += " FROM " + tableName;    String [] keyNames = rp.getKeyNames();    if (keyNames.length != key.length) {      throw new Exception("Key names and key values of different lengths");    }    boolean first = true;    for (int i = 0; i < key.length; i++) {      if (key[i] != null) {	if (first) {	  query += " WHERE ";	  first = false;	} else {	  query += " AND ";	}	query += "Key_" + keyNames[i] + '=';	if (key[i] instanceof String) {	  query += "'" + key[i].toString() + "'";	} else {	  query += key[i].toString();	}      }    }    if (!execute(query)) {      throw new Exception("Couldn't execute query: " + query);    }    ResultSet rs = m_PreparedStatement.getResultSet();    ResultSetMetaData md = rs.getMetaData();    int numAttributes = md.getColumnCount();    if (!rs.next()) {      throw new Exception("No result for query: " + query);    }    // Extract the columns for the result    Object [] result = new Object [numAttributes];    for(int i = 1; i <= numAttributes; i++) {      /* switch (md.getColumnType(i)) {      case Types.CHAR:      case Types.VARCHAR:      case Types.LONGVARCHAR:      case Types.BINARY:      case Types.VARBINARY:      case Types.LONGVARBINARY: */      switch (translateDBColumnType(md.getColumnTypeName(i))) {      case STRING : 	result[i - 1] = rs.getString(i);	if (rs.wasNull()) {	  result[i - 1] = null;	}	break;      case FLOAT:      case DOUBLE:	result[i - 1] = new Double(rs.getDouble(i));	if (rs.wasNull()) {	  result[i - 1] = null;	}	break;      default:	throw new Exception("Unhandled SQL result type (field " + (i + 1)			    + "): "			    + DatabaseUtils.typeName(md.getColumnType(i)));      }    }    if (rs.next()) {      throw new Exception("More than one result entry "			  + "for result key: " + query);    }    rs.close();    return result;  }