sql: prepare support for INSERT, UPDATE, DELETE #4037
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make sure prepare statements are run in a transaction.
Use a new boolean flag on the planner to indicate prepare. Statement
implementations will gain knowledge of work to omit during prepare. An
alternative implementation would split up the prepare and exec portions of
the work. However, this would require passing around significant amounts
of state and I think the best implementation is the one here.
Keep a whitelist of statement types that support preparation instead of
attempting to exec them during prepare.
This also functions as a refactor for prepare statements in
general. Previously, we called parser.InferArgs, which walked the statement
and ran TypeCheck on all expressions. It turns out this is not needed,
since Select (and others) do this themselves. Thus, we can invoke those
worker functions directly but teach them about prepareOnly so they can
omit work once the val args have been populated and the type checks done.
Fixes #3819