-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter parsing for PreparedStatement #9
Comments
IMO this should be handled by server and that it already is. The driver should send the sql string and params as is to the server. |
@viliam-durina according to the JavaDoc of |
I tested postgresql: PreparedStatement st = conn.prepareStatement("select * from t");
st.setInt(1, 1); // throws
st = conn.prepareStatement("select * from ?");
st.setInt(1, 1); // does not throw
st = conn.prepareStatement("select * from m /* where a=? */");
st.setInt(1, 1); // throws
// this fails at parsing
st = conn.prepareStatement("select * from m /* where a=?"); This is their parser: |
The second one should also throw an exception at the |
For now any
?
is considered as a parameter that is not a correct behavior as?
might be present in the string literal (SELECT * FROM foo WHERE bar='?' AND baz= ?
).Also, we need to validate the correctness of the parameter location, e.g.
SELECT * FROM ? WHERE foo='bar'
is not valid.The text was updated successfully, but these errors were encountered: