(ctx context.Context, session *Session)
| 893 | } |
| 894 | |
| 895 | func (s *PartitionedDmlStatement) Execute(ctx context.Context, session *Session) (*Result, error) { |
| 896 | if session.InReadWriteTransaction() { |
| 897 | // PartitionedUpdate creates a new transaction and it could cause dead lock with the current running transaction. |
| 898 | return nil, errors.New(`Partitioned DML statement can not be run in a read-write transaction`) |
| 899 | } |
| 900 | if session.InReadOnlyTransaction() { |
| 901 | // Just for user-friendly. |
| 902 | return nil, errors.New(`Partitioned DML statement can not be run in a read-only transaction`) |
| 903 | } |
| 904 | |
| 905 | stmt := spanner.NewStatement(s.Dml) |
| 906 | ctx, cancel := context.WithTimeout(ctx, pdmlTimeout) |
| 907 | defer cancel() |
| 908 | |
| 909 | count, err := session.client.PartitionedUpdate(ctx, stmt) |
| 910 | if err != nil { |
| 911 | return nil, err |
| 912 | } |
| 913 | return &Result{ |
| 914 | IsMutation: true, |
| 915 | AffectedRows: int(count), |
| 916 | AffectedRowsType: rowCountTypeLowerBound, |
| 917 | }, nil |
| 918 | } |
| 919 | |
| 920 | type ExplainAnalyzeDmlStatement struct { |
| 921 | Dml string |
nothing calls this directly
no test coverage detected