🐛 fix(driver): 提升批量 INSERT 执行效率

Fixes #311
This commit is contained in:
Syngnat
2026-04-11 21:53:51 +08:00
parent 808c773134
commit 83fe3d4ed9
6 changed files with 207 additions and 0 deletions

View File

@@ -190,6 +190,17 @@ func (s *SqlServerDB) ExecContext(ctx context.Context, query string) (int64, err
return res.RowsAffected()
}
func (s *SqlServerDB) ExecBatchContext(ctx context.Context, query string) (int64, error) {
if s.conn == nil {
return 0, fmt.Errorf("连接未打开")
}
res, err := s.conn.ExecContext(ctx, query)
if err != nil {
return 0, err
}
return res.RowsAffected()
}
func (s *SqlServerDB) Exec(query string) (int64, error) {
if s.conn == nil {
return 0, fmt.Errorf("连接未打开")