Java Code Examples for com.couchbase.client.java.query.N1qlQueryResult#forEach()
The following examples show how to use
com.couchbase.client.java.query.N1qlQueryResult#forEach() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N1QLLiveTest.java From tutorials with MIT License | 5 votes |
@Test public void whenBasicSelectQuery_thenGetQueryResult() { Bucket bucket = bucketFactory.getTravelSampleBucket(); N1qlQueryResult result = bucket.query(N1qlQuery.simple("SELECT * FROM test")); result.forEach(System.out::println); System.out.println("result count: " + result.info().resultCount()); System.out.println("error count: " + result.info().errorCount()); }
Example 2
Source File: N1QLLiveTest.java From tutorials with MIT License | 5 votes |
@Test public void givenInsertStatement_whenQuery_thenUpdate() { Bucket bucket = bucketFactory.getTravelSampleBucket(); String query = "INSERT INTO `travel-sample` (KEY, VALUE) " + " VALUES(" + "\"cust1293\", " + "{\"id\":\"1293\",\"name\":\"Sample Airline\", \"type\":\"airline\"})" + " RETURNING META().id as docid, *"; N1qlQueryResult r1 = bucket.query(N1qlQuery.simple(query)); r1.forEach(System.out::println); }
Example 3
Source File: N1QLLiveTest.java From tutorials with MIT License | 5 votes |
@Test public void givenUpdateStatement_whenQuery_thenUpdate() { Bucket bucket = bucketFactory.getTravelSampleBucket(); String query2 = "UPDATE `travel-sample` USE KEYS \"cust_1\" " + "SET name=\"Sample Airline Updated\" RETURNING name"; N1qlQueryResult result = bucket.query(N1qlQuery.simple(query2)); result.forEach(System.out::println); }
Example 4
Source File: N1QLLiveTest.java From tutorials with MIT License | 5 votes |
@Test public void givenUnestUpdateStatement_whenQuery_thenResult() { Bucket bucket = bucketFactory.getTravelSampleBucket(); String query3 = "UPDATE `travel-sample` USE KEYS \"cust_2\" " + "UNSET name RETURNING *"; N1qlQueryResult result1 = bucket.query(N1qlQuery.simple(query3)); result1.forEach(System.out::println); }