Skip to content
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

fix Issue # 3145 boolean types not handled in SimpleQuery mode #3146

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ public String toString(@Positive int index, boolean standardConformingStrings) {
type = "interval";
} else if (paramType == Oid.NUMERIC) {
type = "numeric";
} else if (paramType == Oid.UUID) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we handle UUID above or is that only in some specific conditions?

If not, does everything in the above "handle in binary..." list need to be included here? (e.g. all the int types)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like binary is a specific case and yes, in that case we need to handle everything. Thanks for the review

type = "uuid";
} else if (paramType == Oid.BOOL) {
type = "boolean";
} else {
type = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ public void testSetNumber() throws SQLException {
Assert.assertEquals(new BigDecimal("3.2"), d);
}

@Test
public void testSetBoolean() throws SQLException {
try (PreparedStatement ps = con.prepareStatement("select false union select (select ?)")) {
ps.setBoolean(1, true);

try (ResultSet rs = ps.executeQuery()) {
assert (rs.next());
rs.getBoolean(1);
}
}
}

@Test
public void testTimestampTzSetNull() throws SQLException {
PreparedStatement pstmt = con.prepareStatement("INSERT INTO timestamptztable (tstz) VALUES (?)");
Expand Down