-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Jaybird 5 trims returned data #729
Comments
Jaybird doesn't hardcode the call I tried this with the following test, and the value is not trimmed as expected: @Test
void testNoTrimByDefault() throws Exception {
try (Connection connection = getConnectionViaDriverManager();
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select 'abc ' from rdb$database")) {
assertTrue(rs.next(), "expected a row");
assertEquals("abc ", rs.getString(1), "value was unexpectedly trimmed");
}
} Please provide a reproduction program. |
Is this by any chance with |
Yes, I tried with a procedure call |
It looks like in |
OK, I can reproduce it with: @Test
void callableStatementShouldNotTrim() throws Exception{
executeDDL(con, """
create procedure char_return returns (val char(5)) as
begin
val = 'A';
end""");
try (CallableStatement cstmt = con.prepareCall("execute procedure char_return")) {
cstmt.execute();
assertEquals("A ", cstmt.getString(1));
}
} |
This trim behaviour was also present in Jaybird 4 (and in Jaybird 3). If you experience different behaviour compared to Jaybird 4, I would really like to see a reproducible test case. I guess you might be using |
Behaviour was introduced by accident in #167 (but only in 3.0, not in 2.2.6) |
4.0.7.java8 (no trimming)
FBWorkaroundStringField.getString() line: 111; Here trimString = false 5.0.0.java8-beta-1 (trimming)
FBStringField.applyTrimTrailing(String) line: 214; Here trimTrailing = true |
Looking at your that stacktrace, your code is using To be clear, I acknowledge this is a bug (introduced in Jaybird 3, but now more visible because it is now also exposed through |
In Jaybird 4 the trim happens in |
@Test
public void callableStatementShouldNotTrim_729() throws Exception {
executeDDL(con,
"create procedure char_return returns (val char(5)) as\n" +
"begin\n" +
" val = 'A';\n" +
"end");
try (CallableStatement cstmt = con.prepareCall("execute procedure char_return")) {
cstmt.execute();
ResultSet rs = cstmt.getResultSet();
assertTrue("Expected a row", rs.next());
assertEquals("A ", rs.getString(1));
assertEquals("A ", cstmt.getObject(1));
assertEquals("A ", cstmt.getString(1));
}
} In Jaybird 4, this test fails on Is this comparable to your usage? |
This passes on 4.0.7 and fails on 5.0.0 |
Yes, but if you use |
Yes, with |
Fix can be tested with jaybird-5.0.1.java11-SNAPSHOT (and jaybird-5.0.1.java8-SNAPSHOT) from https://oss.sonatype.org/content/repositories/snapshots |
Hi Mark!
org.firebirdsql.jdbc.FBResultSet has hard coded
setTrimTrailing(true)
call.Prior Jaybird versions returned the string without trim. This is a breaking change, Jaybird should/must return original data returned by the Firebird engine, we need the whitespace.
Please add an option to turn off this behaviour.
Thank you!
The text was updated successfully, but these errors were encountered: