@@ -27,7 +27,6 @@ import (
27
27
"github.com/kyleconroy/sqlc/internal/opts"
28
28
"github.com/kyleconroy/sqlc/internal/plugin"
29
29
"github.com/kyleconroy/sqlc/internal/shfmt"
30
- "github.com/kyleconroy/sqlc/internal/sql/ast"
31
30
)
32
31
33
32
var ErrFailedChecks = errors .New ("failed checks" )
@@ -157,35 +156,6 @@ func Vet(ctx context.Context, e Env, dir, filename string, stderr io.Writer) err
157
156
return nil
158
157
}
159
158
160
- // Determine if a query can be prepared based on the engine and the statement
161
- // type.
162
- func prepareable (sql config.SQL , raw * ast.RawStmt ) bool {
163
- if sql .Engine == config .EnginePostgreSQL {
164
- // TOOD: Add support for MERGE and VALUES stmts
165
- switch raw .Stmt .(type ) {
166
- case * ast.DeleteStmt :
167
- return true
168
- case * ast.InsertStmt :
169
- return true
170
- case * ast.SelectStmt :
171
- return true
172
- case * ast.UpdateStmt :
173
- return true
174
- default :
175
- return false
176
- }
177
- }
178
- // Almost all statements in MySQL can be prepared, so I'm just going to assume they can be
179
- // https://dev.mysql.com/doc/refman/8.0/en/sql-prepared-statements.html
180
- if sql .Engine == config .EngineMySQL {
181
- return true
182
- }
183
- if sql .Engine == config .EngineSQLite {
184
- return true
185
- }
186
- return false
187
- }
188
-
189
159
type preparer interface {
190
160
Prepare (context.Context , string , string ) error
191
161
}
@@ -393,13 +363,8 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error {
393
363
errored = true
394
364
continue
395
365
}
396
- if ! prepareable (s , result .Queries [i ].RawStmt ) {
397
- fmt .Fprintf (c .Stderr , "%s: %s: %s: error preparing query: %s\n " , query .Filename , query .Name , name , "query type is unpreparable" )
398
- errored = true
399
- continue
400
- }
401
- name := fmt .Sprintf ("sqlc_vet_%d_%d" , time .Now ().Unix (), i )
402
- if err := prep .Prepare (ctx , name , query .Text ); err != nil {
366
+ prepName := fmt .Sprintf ("sqlc_vet_%d_%d" , time .Now ().Unix (), i )
367
+ if err := prep .Prepare (ctx , prepName , query .Text ); err != nil {
403
368
fmt .Fprintf (c .Stderr , "%s: %s: %s: error preparing query: %s\n " , query .Filename , query .Name , name , err )
404
369
errored = true
405
370
continue
0 commit comments