use of com.google.cloud.spanner.Mutation.WriteBuilder in project spanner-jdbc by olavloite.
the class XATransaction method prepareMutations.
static void prepareMutations(TransactionContext transaction, String xid, List<Mutation> mutations) throws SQLException {
int index = 0;
for (Mutation mutation : mutations) {
WriteBuilder prepared = Mutation.newInsertBuilder(CloudSpannerXAConnection.XA_PREPARED_MUTATIONS_TABLE);
prepared.set(CloudSpannerXAConnection.XA_XID_COLUMN).to(xid);
prepared.set(CloudSpannerXAConnection.XA_NUMBER_COLUMN).to(index);
prepared.set(CloudSpannerXAConnection.XA_MUTATION_COLUMN).to(serializeMutation(mutation));
transaction.buffer(prepared.build());
index++;
}
}
Aggregations