MCPcopy Create free account
hub / github.com/cloudspannerecosystem/spanner-cli / Execute

Method Execute

statement.go:1132–1151  ·  view source on GitHub ↗
(ctx context.Context, session *Session)

Source from the content-addressed store, hash-verified

1130}
1131
1132func (s *BeginRoStatement) Execute(ctx context.Context, session *Session) (*Result, error) {
1133 if session.InReadWriteTransaction() {
1134 return nil, errors.New("You're in read-write transaction. Please finish the transaction by 'COMMIT;' or 'ROLLBACK;'")
1135 }
1136 if session.InReadOnlyTransaction() {
1137 // close current transaction implicitly
1138 close := &CloseStatement{}
1139 close.Execute(ctx, session)
1140 }
1141
1142 ts, err := session.BeginReadOnlyTransaction(ctx, s.TimestampBoundType, s.Staleness, s.Timestamp, s.Priority, s.Tag)
1143 if err != nil {
1144 return nil, err
1145 }
1146
1147 return &Result{
1148 IsMutation: true,
1149 Timestamp: ts,
1150 }, nil
1151}
1152
1153type CloseStatement struct{}
1154

Callers

nothing calls this directly

Calls 4

ExecuteMethod · 0.95
InReadOnlyTransactionMethod · 0.80

Tested by

no test coverage detected