@Test(groups = "short") public void should_delete_list_element() throws Exception { // given session().execute("INSERT INTO test_coll (k, a, b) VALUES (1, [1,2,3], null)"); // when BuiltStatement statement = delete().listElt("a", 1).from("test_coll").where(eq("k", 1)); session().execute(statement); // then List<Integer> actual = session().execute("SELECT a FROM test_coll WHERE k = 1").one().getList("a", Integer.class); assertThat(actual).containsExactly(1, 3); }
@Test(groups = "short") public void should_delete_list_element_with_bind_marker() throws Exception { // given session().execute("INSERT INTO test_coll (k, a) VALUES (1, [1,2,3])"); // when BuiltStatement statement = delete().listElt("a", bindMarker()).from("test_coll").where(eq("k", 1)); PreparedStatement ps = session().prepare(statement); session().execute(ps.bind(1)); // then List<Integer> actual = session().execute("SELECT a FROM test_coll WHERE k = 1").one().getList("a", Integer.class); assertThat(actual).containsExactly(1, 3); }
delete().from("foo").where(lt("k", now())), update("foo").where(eq("k", fcall("now"))), delete().listElt("a", 1).from("test_coll"),
@Test(groups = "short") public void should_delete_list_element_with_bind_marker() throws Exception { // given session().execute("INSERT INTO test_coll (k, a) VALUES (1, [1,2,3])"); // when BuiltStatement statement = delete().listElt("a", bindMarker()).from("test_coll").where(eq("k", 1)); PreparedStatement ps = session().prepare(statement); session().execute(ps.bind(1)); // then List<Integer> actual = session().execute("SELECT a FROM test_coll WHERE k = 1").one().getList("a", Integer.class); assertThat(actual).containsExactly(1, 3); }
@Test(groups = "short") public void should_delete_list_element() throws Exception { // given session().execute("INSERT INTO test_coll (k, a, b) VALUES (1, [1,2,3], null)"); // when BuiltStatement statement = delete().listElt("a", 1).from("test_coll").where(eq("k", 1)); session().execute(statement); // then List<Integer> actual = session().execute("SELECT a FROM test_coll WHERE k = 1").one().getList("a", Integer.class); assertThat(actual).containsExactly(1, 3); }
delete().from("foo").where(lt("k", now())), update("foo").where(eq("k", fcall("now"))), delete().listElt("a", 1).from("test_coll"),