Skip to content

Commit b8d5451

Browse files
authored
test: add tests for concatenated literals (#2791)
1 parent 383fea5 commit b8d5451

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java

+19
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,25 @@ int skipMultiLineComment(String sql, int startIndex) {
15781578
return PostgreSQLStatementParser.skipMultiLineComment(sql, startIndex, null);
15791579
}
15801580

1581+
@Test
1582+
public void testConcatenatedLiterals() {
1583+
assumeTrue(dialect == Dialect.GOOGLE_STANDARD_SQL);
1584+
1585+
assertTrue(parser.isUpdateStatement("UPDATE foo SET name='foo' 'bar' WHERE ID=1"));
1586+
assertTrue(parser.isQuery("SELECT 'boo' 'bar' FROM my_table WHERE value='lit1''lit2'"));
1587+
assertTrue(
1588+
parser.checkReturningClause(
1589+
"insert into my_table (id, value) values (1, 'value' '1') then return id"));
1590+
assertTrue(parser.isUpdateStatement("UPDATE foo SET name=b'foo' b'bar' WHERE ID=1"));
1591+
1592+
assertEquals(
1593+
1,
1594+
parser.convertPositionalParametersToNamedParameters(
1595+
'?', "select 'foo?''bar?' where id=? and value='?' '?'")
1596+
.numberOfParameters,
1597+
1);
1598+
}
1599+
15811600
@Test
15821601
public void testSkipSingleLineComment() {
15831602
assumeTrue(dialect == Dialect.POSTGRESQL);

0 commit comments

Comments
 (0)