Retrieve the currently set "returning" statement and amend it? #15898
-
Hello Sorry for another question like this. I'm working on a piece of software that has multiple places transforming a query. Now it is possible that someone creates a query with the "returningResult" set to some field. I would like to later look at the constructed query and perhaps change what fields to return. I couldn't find a way to do that though. The UpdateQueryImpl does store the returning-Fields but it is "write-only". I suppose there is a reason for this? Perhaps I am going about this the wrong way? Any help would be appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Thanks for your message. You'll find all the resources you need here: Specifically: |
Beta Was this translation helpful? Give feedback.
-
I hate to bother you again, but that doesn't seem to be working in my case. Perhaps this is a case of a combination of many interfaces/subclasses and visibilities and the way I construct my query? Here's the query I have (it's a test database based on a public schema):
And in an ExecuteListener, in the start-method, I try to traverse/replace the tree and look for QOM.InsertReturning. It does seem to be a "QOM.Insert" though but the cast to QOM.InsertReturning fails. I can see the data but perhaps its a visiblity issue because the class implementing the public interface is protected? If you have any pointers on where to look next, that would be great. Thanks. |
Beta Was this translation helpful? Give feedback.
A little meta hint about the apologies: They just set the tone to "True, I actually hate replying to this." (even if I don't!) and with that, no one wins. You have valid questions and they may lead to improved documentation / etc.
Indeed, the
InsertQueryImpl
type only implementsQOM.Insert
, and notQOM.InsertReturning
. That's an oversight (note theQOM
APIs are still experimental, so there are a few rough spots like this). I've created an issue to address this:I suspect there's no clean workaround for this, for now, other than using reflection.