Elffuss BraidHub

kikocis/java-driver public

JAVA-712 Add test for testing with column names with escaped quotes.
Changeset53290cd23367765d6935f182efc58a26656e7f63968d7f938aaf4418f7488c21
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-19 11:09 -05:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-19 11:09 -05:00
Parents109fb4626797

Browse the files at this changeset

1 file changed

modified driver-core/src/test/java/com/datastax/driver/core/querybuilder/QueryBuilderTest.java +9 −0
@@ -841,6 +841,15 @@
841841 assertThat(statement.toString()).isEqualTo(query);
842842 }
843843
844+ @Test(groups = "unit")
845+ public void should_quote_column_names_with_escaped_quotes() {
846+ // A column name can include quotes as long as it is escaped with another set of quotes, so "foo""bar" is a valid name.
847+ String query = "SELECT * FROM foo WHERE \"foo \"\" bar\"=1;";
848+ Statement statement = select().from("foo").where(eq(quote("foo \"\" bar"), 1));
849+
850+ assertThat(statement.toString()).isEqualTo(query);
851+ }
852+
844853 @Test(groups = "unit")
845854 public void should_not_serialize_raw_query_values() {
846855 RegularStatement select = select().from("test").where(gt("i", raw("1")));