datasource-proxy icon indicating copy to clipboard operation
datasource-proxy copied to clipboard

Throwing SQLException in QueryExecutionListener

Open whiskeysierra opened this issue 5 years ago • 2 comments

The methods in QueryExecutionListener don't allow to throw SQLException right now. Unfortunately almost all methods in the Statement (as part of ExecutionInfo) declare to throw SQLException when being invoked.

From what I can tell it should be safe to allow SQLException to be thrown there since all methods in Statement and PreparedStatement that invoke the listener allow to throw SQLException as well.

whiskeysierra avatar Nov 26 '19 08:11 whiskeysierra

hm, what is the use case for throwing such exception or invoking statement in query listener? If you happen to perform some operations on statement in listener, I think it's better to handle exceptions there? Otherwise, it may be confusing whether an exception is coming from the original invocation vs the one from listener.

ttddyy avatar Nov 27 '19 23:11 ttddyy

I want to get some metadata from the statement (via connection and then metadata) but all methods in JDBC throw SQLException.

Other than swallowing, how else could I possibly handle those exceptions? If it's not intended to call anything on the statement, why is it passed to the listener then?

On Thu, 28 Nov 2019, 00:15 Tadaya Tsuyukubo, [email protected] wrote:

hm, what is the use case for throwing such exception or invoking statement in query listener? If you happen to perform some operations on statement in listener, I think it's better to handle exceptions there? Otherwise, it may be confusing whether an exception is coming from the original invocation vs the one from listener.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ttddyy/datasource-proxy/issues/62?email_source=notifications&email_token=AADI7HPPTV5233Z7TMN6IPDQV35PLA5CNFSM4JRT7EE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFK7OLQ#issuecomment-559281966, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADI7HJFAWS3DDFONFDRARTQV35PLANCNFSM4JRT7EEQ .

whiskeysierra avatar Nov 28 '19 07:11 whiskeysierra