-
Notifications
You must be signed in to change notification settings - Fork 32
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
The FOR XML clause is not allowed in a CURSOR statement #209
Comments
This is somewhat related to #66 as we don't have support for XML yet. |
Maybe. This works: System.out.println(
Flux.from(cf.create())
.flatMap(c -> c.createStatement("select (select 1 as a for xml path)").execute())
.flatMap(it -> it.map((r, m) -> r.get(0)))
.collectList()
.block()
); The result is produced as System.out.println(
Flux.from(cf.create())
.flatMap(c -> c.createStatement("select 1 as a for json path").execute())
.flatMap(it -> it.map((r, m) -> r.get(0)))
.collectList()
.block()
); |
The issue is related to the default cursor usage in the driver. Setting Statement statement = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet resultSet = statement.executeQuery("select 1 as a for xml path"); resulting in
|
[#209] Signed-off-by: Mark Paluch <[email protected]>
[#209] Signed-off-by: Mark Paluch <[email protected]>
I see, I hadn't thought of that possibility. But the equivalent of JDBC's |
It's not required as we assume by default forward-only cursors and setting the fetch size is the main indicator for the cursor page size. Setting the fetch size to zero expresses the intent to fetch all data directly and so we bypass the cursor. Users can configure some defaults, whether to prefer cursored execution or if the statement starts with |
Could there be a more explicit setting to govern this behaviour? I don't like the idea of setting the fetch size on behalf of the user too much, even if it's only for these |
We now no longer prefer cursor usage by default when the statement ends with a FOR XML/JSON clause to avoid server side errors reporting that cursor usage is not supported. [resolves #209] Signed-off-by: Mark Paluch <[email protected]>
Bug Report
Versions
Current Behavior
Run a query containing the T-SQL
FOR
clause with R2DBC and get this error:Steps to reproduce
Expected behavior/code
This should work out of the box, just like with JDBC and produce:
The text was updated successfully, but these errors were encountered: