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

Method Execute

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

Source from the content-addressed store, hash-verified

1024}
1025
1026func (s *BeginRwStatement) Execute(ctx context.Context, session *Session) (*Result, error) {
1027 if session.InReadWriteTransaction() {
1028 return nil, errors.New("you're in read-write transaction. Please finish the transaction by 'COMMIT;' or 'ROLLBACK;'")
1029 }
1030 if session.InReadOnlyTransaction() {
1031 return nil, errors.New("you're in read-only transaction. Please finish the transaction by 'CLOSE;'")
1032 }
1033
1034 if err := session.BeginReadWriteTransaction(ctx, s.IsolationLevel, s.Priority, s.Tag); err != nil {
1035 return nil, err
1036 }
1037
1038 return &Result{IsMutation: true}, nil
1039}
1040
1041type CommitStatement struct{}
1042

Callers 2

ExecuteMethod · 0.95

Calls 3

InReadOnlyTransactionMethod · 0.80

Tested by

no test coverage detected