Menu

#42 Helpful error message when attempting DELETE/INSERT/UPDATE

open
None
5
2015-12-10
2015-12-10
No

Report a helpful error message if user attempts to use a DELETE, INSERT or UPDATE SQL statement with CsvJdbc.

Currently,

stmt.execute("DELETE FROM sample");

throws the following unhelpful SQLException

java.sql.SQLException: Syntax error: Encountered " <NAME> "DELETE "" at line 1, column 1.
Was expecting:
"SELECT" ...

at org.relique.jdbc.csv.CsvStatement.execute(CsvStatement.java:559)
at org.relique.jdbc.csv.Runner1.main(Runner1.java:33)

and INSERT and UPDATE throw similarly unhelpful SQLExceptions.

Discussion