@Override
	public Object visit(AttributeExp node) throws DatabaseException {
		
		Object ret = null;
		
		// tuples can be null if the expression can only reference literals (for INSERT)
		if (tuples == null) {
			throw new DatabaseException("Attributes cannot be referenced when specifying a value.");
		}
		
		// find this attribute's position and containing tuple
		String attrName = node.getName();
		boolean attrFound = false;
		for (int i=0; i<tuples.length; ++i) {
			Integer position = schemas[i].getVisibleAttributePosition(attrName);
			if (position != null) {
				if (!attrFound) {
					ret = tuples[i].getValueAt(position);
					attrFound = true;
				} else {
					throw new DatabaseException("Attribute '"+attrName+
							"' found in multiple tables.");
				}
			}
		}
		if (!attrFound) {
			throw new DatabaseException("Attribute '"+attrName+
					"' referenced in condition does not exist.");
		}
		return ret;
	}