Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ptiurin committed Oct 18, 2024
1 parent fb94f40 commit a9e785a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ void shouldEscapeCharactersWhenTransformingFromString() throws SQLException {
assertEquals("'105\\'", JavaTypeToFireboltSQLString.transformAny("105\\"));
}

@Test
void shouldEscapeCharactersWhenTransformingFromStringLegacy() throws SQLException {
// quotes are escaped
assertEquals("'105'' OR 1=1--'' '",
JavaTypeToFireboltSQLString.STRING.transform("105' OR 1=1--' ", FireboltVersion.LEGACY));
assertEquals("'105'' OR 1=1--'' '",
JavaTypeToFireboltSQLString.transformAny("105' OR 1=1--' ", FireboltVersion.LEGACY));
// \0 is escaped
assertEquals("'105\\\\0'", JavaTypeToFireboltSQLString.STRING.transform("105\0", FireboltVersion.LEGACY));
assertEquals("'105\\\\0'", JavaTypeToFireboltSQLString.transformAny("105\0", FireboltVersion.LEGACY));
// backslashes are escaped
assertEquals("'105\\\\'", JavaTypeToFireboltSQLString.STRING.transform("105\\", FireboltVersion.LEGACY));
assertEquals("'105\\\\'", JavaTypeToFireboltSQLString.transformAny("105\\", FireboltVersion.LEGACY));
}

@Test
void shouldTransformLongToString() throws SQLException {
assertEquals("105", JavaTypeToFireboltSQLString.LONG.transform(105L));
Expand Down

0 comments on commit a9e785a

Please sign in to comment.