|
32 | 32 | import com.google.cloud.spanner.KeyRange; |
33 | 33 | import com.google.cloud.spanner.KeySet; |
34 | 34 | import com.google.cloud.spanner.Mutation; |
35 | | -import com.google.cloud.spanner.Options; |
36 | 35 | import com.google.cloud.spanner.ReadOnlyTransaction; |
37 | 36 | import com.google.cloud.spanner.ResultSet; |
38 | 37 | import com.google.cloud.spanner.Spanner; |
@@ -997,15 +996,15 @@ static void queryNestedStructField(DatabaseClient dbClient) { |
997 | 996 | // [START spanner_dml_standard_insert] |
998 | 997 | static void insertUsingDml(DatabaseClient dbClient) { |
999 | 998 | dbClient |
1000 | | - .readWriteTransaction() |
1001 | | - .run(transaction -> { |
1002 | | - String sql = |
1003 | | - "INSERT INTO Singers (SingerId, FirstName, LastName) " |
1004 | | - + " VALUES (10, 'Virginia', 'Watson')"; |
1005 | | - long rowCount = transaction.executeUpdate(Statement.of(sql)); |
1006 | | - System.out.printf("%d record inserted.\n", rowCount); |
1007 | | - return null; |
1008 | | - }); |
| 999 | + .readWriteTransaction() |
| 1000 | + .run(transaction -> { |
| 1001 | + String sql = |
| 1002 | + "INSERT INTO Singers (SingerId, FirstName, LastName) " |
| 1003 | + + " VALUES (10, 'Virginia', 'Watson')"; |
| 1004 | + long rowCount = transaction.executeUpdate(Statement.of(sql)); |
| 1005 | + System.out.printf("%d record inserted.\n", rowCount); |
| 1006 | + return null; |
| 1007 | + }); |
1009 | 1008 | } |
1010 | 1009 | // [END spanner_dml_standard_insert] |
1011 | 1010 |
|
@@ -2231,6 +2230,7 @@ public static void main(String[] args) { |
2231 | 2230 | printUsageAndExit(); |
2232 | 2231 | } |
2233 | 2232 | // [START init_client] |
| 2233 | + SpannerOptions options = SpannerOptions.newBuilder().build(); |
2234 | 2234 | Spanner spanner = options.getService(); |
2235 | 2235 | DatabaseAdminClient dbAdminClient = null; |
2236 | 2236 | try { |
|
0 commit comments