Hi all,
I remember a couple of occurrences where I could've paid anything to see the SQL
string that some PreparedStatement was actually sending to a database... I think I even wrote a "debugging decorator" for PreparedStatement a couple of years ago just to see "roughly" how the SQL looks like.
Back then I wondered why the PreparedStatement API is such a black box and hoped that the next versions of
JDBC would bring delight. People are often looking after solutions for mapping database queries dynamically to different tables etc. using some string concatenation hack.
Why isn't there a standard class providing PreparedStatement-like programming interface with setter methods also for table names? Maybe the PreparedStatement wouldn't be so prepared anymore but it would definitely be a cleaner solution than to do
It shouldn't be too difficult to add a method like setIdentifier(int index, String identifierName) to a statement class.
Am I missing something? Is this really a completely irrelevant/outdated question?