(ctx context.Context, session *Session)
| 1153 | type CloseStatement struct{} |
| 1154 | |
| 1155 | func (s *CloseStatement) Execute(ctx context.Context, session *Session) (*Result, error) { |
| 1156 | if session.InReadWriteTransaction() { |
| 1157 | return nil, errors.New("You're in read-write transaction. Please finish the transaction by 'COMMIT;' or 'ROLLBACK;'") |
| 1158 | } |
| 1159 | |
| 1160 | result := &Result{IsMutation: true} |
| 1161 | |
| 1162 | if !session.InReadOnlyTransaction() { |
| 1163 | return result, nil |
| 1164 | } |
| 1165 | |
| 1166 | if err := session.CloseReadOnlyTransaction(); err != nil { |
| 1167 | return nil, err |
| 1168 | } |
| 1169 | |
| 1170 | return result, nil |
| 1171 | } |
| 1172 | |
| 1173 | type NopStatement struct{} |
| 1174 |
no test coverage detected