Trim the eggplants, cut them into 1-inch cubes, and transfer them to a colander. Sprinkle with salt and let them stand for 30 minutes. Rinse, drain well, and pat dry. In a bowl, combine the black olives, green olives, and capers. Cover with warm water and let them plump for 20 minutes. Drain well. In a saucepan of boiling water, blanch the celery for 1 to 2 minutes, or until just tender. Drain and pat dry. In a large skillet set over moderately high heat, heat 3 tablespoons of the oil until hot. Add the eggplant in small batches and cook it, stirring occasionally and adding 3 to 4 tablespoons of water to prevent sticking, until just tender and golden brown. Transfer the fried eggplant to a bowl and, adding oil and water as needed, fry the remaining eggplant. Add 2 tablespoons of oil to the skillet and heat until hot over moderate heat. Add the onions and cook, stirring occasionally, just until tender. Add the tomato sauce, 2 cups of water, the reserved eggplant, olives, capers, celery, and salt and pepper. Simmer the mixture over low heat, stirring occasionally, for 30 minutes. In a small bowl, combine the sugar and vinegar, stirring until dissolved. Add the sugar mixture to the eggplant mixture and stir to combine. Transfer the caponatina to a bowl, let it cool to room temperature, and chill it, covered, for 1 to 2 days to allow the flavors to blend.