|
| 1 | +// Copyright 2026-Present Couchbase, Inc. |
| 2 | +// |
| 3 | +// Use of this software is governed by the Business Source License included |
| 4 | +// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified |
| 5 | +// in that file, in accordance with the Business Source License, use of this |
| 6 | +// software will be governed by the Apache License, Version 2.0, included in |
| 7 | +// the file licenses/APL2.txt. |
| 8 | + |
| 9 | +package algebra |
| 10 | + |
| 11 | +/* |
| 12 | + * With auto prepare, determine whether a statement can skip being prepared |
| 13 | + */ |
| 14 | +func CanSkipAutoPrepare(stmt Statement) bool { |
| 15 | + switch stmt.(type) { |
| 16 | + case *InferKeyspace, *InferExpression, *Explain, *ExplainFunction, *Prepare, *Execute, |
| 17 | + *UpdateStatistics, |
| 18 | + *CreateIndex, *DropIndex, *BuildIndexes, *AlterIndex, *CreatePrimaryIndex, |
| 19 | + *CreateScope, *DropScope, |
| 20 | + *CreateCollection, *DropCollection, *FlushCollection, |
| 21 | + *GrantRole, *RevokeRole, |
| 22 | + *CreateFunction, *DropFunction, *ExecuteFunction, |
| 23 | + *StartTransaction, *CommitTransaction, *RollbackTransaction, *Savepoint, *TransactionIsolation, |
| 24 | + *CreateSequence, *DropSequence, *AlterSequence: |
| 25 | + return true |
| 26 | + } |
| 27 | + return false |
| 28 | +} |
0 commit comments