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
Issue on prepared statement if the parameter is null (e.g. optional parameter, research result of #579) #1365
Comments
I'm too busy to test it, but to me it seems reasonable. The idea to test it with an optional report parameter is good, however, please test it with a sub-report, too: Say with we have a table PERSONS containing colums ID (as primary key), NAME, MOTHER_ID, FATHER_ID Now we want to create a report like this: Outer report: DataSet persons Inner report: DataSet parents This DataSet needs two dataset parameters. Let's use a Table Item for the persons dataset. Test if the report works correctly for orphans or if one of the two parents is null. |
Ok, I think I understand your logic it is like a tree logic. But nevertheless I will try to create an report according to your description. |
I created an additional report with the loop tables based on string- and integer-id-columns. The good news the change will fixed such special kind of unaccessible NULL-column type So I will create a PR for it. |
The issue is fixed with PR #1371 |
I analysed the old PR #579.
It didn't understand what the target in full it seems to me to improve the exception message to get it more readable.
But I was interested on the main reason of the issue, so I veryfied the testing report at the communication and started a deep research.
And the reason of the exception is I think an "old"-topic/"known error". The reason is that the query cannot be executed if the BIRT-parameter of a query-parameter is null.
The most common way is here to use an optional parameter and set him to "null value" (then we will get the exception).
The technical cause of the exception is the implementation of the jdbc-method on the prepared statement to set the "null" value with "isNull()". The problem there is that the parameter type should be fetched to set the value but the current implementation won't be supported through Oracle with the ojdbc-driver:
relevant implementation line at class "Statement", method "setNull":
this.preStat.setNull(parameterId, pm.getParameterType(parameterId));
My suggestion to fix it would be to use the standard way which supports oracle in combination with the current version.
I have done the tests in both versions of statements which was descripted on #579 and I tested it with Oracle V19 and MS SQL Server 2019. With the small change the exception will be avoid. Here my result screens:
I would prefer to create here the according PR to fix it.
Any hint to improve the change or avoid the "doubled try-catch" is welcome.
The text was updated successfully, but these errors were encountered: