@@ -133,10 +133,7 @@ final class ImportService {
133133
134134 // 5. Begin transaction (if enabled)
135135 if config. wrapInTransaction {
136- let beginStmt = connection. type. beginTransactionSQL
137- if !beginStmt. isEmpty {
138- _ = try await driver. execute ( query: beginStmt)
139- }
136+ try await driver. beginTransaction ( )
140137 }
141138
142139 // 6. Parse and execute statements (single pass — no prior counting pass)
@@ -174,10 +171,7 @@ final class ImportService {
174171
175172 // 7. Commit transaction (if enabled)
176173 if config. wrapInTransaction {
177- let commitStmt = commitStatement ( for: connection. type)
178- if !commitStmt. isEmpty {
179- _ = try await driver. execute ( query: commitStmt)
180- }
174+ try await driver. commitTransaction ( )
181175 }
182176
183177 // 8. Re-enable FK checks (if enabled) - AFTER transaction
@@ -191,10 +185,7 @@ final class ImportService {
191185 // Rollback on error - this is CRITICAL and must not fail silently
192186 if config. wrapInTransaction {
193187 do {
194- let rollbackStmt = rollbackStatement ( for: connection. type)
195- if !rollbackStmt. isEmpty {
196- _ = try await driver. execute ( query: rollbackStmt)
197- }
188+ try await driver. rollbackTransaction ( )
198189 } catch let rollbackError {
199190 throw ImportError . rollbackFailed ( rollbackError. localizedDescription)
200191 }
@@ -311,23 +302,4 @@ final class ImportService {
311302 return [ ]
312303 }
313304 }
314-
315-
316- private func commitStatement( for dbType: DatabaseType ) -> String {
317- switch dbType {
318- case . mongodb, . redis, . clickhouse:
319- return " "
320- default :
321- return " COMMIT "
322- }
323- }
324-
325- private func rollbackStatement( for dbType: DatabaseType ) -> String {
326- switch dbType {
327- case . mongodb, . redis, . clickhouse:
328- return " "
329- default :
330- return " ROLLBACK "
331- }
332- }
333305}
0 commit comments