I have this code in my project.
PreparedStatement query = participantsConnection.prepareStatement(
"SELECT id, surname, name, login, grade " +
"FROM " + prefix + "users " +
"JOIN " + prefix + "participants ON id=user_id " +
(byId ? "WHERE id=? AND trash=0" : "WHERE login=? AND pass_hash=? AND trash=0")
I opened the project in Idea 122.746 and configured a datasource to make idea understand my request and to highlight it. But it absolutely failed to understand anything. For example, It can not find the users table because the prefix is not written precisely. And it thinks that the line query.setString(2, ... has an error in the argument 2 because there is only one ? in the request.
I need to make only a few requests in my code so I don't want to use any frameworks, the plain JDBC is just enough. How should one treat the situation?
* There is a bug in Idea, and developers should somehow make it work on this example
* Developers should not mark errors in this code, they should highlight them as warnings
* I should not check this code over a datasource and I should disable the feature
* This code is extremely bad written and I should write it in some other way. How?