|
@@ -91,6 +91,7 @@ func (db *_ch) Query(ctx context.Context, query string, args ...any) (driver.Row
|
|
|
return db.conn.Query(ctx, query, args...)
|
|
|
}
|
|
|
|
|
|
+//goland:noinspection SqlNoDataSourceInspection
|
|
|
func (db *_ch) Batch(ctx context.Context, table string, release bool) (driver.Batch, error) {
|
|
|
table = strings.TrimSpace(table)
|
|
|
if table == "" {
|
|
@@ -98,22 +99,13 @@ func (db *_ch) Batch(ctx context.Context, table string, release bool) (driver.Ba
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
- batch driver.Batch
|
|
|
+ query = fmt.Sprintf("INSERT INTO `%s`", table)
|
|
|
opts []driver.PrepareBatchOption
|
|
|
- err error
|
|
|
)
|
|
|
|
|
|
if release {
|
|
|
opts = append(opts, driver.WithReleaseConnection())
|
|
|
}
|
|
|
|
|
|
- if //goland:noinspection SqlNoDataSourceInspection
|
|
|
- batch, err = db.conn.PrepareBatch(ctx,
|
|
|
- fmt.Sprintf("INSERT INTO `%s`", table),
|
|
|
- opts...,
|
|
|
- ); err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- return batch, nil
|
|
|
+ return db.conn.PrepareBatch(ctx, query, opts...)
|
|
|
}
|